aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-08-08 12:26:12 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-08-08 12:26:12 +0800
commitcea054cd54d84479352a43bbabc19c9ce9af5efb (patch)
treeba02763209ba0f22989024004f57689071603ec5 /addressbook
parent91a6b6899e5568ed34f913bedb538dd6c9e35b32 (diff)
downloadgsoc2013-evolution-cea054cd54d84479352a43bbabc19c9ce9af5efb.tar.gz
gsoc2013-evolution-cea054cd54d84479352a43bbabc19c9ce9af5efb.tar.zst
gsoc2013-evolution-cea054cd54d84479352a43bbabc19c9ce9af5efb.zip
Merge revisions 35747:35930 from trunk.
svn path=/branches/kill-bonobo/; revision=35931
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog85
-rw-r--r--addressbook/addressbook.error.xml6
-rw-r--r--addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in2
-rw-r--r--addressbook/gui/component/addressbook-component.c6
-rw-r--r--addressbook/gui/component/addressbook-config.c14
-rw-r--r--addressbook/gui/component/addressbook-view.c2
-rw-r--r--addressbook/gui/component/ldap-config.glade48
-rw-r--r--addressbook/gui/contact-list-editor/contact-list-editor.glade2
-rw-r--r--addressbook/gui/contact-list-editor/e-contact-list-editor.c10
-rw-r--r--addressbook/gui/merging/eab-contact-duplicate-detected.glade2
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c40
-rw-r--r--addressbook/gui/widgets/e-minicard-view.h1
-rw-r--r--addressbook/gui/widgets/e-minicard.c48
-rw-r--r--addressbook/printing/e-contact-print.c137
14 files changed, 307 insertions, 96 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index c62f154be6..bb251b4963 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,78 @@
+2008-08-07 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #324203
+
+ * gui/component/ldap-config.glade:
+ * gui/component/addressbook-config.c: (canbrowse_toggled_cb),
+ (eabc_details_limit): New check box to be able to set LDAP
+ address books browseable until reaches given limits.
+
+2008-08-06 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #249844
+
+ * gui/component/addressbook-component.c:
+ (impl__get_userCreatableItems): Do not let compiler claim.
+
+2008-08-06 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #546263
+
+ * gui/widgets/e-minicard.c: (add_field), (add_email_field), (remodel):
+ Add 'width' property as the last one for 'new' item, thus it will know
+ all the information to properly calculate column widths. Also don't
+ set field names for the contact-lists. Both changes prevents messing
+ of minicard painting for changed contact-lists.
+
+2008-08-04 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes bug #249844
+
+ * gui/component/addressbook-component.c
+ (impl__get_userCreatableItems):
+ Use C_() macro instead of Q_() macro.
+ Use fully qualified names for "New" submenu entries.
+
+2008-08-02 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #546057
+
+ * gui/component/GNOME_Evolution_Addressbook.server.in.in:
+ * gui/contact-list-editor/contact-list-editor.glade:
+ Use "x-office-address-book" icon name instead of "stock_addressbook".
+
+2008-07-30 Milan Crha <mcrha@redhat.com>
+
+ ** Part of fix for bug #211267
+
+ * printing/e-contact-print.c: (struct _EContactPrintContext),
+ (e_contact_print_letter_heading), (e_contact_start_new_page),
+ (e_contact_print_contact), (contact_draw_page),
+ (e_contact_print): Report correct number of pages to print
+ and print them as requested.
+
+2008-07-30 Takao Fujiwara <takao.fujiwara@sun.com>
+
+ Reviewed by Andre Klapper <a9016009@gmx.de>
+
+ ** Fix for bug #545300
+
+ * gui/merging/eab-contact-duplicate-detected.glade:
+ Add a translatable tag in "_Merge" string.
+
+2008-07-28 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #544383
+
+ * gui/contact-list-editor/e-contact-list-editor.c:
+ (e_contact_list_editor_get_contact): Put list members in reverse order,
+ because 'e_vcard_add_attribute' uses prepend, thus changes order on
+ every single save of the contact list.
+
+2008-07-20 Andre Klapper <a9016009@gmx.de>
+
+ * addressbook.error.xml: Fix some strings. See bug #543753.
+
2008-07-13 Keith Packard <keithp@keithp.com>
** Fix for bug #541355
@@ -8,6 +83,16 @@
handle. This patch removes any freed objects from the 'locals' list in
each conduit which otherwise frees them again when the conduit is closed.
+2008-07-09 Milan Crha <mcrha@redhat.com>
+
+ ** Fix for bug #228725
+
+ * gui/widgets/e-minicard-view.h: (struct _EMinicardView):
+ * gui/widgets/e-minicard-view.c: (set_empty_message),
+ (stop_state_changed), (e_minicard_view_set_property),
+ (e_minicard_view_dispose), (e_minicard_view_init):
+ Show different message in a view when searching.
+
2008-07-03 Milan Crha <mcrha@redhat.com>
** Fix for bug #540152
diff --git a/addressbook/addressbook.error.xml b/addressbook/addressbook.error.xml
index ceec857adf..bfea4ce405 100644
--- a/addressbook/addressbook.error.xml
+++ b/addressbook/addressbook.error.xml
@@ -110,18 +110,18 @@
<error id="gw-book-list-init" type="warning">
<_primary>GroupWise Address book creation:</_primary>
- <_secondary>Currently you can access only GroupWise System Address Book from Evolution. Please use some other GroupWise mail client once, to get your GroupWise Frequent Contacts and Groupwise Personal Contacts folders.</_secondary>
+ <_secondary>Currently you can access only GroupWise System Address Book from Evolution. Please use some other GroupWise mail client once, to get your GroupWise Frequent Contacts and GroupWise Personal Contacts folders.</_secondary>
</error>
<error id="contact-delete-error-perm" type="warning">
<_primary>Failed to delete contact</_primary>
- <_secondary>You do not have enough permissions to delete contact in this Address Book.</_secondary>
+ <_secondary>You do not have permission to delete contacts in this address book.</_secondary>
</error>
<error id="error-read-only" type="error" default="GTK_RESPONSE_YES">
<_primary>Cannot add new contact</_primary>
<!-- For Translators: {0} is the name of the address book source -->
- <_secondary>'{0}' is a read-only address book source. Switch to Contacts View and highlight an address book that can accept contacts.</_secondary>
+ <_secondary>'{0}' is a read-only address book and cannot be modified. Please select a different address book from the side bar in the Contacts view.</_secondary>
<button stock ="gtk-ok" response="GTK_RESPONSE_YES"/>
</error>
diff --git a/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in b/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in
index feef3bdfc9..4fe2ce7a6a 100644
--- a/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in
+++ b/addressbook/gui/component/GNOME_Evolution_Addressbook.server.in.in
@@ -50,7 +50,7 @@
<oaf_attribute name="evolution:button_label" type="string" _value="Contacts"/>
<oaf_attribute name="evolution:button_tooltips" type="string" _value="Contacts"/>
<oaf_attribute name="evolution:button_sort_order" type="string" value="-9"/>
- <oaf_attribute name="evolution:button_icon" type="string" value="stock_addressbook"/>
+ <oaf_attribute name="evolution:button_icon" type="string" value="x-office-address-book"/>
</oaf_server>
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c
index b55cb9bd16..82f00f00c3 100644
--- a/addressbook/gui/component/addressbook-component.c
+++ b/addressbook/gui/component/addressbook-component.c
@@ -226,7 +226,7 @@ impl__get_userCreatableItems (PortableServer_Servant servant,
list->_buffer[0].id = "contact";
list->_buffer[0].description = _("New Contact");
- list->_buffer[0].menuDescription = _("_Contact");
+ list->_buffer[0].menuDescription = (char *) C_("New", "_Contact");
list->_buffer[0].tooltip = _("Create a new contact");
list->_buffer[0].menuShortcut = 'c';
list->_buffer[0].iconName = "contact-new";
@@ -234,7 +234,7 @@ impl__get_userCreatableItems (PortableServer_Servant servant,
list->_buffer[1].id = "contact_list";
list->_buffer[1].description = _("New Contact List");
- list->_buffer[1].menuDescription = _("Contact _List");
+ list->_buffer[1].menuDescription = (char *) C_("New", "Contact _List");
list->_buffer[1].tooltip = _("Create a new contact list");
list->_buffer[1].menuShortcut = 'l';
list->_buffer[1].iconName = "stock_contact-list";
@@ -242,7 +242,7 @@ impl__get_userCreatableItems (PortableServer_Servant servant,
list->_buffer[2].id = "address_book";
list->_buffer[2].description = _("New Address Book");
- list->_buffer[2].menuDescription = _("Address _Book");
+ list->_buffer[2].menuDescription = (char *) C_("New", "Address _Book");
list->_buffer[2].tooltip = _("Create a new address book");
list->_buffer[2].menuShortcut = '\0';
list->_buffer[2].iconName = "address-book-new";
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
index 76b5dca5c1..2b749a6dd8 100644
--- a/addressbook/gui/component/addressbook-config.c
+++ b/addressbook/gui/component/addressbook-config.c
@@ -111,6 +111,7 @@ struct _AddressbookSourceDialog {
GtkWidget *search_filter;
GtkWidget *timeout_scale;
GtkWidget *limit_spinbutton;
+ GtkWidget *canbrowsecheck;
/* display name page fields */
GtkWidget *display_name;
@@ -925,6 +926,15 @@ limit_changed_cb(GtkWidget *w, AddressbookSourceDialog *sdialog)
e_source_set_property(sdialog->source, "limit", limit);
}
+static void
+canbrowse_toggled_cb (GtkWidget *toggle_button, ESource *source)
+{
+ if (!source || !toggle_button)
+ return;
+
+ e_source_set_property (source, "can-browse", gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle_button)) ? "1" : NULL);
+}
+
static GtkWidget *
eabc_details_limit(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, struct _GtkWidget *old, void *data)
{
@@ -956,6 +966,10 @@ eabc_details_limit(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, st
gtk_spin_button_set_value((GtkSpinButton *)sdialog->limit_spinbutton, tmp?g_strtod(tmp, NULL):100.0);
g_signal_connect (sdialog->limit_spinbutton, "value_changed", G_CALLBACK (limit_changed_cb), sdialog);
+ sdialog->canbrowsecheck = glade_xml_get_widget (gui, "canbrowsecheck");
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (sdialog->canbrowsecheck), e_source_get_property (sdialog->source, "can-browse") && strcmp (e_source_get_property (sdialog->source, "can-browse"), "1") == 0);
+ g_signal_connect (sdialog->canbrowsecheck, "toggled", G_CALLBACK (canbrowse_toggled_cb), sdialog->source);
+
g_object_unref(gui);
return w;
diff --git a/addressbook/gui/component/addressbook-view.c b/addressbook/gui/component/addressbook-view.c
index cb66508eac..3db5bbdf36 100644
--- a/addressbook/gui/component/addressbook-view.c
+++ b/addressbook/gui/component/addressbook-view.c
@@ -1330,7 +1330,7 @@ addressbook_view_init (AddressbookView *view)
e_activity_handler_attach_task_bar (priv->activity_handler,
E_TASK_BAR (priv->statusbar_widget));
- priv->info_widget = e_info_label_new("contact-new");
+ priv->info_widget = e_info_label_new("x-office-address-book");
e_info_label_set_info((EInfoLabel*)priv->info_widget, _("Contacts"), "");
gtk_widget_show (priv->info_widget);
diff --git a/addressbook/gui/component/ldap-config.glade b/addressbook/gui/component/ldap-config.glade
index 1641741075..1e1c4d5fea 100644
--- a/addressbook/gui/component/ldap-config.glade
+++ b/addressbook/gui/component/ldap-config.glade
@@ -1179,7 +1179,7 @@
<child>
<widget class="GtkTable" id="table34">
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@@ -1405,6 +1405,28 @@
<property name="y_options">shrink|fill</property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkCheckButton" id="canbrowsecheck">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes" comments="To translators: If enabled, addressbook will only fetch contacts from the server until either set time limit or amount of contacts limit reached">B_rowse this book until limit reached</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
@@ -2707,7 +2729,7 @@
<widget class="GtkTable" id="table11">
<property name="border_width">12</property>
<property name="visible">True</property>
- <property name="n_rows">2</property>
+ <property name="n_rows">3</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
@@ -2930,6 +2952,28 @@
<property name="y_options"></property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkCheckButton" id="canbrowsecheck">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes" comments="To translators: If enabled, addressbook will only fetch contacts from the server until either set time limit or amount of contacts limit reached">B_rowse this book until limit reached</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
</widget>
</child>
diff --git a/addressbook/gui/contact-list-editor/contact-list-editor.glade b/addressbook/gui/contact-list-editor/contact-list-editor.glade
index 3402e27542..497be08c85 100644
--- a/addressbook/gui/contact-list-editor/contact-list-editor.glade
+++ b/addressbook/gui/contact-list-editor/contact-list-editor.glade
@@ -28,7 +28,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="icon_size">6</property>
- <property name="icon_name">stock_addressbook</property>
+ <property name="icon_name">x-office-address-book</property>
</widget>
<packing>
<property name="left_attach">1</property>
diff --git a/addressbook/gui/contact-list-editor/e-contact-list-editor.c b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
index d3121185a6..7039bb5086 100644
--- a/addressbook/gui/contact-list-editor/e-contact-list-editor.c
+++ b/addressbook/gui/contact-list-editor/e-contact-list-editor.c
@@ -1334,6 +1334,7 @@ e_contact_list_editor_get_contact (EContactListEditor *editor)
GtkTreeIter iter;
gboolean iter_valid;
const gchar *text;
+ GSList *attrs = NULL, *a;
g_return_val_if_fail (E_IS_CONTACT_LIST_EDITOR (editor), NULL);
@@ -1367,13 +1368,20 @@ e_contact_list_editor_get_contact (EContactListEditor *editor)
gtk_tree_model_get (model, &iter, 0, &dest, -1);
attr = e_vcard_attribute_new (NULL, EVC_EMAIL);
- e_vcard_add_attribute (E_VCARD (contact), attr);
+ attrs = g_slist_prepend (attrs, attr);
e_destination_export_to_vcard_attribute (dest, attr);
g_object_unref (dest);
iter_valid = gtk_tree_model_iter_next (model, &iter);
}
+ /* Put it in reverse order because e_vcard_add_attribute also uses prepend,
+ but we want to keep order of mails there. Hopefully noone will change
+ the behaviour of the e_vcard_add_attribute. */
+ for (a = attrs; a; a = a->next) {
+ e_vcard_add_attribute (E_VCARD (contact), a->data);
+ }
+
return contact;
}
diff --git a/addressbook/gui/merging/eab-contact-duplicate-detected.glade b/addressbook/gui/merging/eab-contact-duplicate-detected.glade
index 1a85fac29e..70efc737ca 100644
--- a/addressbook/gui/merging/eab-contact-duplicate-detected.glade
+++ b/addressbook/gui/merging/eab-contact-duplicate-detected.glade
@@ -61,7 +61,7 @@
<property name="visible">True</property>
<property name="can_default">True</property>
<property name="can_focus">True</property>
- <property name="label">_Merge</property>
+ <property name="label" translatable="yes">_Merge</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index daa41b1e2f..30a384091d 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -155,28 +155,34 @@ static void
set_empty_message (EMinicardView *view)
{
char *empty_message;
- gboolean editable = FALSE, perform_initial_query = FALSE;
+ gboolean editable = FALSE, perform_initial_query = FALSE, searching = FALSE;
EBook *book;
if (view->adapter) {
+ EABModel *model = NULL;
+
g_object_get (view->adapter,
"editable", &editable,
+ "model", &model,
NULL);
g_object_get (view->adapter, "book", &book, NULL);
if (!e_book_check_static_capability (book, "do-initial-query"))
perform_initial_query = TRUE;
+
+ searching = model && eab_model_can_stop (model);
}
- if (editable) {
+ if (searching) {
+ empty_message = _("\n\nSearching for the Contacts...");
+ } else if (editable) {
if (perform_initial_query)
empty_message = _("\n\nSearch for the Contact\n\n"
"or double-click here to create a new Contact.");
else
empty_message = _("\n\nThere are no items to show in this view.\n\n"
"Double-click here to create a new Contact.");
- }
- else {
+ } else {
if (perform_initial_query)
empty_message = _("\n\nSearch for the Contact.");
else
@@ -195,6 +201,12 @@ writable_status_change (EABModel *model, gboolean writable, EMinicardView *view)
}
static void
+stop_state_changed (EABModel *model, EMinicardView *view)
+{
+ set_empty_message (view);
+}
+
+static void
adapter_changed (EMinicardView *view)
{
set_empty_message (view);
@@ -216,19 +228,23 @@ e_minicard_view_set_property (GObject *object,
switch (prop_id){
case PROP_ADAPTER:
if (view->adapter) {
- if (view->writable_status_id) {
+ if (view->writable_status_id || view->stop_state_id) {
EABModel *model;
g_object_get (view->adapter,
"model", &model,
NULL);
if (model) {
- g_signal_handler_disconnect (model, view->writable_status_id);
+ if (view->writable_status_id)
+ g_signal_handler_disconnect (model, view->writable_status_id);
+ if (view->stop_state_id)
+ g_signal_handler_disconnect (model, view->stop_state_id);
}
}
g_object_unref (view->adapter);
}
view->writable_status_id = 0;
+ view->stop_state_id = 0;
view->adapter = g_value_get_object (value);
g_object_ref (view->adapter);
adapter_changed (view);
@@ -244,6 +260,9 @@ e_minicard_view_set_property (GObject *object,
view->writable_status_id =
g_signal_connect (model, "writable_status",
G_CALLBACK (writable_status_change), view);
+ view->stop_state_id =
+ g_signal_connect (model, "stop_state_changed",
+ G_CALLBACK (stop_state_changed), view);
}
}
@@ -317,19 +336,23 @@ e_minicard_view_dispose (GObject *object)
}
if (view->adapter) {
- if (view->writable_status_id) {
+ if (view->writable_status_id || view->stop_state_id) {
EABModel *model;
g_object_get (view->adapter,
"model", &model,
NULL);
if (model) {
- g_signal_handler_disconnect (model, view->writable_status_id);
+ if (view->writable_status_id)
+ g_signal_handler_disconnect (model, view->writable_status_id);
+ if (view->stop_state_id)
+ g_signal_handler_disconnect (model, view->stop_state_id);
}
}
g_object_unref (view->adapter);
}
view->writable_status_id = 0;
+ view->stop_state_id = 0;
view->adapter = NULL;
if (G_OBJECT_CLASS(parent_class)->dispose)
@@ -548,6 +571,7 @@ e_minicard_view_init (EMinicardView *view)
view->adapter = NULL;
view->canvas_drag_data_get_id = 0;
view->writable_status_id = 0;
+ view->stop_state_id = 0;
set_empty_message (view);
}
diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h
index 1d8eef963c..eb6d07f034 100644
--- a/addressbook/gui/widgets/e-minicard-view.h
+++ b/addressbook/gui/widgets/e-minicard-view.h
@@ -70,6 +70,7 @@ struct _EMinicardView
guint canvas_drag_data_get_id;
guint writable_status_id;
+ guint stop_state_id;
};
struct _EMinicardViewClass
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index b617292a0f..a4bda1ac4a 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -780,21 +780,21 @@ add_field (EMinicard *e_minicard, EContactField field, gdouble left_width)
new_item = e_minicard_label_new(group);
if (e_minicard->contact && e_contact_get (e_minicard->contact, E_CONTACT_IS_LIST))
- gnome_canvas_item_set( new_item,
- "width", e_minicard->width - 4.0,
- "fieldname", is_rtl ? "" : string,
- "field", is_rtl ? string : "",
- "max_field_name_length", left_width,
- "editable", FALSE /* e_minicard->editable */,
- NULL );
+ gnome_canvas_item_set (new_item,
+ "fieldname", is_rtl ? "" : string,
+ "field", is_rtl ? string : "",
+ "max_field_name_length", left_width,
+ "editable", FALSE /* e_minicard->editable */,
+ "width", e_minicard->width - 4.0,
+ NULL );
else
- gnome_canvas_item_set( new_item,
- "width", e_minicard->width - 4.0,
- "fieldname", is_rtl ? string : name,
- "field", is_rtl ? name : string,
- "max_field_name_length", left_width,
- "editable", FALSE /* e_minicard->editable */,
- NULL );
+ gnome_canvas_item_set (new_item,
+ "fieldname", is_rtl ? string : name,
+ "field", is_rtl ? name : string,
+ "max_field_name_length", left_width,
+ "editable", FALSE /* e_minicard->editable */,
+ "width", e_minicard->width - 4.0,
+ NULL );
#ifdef notyet
@@ -831,7 +831,7 @@ get_email_location (EVCardAttribute *attr)
}
static void
-add_email_field (EMinicard *e_minicard, GList *email_list, gdouble left_width, int limit)
+add_email_field (EMinicard *e_minicard, GList *email_list, gdouble left_width, int limit, gboolean is_list)
{
GnomeCanvasItem *new_item;
GnomeCanvasGroup *group;
@@ -850,8 +850,13 @@ add_email_field (EMinicard *e_minicard, GList *email_list, gdouble left_width, i
char *parsed_name = NULL;
gboolean parser_check;
- tmp = get_email_location ((EVCardAttribute *) l->data);
- name = g_strdup_printf ("%s:", tmp);
+ /* do not use name for fields in the contact list */
+ if (is_list) {
+ name = (char *)"";
+ } else {
+ tmp = get_email_location ((EVCardAttribute *) l->data);
+ name = g_strdup_printf ("%s:", tmp);
+ }
parser_check = eab_parse_qp_email ((const gchar *) le->data, &parsed_name, &email);
if (parser_check) {
@@ -864,12 +869,12 @@ add_email_field (EMinicard *e_minicard, GList *email_list, gdouble left_width, i
new_item = e_minicard_label_new(group);
- gnome_canvas_item_set( new_item,
- "width", e_minicard->width - 4.0,
+ gnome_canvas_item_set (new_item,
"fieldname", is_rtl ? string : name,
"field", is_rtl ? name : string,
"max_field_name_length", left_width,
"editable", FALSE /* e_minicard->editable */,
+ "width", e_minicard->width - 4.0,
NULL );
#ifdef notyet
@@ -888,7 +893,8 @@ add_email_field (EMinicard *e_minicard, GList *email_list, gdouble left_width, i
e_minicard->fields = g_list_append( e_minicard->fields, minicard_field);
e_canvas_item_move_absolute(new_item, 2, e_minicard->height);
count++;
- g_free (name);
+ if (!is_list)
+ g_free (name);
g_free (string);
g_free (parsed_name);
g_free (email);
@@ -1005,7 +1011,7 @@ remodel( EMinicard *e_minicard )
limit = 5 - count;
email = e_contact_get_attributes (e_minicard->contact, E_CONTACT_EMAIL);
- add_email_field (e_minicard, email, left_width, limit);
+ add_email_field (e_minicard, email, left_width, limit, is_list);
if (count+limit >5)
count = 5;
else
diff --git a/addressbook/printing/e-contact-print.c b/addressbook/printing/e-contact-print.c
index a707235944..f82335335a 100644
--- a/addressbook/printing/e-contact-print.c
+++ b/addressbook/printing/e-contact-print.c
@@ -57,6 +57,8 @@ struct _EContactPrintContext
EContactPrintStyle *style;
gboolean first_section;
+ gint page_nr, pages;
+
PangoFontDescription *letter_heading_font;
gchar *section;
gboolean first_contact;
@@ -178,8 +180,15 @@ e_contact_print_letter_heading (EContactPrintContext *ctxt, gchar *letter)
pango_layout_set_width (layout, width);
pango_layout_get_size (layout, NULL, &height);
- /* Draw white text centered in a black rectangle. */
+ if (ctxt->page_nr == -1 || ctxt->pages != ctxt->page_nr) {
+ /* only calculating number of pages
+ or on page we do not want to print */
+ ctxt->y += pango_units_to_double (height);
+
+ return;
+ }
+ /* Draw white text centered in a black rectangle. */
cr = gtk_print_context_get_cairo_context (ctxt->context);
cairo_save (cr);
@@ -207,10 +216,11 @@ e_contact_start_new_page (EContactPrintContext *ctxt)
cr = gtk_print_context_get_cairo_context (ctxt->context);
- cairo_show_page (cr);
+ /*cairo_show_page (cr);*/
ctxt->x = ctxt->y = .0;
ctxt->column = 0;
+ ctxt->pages++;
}
static void
@@ -226,7 +236,7 @@ e_contact_print_contact (EContact *contact, EContactPrintContext *ctxt)
file_as = e_contact_get (contact, E_CONTACT_FILE_AS);
- if (ctxt->style->print_using_grey) {
+ if (ctxt->style->print_using_grey && ctxt->pages == ctxt->page_nr) {
cairo_save (cr);
cairo_set_source_rgb (cr, .85, .85, .85);
cairo_rectangle (cr, ctxt->x, ctxt->y, ctxt->column_width,
@@ -236,9 +246,10 @@ e_contact_print_contact (EContact *contact, EContactPrintContext *ctxt)
cairo_restore (cr);
}
- e_contact_output (
- ctxt->context, ctxt->style->headings_font,
- ctxt->x, ctxt->y, ctxt->column_width + 4, file_as);
+ if (ctxt->pages == ctxt->page_nr)
+ e_contact_output (
+ ctxt->context, ctxt->style->headings_font,
+ ctxt->x, ctxt->y, ctxt->column_width + 4, file_as);
ctxt->y += e_contact_text_height (
ctxt->context, ctxt->style->headings_font, file_as);
@@ -258,9 +269,10 @@ e_contact_print_contact (EContact *contact, EContactPrintContext *ctxt)
text = g_strdup_printf ("%s: %s",
e_contact_pretty_name (field), value);
- e_contact_output (
- ctxt->context, ctxt->style->body_font,
- ctxt->x, ctxt->y, -1, text);
+ if (ctxt->pages == ctxt->page_nr)
+ e_contact_output (
+ ctxt->context, ctxt->style->body_font,
+ ctxt->x, ctxt->y, -1, text);
ctxt->y += e_contact_text_height (
ctxt->context, ctxt->style->body_font, text);
@@ -540,51 +552,6 @@ load_contacts (EContactPrintContext *ctxt)
}
static void
-free_contacts (EContactPrintContext *ctxt)
-{
- g_list_foreach (ctxt->contact_list, (GFunc) g_object_unref, NULL);
- g_list_free (ctxt->contact_list);
-}
-
-static void
-contact_begin_print (GtkPrintOperation *operation,
- GtkPrintContext *context,
- EContactPrintContext *ctxt)
-{
- GtkPageSetup *setup;
- gdouble page_width;
-
- e_contact_build_style (ctxt->style);
-
- setup = gtk_print_context_get_page_setup (context);
- page_width = gtk_page_setup_get_page_width (setup, GTK_UNIT_POINTS);
-
- ctxt->context = context;
- ctxt->x = ctxt->y = .0;
- ctxt->column = 0;
- ctxt->first_contact = TRUE;
- ctxt->first_section = TRUE;
- ctxt->section = NULL;
-
- ctxt->column_spacing = gtk_print_context_get_dpi_x (context) / 4;
- ctxt->column_width = (page_width + ctxt->column_spacing) /
- ctxt->style->num_columns - ctxt->column_spacing;
-
- ctxt->letter_heading_font = pango_font_description_new ();
- pango_font_description_set_family (
- ctxt->letter_heading_font,
- pango_font_description_get_family (
- ctxt->style->headings_font));
- pango_font_description_set_size (
- ctxt->letter_heading_font,
- pango_font_description_get_size (
- ctxt->style->headings_font) * 1.5);
-
- if (ctxt->book != NULL)
- load_contacts (ctxt);
-}
-
-static void
contact_draw (EContact *contact, EContactPrintContext *ctxt)
{
GtkPageSetup *setup;
@@ -638,11 +605,71 @@ contact_draw (EContact *contact, EContactPrintContext *ctxt)
}
static void
+free_contacts (EContactPrintContext *ctxt)
+{
+ g_list_foreach (ctxt->contact_list, (GFunc) g_object_unref, NULL);
+ g_list_free (ctxt->contact_list);
+}
+
+static void
+contact_begin_print (GtkPrintOperation *operation,
+ GtkPrintContext *context,
+ EContactPrintContext *ctxt)
+{
+ GtkPageSetup *setup;
+ gdouble page_width;
+
+ e_contact_build_style (ctxt->style);
+
+ setup = gtk_print_context_get_page_setup (context);
+ page_width = gtk_page_setup_get_page_width (setup, GTK_UNIT_POINTS);
+
+ ctxt->context = context;
+ ctxt->x = ctxt->y = .0;
+ ctxt->column = 0;
+ ctxt->first_contact = TRUE;
+ ctxt->first_section = TRUE;
+ ctxt->section = NULL;
+
+ ctxt->column_spacing = gtk_print_context_get_dpi_x (context) / 4;
+ ctxt->column_width = (page_width + ctxt->column_spacing) /
+ ctxt->style->num_columns - ctxt->column_spacing;
+
+ ctxt->letter_heading_font = pango_font_description_new ();
+ pango_font_description_set_family (
+ ctxt->letter_heading_font,
+ pango_font_description_get_family (
+ ctxt->style->headings_font));
+ pango_font_description_set_size (
+ ctxt->letter_heading_font,
+ pango_font_description_get_size (
+ ctxt->style->headings_font) * 1.5);
+
+ if (ctxt->book != NULL) {
+ load_contacts (ctxt);
+ ctxt->page_nr = -1;
+ ctxt->pages = 1;
+ g_list_foreach (ctxt->contact_list, (GFunc) contact_draw, ctxt);
+ gtk_print_operation_set_n_pages (operation, ctxt->pages);
+ }
+}
+
+static void
contact_draw_page (GtkPrintOperation *operation,
GtkPrintContext *context,
gint page_nr,
EContactPrintContext *ctxt)
{
+ /* only text on page_nr == pages will be drawn, the pages is recalculated */
+ ctxt->page_nr = page_nr;
+ ctxt->pages = 0;
+
+ ctxt->x = ctxt->y = .0;
+ ctxt->column = 0;
+ ctxt->first_contact = TRUE;
+ ctxt->first_section = TRUE;
+ ctxt->section = NULL;
+
g_list_foreach (ctxt->contact_list, (GFunc) contact_draw, ctxt);
}
@@ -681,6 +708,8 @@ e_contact_print (EBook *book, EBookQuery *query,
ctxt.contact_list = contact_list;
}
ctxt.style = &style;
+ ctxt.page_nr = 0;
+ ctxt.pages = 0;
operation = e_print_operation_new ();
gtk_print_operation_set_n_pages (operation, 1);