diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-11-14 07:18:26 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-11-14 07:18:26 +0800 |
commit | 77a05d6576078fbd7495668bfa95b0a66d0c2fa5 (patch) | |
tree | 08229379e02502ded230a953e51f1d5dbbe59eea | |
parent | d428935b383f96cc8c95fd345b8cc5c68c6fde8d (diff) | |
download | gsoc2013-evolution-77a05d6576078fbd7495668bfa95b0a66d0c2fa5.tar gsoc2013-evolution-77a05d6576078fbd7495668bfa95b0a66d0c2fa5.tar.gz gsoc2013-evolution-77a05d6576078fbd7495668bfa95b0a66d0c2fa5.tar.bz2 gsoc2013-evolution-77a05d6576078fbd7495668bfa95b0a66d0c2fa5.tar.lz gsoc2013-evolution-77a05d6576078fbd7495668bfa95b0a66d0c2fa5.tar.xz gsoc2013-evolution-77a05d6576078fbd7495668bfa95b0a66d0c2fa5.tar.zst gsoc2013-evolution-77a05d6576078fbd7495668bfa95b0a66d0c2fa5.zip |
BugĀ 601769 - Print issues in address book
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 20 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.h | 1 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-view-actions.c | 67 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-view-actions.h | 6 | ||||
-rw-r--r-- | modules/addressbook/e-book-shell-view.c | 12 | ||||
-rw-r--r-- | ui/evolution-contacts.ui | 6 |
6 files changed, 75 insertions, 37 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index cfff4313bb..2cb8094ff1 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -944,6 +944,7 @@ e_contact_print_button (EPrintable *printable, GtkPrintOperationAction action) void e_addressbook_view_print (EAddressbookView *view, + gboolean selection_only, GtkPrintOperationAction action) { GalView *gal_view; @@ -954,12 +955,21 @@ e_addressbook_view_print (EAddressbookView *view, view_instance = e_addressbook_view_get_view_instance (view); gal_view = gal_view_instance_get_current_view (view_instance); - if (GAL_IS_VIEW_MINICARD (gal_view)) { + /* Print the selected contacts. */ + if (GAL_IS_VIEW_MINICARD (gal_view) && selection_only) { + GList *contact_list; + + contact_list = e_addressbook_view_get_selected (view); + e_contact_print (NULL, NULL, contact_list, action); + g_list_foreach (contact_list, (GFunc) g_object_unref, NULL); + g_list_free (contact_list); + + /* Print the latest query results. */ + } else if (GAL_IS_VIEW_MINICARD (gal_view)) { EAddressbookModel *model; EBook *book; EBookQuery *query; gchar *query_string; - GList *contact_list; model = e_addressbook_view_get_model (view); book = e_addressbook_model_get_book (model); @@ -971,14 +981,12 @@ e_addressbook_view_print (EAddressbookView *view, query = NULL; g_free (query_string); - contact_list = e_addressbook_view_get_selected (view); - e_contact_print (book, query, contact_list, action); - g_list_foreach (contact_list, (GFunc) g_object_unref, NULL); - g_list_free (contact_list); + e_contact_print (book, query, NULL, action); if (query != NULL) e_book_query_unref (query); + /* XXX Does this print the entire table or just selected? */ } else if (GAL_IS_VIEW_ETABLE (gal_view)) { EPrintable *printable; ETable *table; diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h index ca709ff347..28307ada64 100644 --- a/addressbook/gui/widgets/e-addressbook-view.h +++ b/addressbook/gui/widgets/e-addressbook-view.h @@ -99,6 +99,7 @@ EShellView * e_addressbook_view_get_shell_view ESource * e_addressbook_view_get_source (EAddressbookView *view); void e_addressbook_view_view (EAddressbookView *view); void e_addressbook_view_print (EAddressbookView *view, + gboolean selection_only, GtkPrintOperationAction action); void e_addressbook_view_delete_selection (EAddressbookView *view, diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c index 495aed6f1d..41b88efbc6 100644 --- a/modules/addressbook/e-book-shell-view-actions.c +++ b/modules/addressbook/e-book-shell-view-actions.c @@ -130,6 +130,38 @@ action_address_book_new_cb (GtkAction *action, } static void +action_address_book_print_cb (GtkAction *action, + EBookShellView *book_shell_view) +{ + EBookShellContent *book_shell_content; + EAddressbookView *view; + GtkPrintOperationAction print_action; + + book_shell_content = book_shell_view->priv->book_shell_content; + view = e_book_shell_content_get_current_view (book_shell_content); + g_return_if_fail (view != NULL); + + print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; + e_addressbook_view_print (view, FALSE, print_action); +} + +static void +action_address_book_print_preview_cb (GtkAction *action, + EBookShellView *book_shell_view) +{ + EBookShellContent *book_shell_content; + EAddressbookView *view; + GtkPrintOperationAction print_action; + + book_shell_content = book_shell_view->priv->book_shell_content; + view = e_book_shell_content_get_current_view (book_shell_content); + g_return_if_fail (view != NULL); + + print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW; + e_addressbook_view_print (view, FALSE, print_action); +} + +static void action_address_book_properties_cb (GtkAction *action, EBookShellView *book_shell_view) { @@ -494,23 +526,7 @@ action_contact_print_cb (GtkAction *action, g_return_if_fail (view != NULL); print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; - e_addressbook_view_print (view, print_action); -} - -static void -action_contact_print_preview_cb (GtkAction *action, - EBookShellView *book_shell_view) -{ - EBookShellContent *book_shell_content; - EAddressbookView *view; - GtkPrintOperationAction print_action; - - book_shell_content = book_shell_view->priv->book_shell_content; - view = e_book_shell_content_get_current_view (book_shell_content); - g_return_if_fail (view != NULL); - - print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW; - e_addressbook_view_print (view, print_action); + e_addressbook_view_print (view, TRUE, print_action); } static void @@ -1002,19 +1018,26 @@ static GtkRadioActionEntry contact_search_entries[] = { static GtkActionEntry lockdown_printing_entries[] = { - { "contact-print", + { "address-book-print", GTK_STOCK_PRINT, NULL, "<Control>p", - N_("Print selected contacts"), - G_CALLBACK (action_contact_print_cb) }, + N_("Print all shown contacts"), + G_CALLBACK (action_address_book_print_cb) }, - { "contact-print-preview", + { "address-book-print-preview", GTK_STOCK_PRINT_PREVIEW, NULL, NULL, N_("Preview the contacts to be printed"), - G_CALLBACK (action_contact_print_preview_cb) } + G_CALLBACK (action_address_book_print_preview_cb) }, + + { "contact-print", + GTK_STOCK_PRINT, + NULL, + NULL, + N_("Print selected contacts"), + G_CALLBACK (action_contact_print_cb) } }; static EPopupActionEntry lockdown_printing_popup_entries[] = { diff --git a/modules/addressbook/e-book-shell-view-actions.h b/modules/addressbook/e-book-shell-view-actions.h index 4c3a18bddf..e5eea1fb5a 100644 --- a/modules/addressbook/e-book-shell-view-actions.h +++ b/modules/addressbook/e-book-shell-view-actions.h @@ -31,6 +31,10 @@ E_SHELL_WINDOW_ACTION ((window), "address-book-delete") #define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_MOVE(window) \ E_SHELL_WINDOW_ACTION ((window), "address-book-move") +#define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_PRINT(window) \ + E_SHELL_WINDOW_ACTION ((window), "address-book-print") +#define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_PRINT_PREVIEW(window) \ + E_SHELL_WINDOW_ACTION ((window), "address-book-print-preview") #define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_PROPERTIES(window) \ E_SHELL_WINDOW_ACTION ((window), "address-book-properties") #define E_SHELL_WINDOW_ACTION_ADDRESS_BOOK_RENAME(window) \ @@ -65,8 +69,6 @@ E_SHELL_WINDOW_ACTION ((window), "contact-preview") #define E_SHELL_WINDOW_ACTION_CONTACT_PRINT(window) \ E_SHELL_WINDOW_ACTION ((window), "contact-print") -#define E_SHELL_WINDOW_ACTION_CONTACT_PRINT_PREVIEW(window) \ - E_SHELL_WINDOW_ACTION ((window), "contact-print-preview") #define E_SHELL_WINDOW_ACTION_CONTACT_SAVE_AS(window) \ E_SHELL_WINDOW_ACTION ((window), "contact-save-as") #define E_SHELL_WINDOW_ACTION_CONTACT_SELECT_ALL(window) \ diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c index 88a503b024..d5f160d407 100644 --- a/modules/addressbook/e-book-shell-view.c +++ b/modules/addressbook/e-book-shell-view.c @@ -287,6 +287,14 @@ book_shell_view_update_actions (EShellView *shell_view) sensitive = has_primary_source && !primary_source_is_system; gtk_action_set_sensitive (action, sensitive); + action = ACTION (ADDRESS_BOOK_PRINT); + sensitive = has_primary_source; + gtk_action_set_sensitive (action, sensitive); + + action = ACTION (ADDRESS_BOOK_PRINT_PREVIEW); + sensitive = has_primary_source; + gtk_action_set_sensitive (action, sensitive); + action = ACTION (ADDRESS_BOOK_RENAME); sensitive = has_primary_source; gtk_action_set_sensitive (action, sensitive); @@ -336,10 +344,6 @@ book_shell_view_update_actions (EShellView *shell_view) sensitive = any_contacts_selected; gtk_action_set_sensitive (action, sensitive); - action = ACTION (CONTACT_PRINT_PREVIEW); - sensitive = any_contacts_selected; - gtk_action_set_sensitive (action, sensitive); - action = ACTION (CONTACT_SAVE_AS); sensitive = any_contacts_selected; gtk_action_set_sensitive (action, sensitive); diff --git a/ui/evolution-contacts.ui b/ui/evolution-contacts.ui index 2b95d86fc4..8b04c3be9d 100644 --- a/ui/evolution-contacts.ui +++ b/ui/evolution-contacts.ui @@ -7,8 +7,8 @@ <menuitem action='address-book-save-as'/> </placeholder> <placeholder name='print-actions'> - <menuitem action='contact-print-preview'/> - <menuitem action='contact-print'/> + <menuitem action='address-book-print-preview'/> + <menuitem action='address-book-print'/> </placeholder> </menu> <menu action='edit-menu'> @@ -50,7 +50,7 @@ </placeholder> </menubar> <toolbar name='main-toolbar'> - <toolitem action='contact-print'/> + <toolitem action='address-book-print'/> <toolitem action='contact-delete'/> <toolitem action='address-book-stop'/> </toolbar> |