[evolution-patches] [addressbook] Solves some addressbook related printing issues
- From: Devashish <sdevashish novell com>
- To: patches <evolution-patches gnome org>
- Subject: [evolution-patches] [addressbook] Solves some addressbook related printing issues
- Date: Fri, 16 Sep 2005 17:02:04 +0530
Hi,
The attached patch fixes Bugs 248624, 274285, 209354 and 202201.
thanks
Devashish Sharma
Index: addressbook/gui/widgets/e-addressbook-view.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/widgets/e-addressbook-view.c,v
retrieving revision 1.170
diff -u -p -r1.170 e-addressbook-view.c
--- addressbook/gui/widgets/e-addressbook-view.c 24 Aug 2005 03:06:51 -0000 1.170
+++ addressbook/gui/widgets/e-addressbook-view.c 16 Sep 2005 10:51:49 -0000
@@ -1748,8 +1748,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) {
@@ -1758,9 +1760,7 @@ 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);
+ 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);
@@ -1802,7 +1802,9 @@ eab_view_print_preview(EABView *view)
"query", &query,
"book", &book,
NULL);
- e_contact_print_preview(book, 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;
Index: addressbook/printing/e-contact-print.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/printing/e-contact-print.c,v
retrieving revision 1.50
diff -u -p -r1.50 e-contact-print.c
--- addressbook/printing/e-contact-print.c 17 Jun 2005 15:20:26 -0000 1.50
+++ addressbook/printing/e-contact-print.c 16 Sep 2005 11:01:38 -0000
@@ -861,8 +861,19 @@ e_contact_print_response(GtkWidget *dial
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 *dial
}
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,
}
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,24 @@ e_contact_print_preview(EBook *book, cha
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 +1083,17 @@ e_contact_print_preview(EBook *book, cha
#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 +1107,7 @@ e_contact_print_contact_dialog_new(ECont
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 +1134,7 @@ e_contact_print_contact_list_dialog_new(
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,
Index: addressbook/printing/e-contact-print.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/printing/e-contact-print.h,v
retrieving revision 1.13
diff -u -p -r1.13 e-contact-print.h
--- addressbook/printing/e-contact-print.h 7 Nov 2003 05:51:42 -0000 1.13
+++ addressbook/printing/e-contact-print.h 16 Sep 2005 11:01:38 -0000
@@ -28,8 +28,8 @@
#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_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);
Index: addressbook/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1991
diff -u -p -r1.1991 ChangeLog
--- addressbook/ChangeLog 14 Sep 2005 10:27:07 -0000 1.1991
+++ addressbook/ChangeLog 16 Sep 2005 11:27:21 -0000
@@ -1,3 +1,29 @@
+2005-09-16 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-14 Sushma Rai <rsushma novell com>
* gui/contact-list-editor/e-contact-list-editor.etspec: Set selection
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]