aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorSushma Rai <rsushma@src.gnome.org>2005-10-03 16:56:21 +0800
committerSushma Rai <rsushma@src.gnome.org>2005-10-03 16:56:21 +0800
commit114f486953b5446ad40bd369b5e1d9182a01f88c (patch)
tree893d267c6a3f6aa0cca2c2091956be8fb4048680 /addressbook
parent059ed8df224d10a94d3c9e9f4d9001bb8ed59a3d (diff)
downloadgsoc2013-evolution-114f486953b5446ad40bd369b5e1d9182a01f88c.tar
gsoc2013-evolution-114f486953b5446ad40bd369b5e1d9182a01f88c.tar.gz
gsoc2013-evolution-114f486953b5446ad40bd369b5e1d9182a01f88c.tar.bz2
gsoc2013-evolution-114f486953b5446ad40bd369b5e1d9182a01f88c.tar.lz
gsoc2013-evolution-114f486953b5446ad40bd369b5e1d9182a01f88c.tar.xz
gsoc2013-evolution-114f486953b5446ad40bd369b5e1d9182a01f88c.tar.zst
gsoc2013-evolution-114f486953b5446ad40bd369b5e1d9182a01f88c.zip
Fix for issues related to printing contacts. Fixes #248624, #274285,
#209354, #202201. Patch submitted by "Devashish Sharma <sdevashish@novell.com>" svn path=/trunk/; revision=30469
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog24
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c16
-rw-r--r--addressbook/printing/e-contact-print.c59
-rw-r--r--addressbook/printing/e-contact-print.h6
4 files changed, 87 insertions, 18 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 3c2e3bfba3..9af69a2f1e 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,27 @@
+2005-10-03 Devashish Sharma <sdevashish@novell.com>
+
+ * gui/widgets/e-addressbook-view.c (eab_view_print): Get selected
+ contacts list and forward it. Earlier list was not being sent so no
+ chance of printing the selected contacts.
+ (eab_view_print_preview): Same as for print above.
+
+ * printing/e-contact-print.c (e_contact_print_dialog_new): uses_book was
+ being set in every case. removed that and set contact list which is now
+ being passed to it from eab_view_print.
+ (e_contact_print_preview): It was generating preview for the whole
+ book in all cases. Now if there is a list of selected contacts it
+ generates preview for only those contacts and if the list is NULL (no
+ selected contacts), it generates preview for the whole book.
+ (e_contact_print_response): Checks the current range selected (All or
+ selection) and prints the contacts based on that. If All is selected
+ all contacts are printed and if Selection is selected only the selected
+ contacts are printed.
+
+ * printing/e-contact-print.h: Changed the function prototype for
+ e_contact_print_dialog_new and e_contact_print_preview, both of them
+ now accept a list of selected contacts.
+ Fixes #248624, #274285, #209354, #202201
+
2005-09-30 Devashish Sharma <sdevashish@novell.com>
* gui/merging/eab-contact-compare.c
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index eb4cc72959..ee46475309 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -1751,8 +1751,10 @@ eab_view_print(EABView *view)
"query", &query,
"book", &book,
NULL);
- print = e_contact_print_dialog_new(book, query);
+ GList *list = get_selected_contacts (view);
+ print = e_contact_print_dialog_new (book, query, list);
g_free(query);
+ e_free_object_list(list);
gtk_widget_show(print);
}
else if (view->view_type == EAB_VIEW_TABLE) {
@@ -1761,9 +1763,8 @@ eab_view_print(EABView *view)
ETable *etable;
EContactPrintDialogWeakData *weak_data;
- dialog = e_print_get_dialog (_("Print cards"), GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES);
- gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION,
- NULL, NULL, NULL);
+ /* FIXME: Allow range selection in table views, as in minicard view */
+ dialog = e_print_get_dialog (_("Print cards"), GNOME_PRINT_DIALOG_COPIES);
g_object_get(view->widget, "table", &etable, NULL);
printable = e_table_get_printable(etable);
@@ -1805,8 +1806,10 @@ eab_view_print_preview(EABView *view)
"query", &query,
"book", &book,
NULL);
- e_contact_print_preview(book, query);
- g_free(query);
+ GList *list = get_selected_contacts (view);
+ e_contact_print_preview (book, query, list);
+ e_free_object_list (list);
+ g_free (query);
} else if (view->view_type == EAB_VIEW_TABLE) {
EPrintable *printable;
ETable *etable;
@@ -1878,6 +1881,7 @@ eab_view_delete_selection(EABView *view, gboolean is_delete)
!eab_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(view->widget)),
plural, is_list, name)) {
g_free (name);
+ e_free_object_list(list);
return;
}
diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c
index be414e602d..a877d7f06a 100644
--- a/addressbook/printing/e-contact-print.c
+++ b/addressbook/printing/e-contact-print.c
@@ -861,8 +861,19 @@ e_contact_print_response(GtkWidget *dialog, gint response_id, gpointer data)
GnomePrintJob *master;
GnomePrintConfig *config;
GnomePrintContext *pc;
- gboolean uses_book = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dialog), "uses_book"));
- gboolean uses_list = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dialog), "uses_list"));
+ gboolean uses_book = FALSE, uses_list = FALSE, uses_range = FALSE;
+
+ uses_range = GPOINTER_TO_INT (g_object_get_data(G_OBJECT (dialog), "uses_range"));
+ if (uses_range) {
+ if (gnome_print_dialog_get_range (GNOME_PRINT_DIALOG (dialog)) & GNOME_PRINT_RANGE_ALL)
+ uses_book = TRUE;
+ if (gnome_print_dialog_get_range (GNOME_PRINT_DIALOG (dialog)) & GNOME_PRINT_RANGE_SELECTION)
+ uses_list = TRUE;
+ }
+ else {
+ uses_book = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), "uses_book"));
+ uses_list = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), "uses_list"));
+ }
EBook *book = NULL;
EBookQuery *query = NULL;
EContact *contact = NULL;
@@ -993,20 +1004,27 @@ e_contact_print_response(GtkWidget *dialog, gint response_id, gpointer data)
}
GtkWidget *
-e_contact_print_dialog_new(EBook *book, char *query)
+e_contact_print_dialog_new(EBook *book, char *query, GList *list)
{
GtkWidget *dialog;
+ GList *copied_list = NULL;
+ GList *l;
dialog = e_print_get_dialog(_("Print contacts"), GNOME_PRINT_DIALOG_RANGE | GNOME_PRINT_DIALOG_COPIES);
gnome_print_dialog_construct_range_any(GNOME_PRINT_DIALOG(dialog), GNOME_PRINT_RANGE_ALL | GNOME_PRINT_RANGE_SELECTION,
NULL, NULL, NULL);
+ if (list != NULL) {
+ copied_list = g_list_copy (list);
+ for (l = copied_list; l; l = l->next)
+ l->data = e_contact_duplicate (E_CONTACT (l->data));
+ }
g_object_ref(book);
- g_object_set_data(G_OBJECT(dialog), "uses_book", GINT_TO_POINTER (TRUE));
- g_object_set_data(G_OBJECT(dialog), "uses_list", GINT_TO_POINTER (FALSE));
+ g_object_set_data(G_OBJECT(dialog), "contact_list", copied_list);
g_object_set_data(G_OBJECT(dialog), "book", book);
g_object_set_data(G_OBJECT(dialog), "query", e_book_query_from_string (query));
+ g_object_set_data(G_OBJECT(dialog), "uses_range", GINT_TO_POINTER (TRUE));
g_signal_connect(dialog,
"response", G_CALLBACK(e_contact_print_response), NULL);
g_signal_connect(dialog,
@@ -1015,7 +1033,7 @@ e_contact_print_dialog_new(EBook *book, char *query)
}
void
-e_contact_print_preview(EBook *book, char *query)
+e_contact_print_preview(EBook *book, char *query, GList *list)
{
EContactPrintContext *ctxt = g_new(EContactPrintContext, 1);
EContactPrintStyle *style = g_new(EContactPrintStyle, 1);
@@ -1023,12 +1041,25 @@ e_contact_print_preview(EBook *book, char *query)
GnomePrintContext *pc;
GnomePrintConfig *config;
gdouble font_size;
+ GList *copied_list = NULL;
+ GList *l;
+ gboolean uses_book = FALSE, uses_list = FALSE;
config = e_print_load_config ();
master = gnome_print_job_new (config);
pc = gnome_print_job_get_context (master);
e_contact_build_style (style);
+ if (list == NULL) {
+ uses_book = TRUE;
+ }
+ else {
+ uses_list = TRUE;
+ copied_list = g_list_copy (list);
+ for (l = copied_list; l; l = l->next)
+ l->data = e_contact_duplicate (E_CONTACT (l->data));
+ }
+
ctxt->x = 0;
ctxt->y = 0;
ctxt->column = 0;
@@ -1053,9 +1084,17 @@ e_contact_print_preview(EBook *book, char *query)
#endif
ctxt->book = book;
ctxt->query = e_book_query_from_string (query);
- ctxt->contacts = NULL;
- g_object_ref(book);
- e_contact_do_print(book, ctxt->query, ctxt);
+
+ if (uses_book) {
+ ctxt->contacts = NULL;
+ g_object_ref (book);
+ e_contact_do_print (book, ctxt->query, ctxt);
+ }
+ else if(uses_list) {
+ ctxt->contacts = g_list_copy (copied_list);
+ g_list_foreach (ctxt->contacts, (GFunc)g_object_ref, NULL);
+ complete_sequence (NULL, E_BOOK_VIEW_STATUS_OK, ctxt);
+ }
}
GtkWidget *
@@ -1069,6 +1108,7 @@ e_contact_print_contact_dialog_new(EContact *contact)
g_object_set_data(G_OBJECT(dialog), "contact", contact);
g_object_set_data(G_OBJECT(dialog), "uses_list", GINT_TO_POINTER (FALSE));
g_object_set_data(G_OBJECT(dialog), "uses_book", GINT_TO_POINTER (FALSE));
+ g_object_set_data(G_OBJECT(dialog), "uses_range", GINT_TO_POINTER (FALSE));
g_signal_connect(dialog,
"response", G_CALLBACK(e_contact_print_response), NULL);
g_signal_connect(dialog,
@@ -1095,6 +1135,7 @@ e_contact_print_contact_list_dialog_new(GList *list)
g_object_set_data(G_OBJECT(dialog), "contact_list", copied_list);
g_object_set_data(G_OBJECT(dialog), "uses_list", GINT_TO_POINTER (TRUE));
g_object_set_data(G_OBJECT(dialog), "uses_book", GINT_TO_POINTER (FALSE));
+ g_object_set_data(G_OBJECT(dialog), "uses_range", GINT_TO_POINTER (FALSE));
g_signal_connect(dialog,
"response", G_CALLBACK(e_contact_print_response), NULL);
g_signal_connect(dialog,
diff --git a/addressbook/printing/e-contact-print.h b/addressbook/printing/e-contact-print.h
index 4edc948082..68c14aef9a 100644
--- a/addressbook/printing/e-contact-print.h
+++ b/addressbook/printing/e-contact-print.h
@@ -28,9 +28,9 @@
#include <libebook/e-contact.h>
#include "e-contact-print-types.h"
-GtkWidget *e_contact_print_dialog_new(EBook *book, char *query);
-void e_contact_print_preview(EBook *book, char *query);
-GtkWidget *e_contact_print_contact_dialog_new(EContact *card);
+GtkWidget *e_contact_print_dialog_new (EBook *book, char *query, GList *list);
+void e_contact_print_preview (EBook *book, char *query, GList *list);
+GtkWidget *e_contact_print_contact_dialog_new (EContact *card);
GtkWidget *e_contact_print_contact_list_dialog_new(GList *list);
#endif /* E_CONTACT_PRINT_H */