From cea054cd54d84479352a43bbabc19c9ce9af5efb Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Fri, 8 Aug 2008 04:26:12 +0000 Subject: Merge revisions 35747:35930 from trunk. svn path=/branches/kill-bonobo/; revision=35931 --- addressbook/gui/widgets/e-minicard-view.c | 40 ++++++++++++++++++++------ addressbook/gui/widgets/e-minicard-view.h | 1 + addressbook/gui/widgets/e-minicard.c | 48 +++++++++++++++++-------------- 3 files changed, 60 insertions(+), 29 deletions(-) (limited to 'addressbook/gui/widgets') 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 @@ -194,6 +200,12 @@ writable_status_change (EABModel *model, gboolean writable, EMinicardView *view) set_empty_message (view); } +static void +stop_state_changed (EABModel *model, EMinicardView *view) +{ + set_empty_message (view); +} + static void adapter_changed (EMinicardView *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 -- cgit v1.2.3