aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addressbook/ChangeLog12
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c44
2 files changed, 51 insertions, 5 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 3a923dc7b1..b42c65733e 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,15 @@
+2005-01-29 Sivaiah Nallagatla <snallagatla@novell.com>
+
+ * gui/contact-editor/e-contact-editor.c
+ (sensitize_im_types) : new function to sensitize
+ im types based on supported fields
+
+ (sensitize_im_record) : call sensitize_im_types
+ for each record
+ (sensitize_im) : if none of the im types
+ are supported disable the im entries
+ Fixes #68799
+
2005-01-28 Sivaiah Nallagatla <snallagatla@novell.com>
* gui/widgets/eab-vcard-control.c (pstream_load) :
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 363e05dcc9..2cd7984337 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -1538,6 +1538,30 @@ extract_im (EContactEditor *editor)
g_free (service_attr_list);
}
+static void
+sensitize_im_types (EContactEditor *editor, GtkWidget *option_menu)
+{
+ GtkWidget *menu;
+ GList *item_list, *l;
+ gint i;
+
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (option_menu));
+ l = item_list = gtk_container_get_children (GTK_CONTAINER (menu));
+
+ for (i = 0; i < G_N_ELEMENTS (im_service); i++) {
+ GtkWidget *widget;
+
+ if (!l) {
+ g_warning (G_STRLOC ": Unexpected end of im items in option menu");
+ return;
+ }
+
+ widget = l->data;
+ gtk_widget_set_sensitive (widget, is_field_supported (editor, im_service [i].field));
+
+ l = g_list_next (l);
+ }
+}
static void
sensitize_im_record (EContactEditor *editor, gint record, gboolean enabled)
@@ -1568,19 +1592,29 @@ sensitize_im_record (EContactEditor *editor, gint record, gboolean enabled)
gtk_widget_set_sensitive (location_option_menu, enabled);
#endif
gtk_editable_set_editable (GTK_EDITABLE (name_entry), enabled);
+ sensitize_im_types (editor, service_option_menu);
}
static void
sensitize_im (EContactEditor *editor)
{
gint i;
+ gboolean enabled;
+ gboolean no_ims_supported;
+
+ enabled = editor->target_editable;
+ no_ims_supported = TRUE;
- for (i = 1; i <= IM_SLOTS; i++) {
- gboolean enabled = TRUE;
-
- if (!editor->target_editable)
- enabled = FALSE;
+ for (i = 0; i < G_N_ELEMENTS (im_service); i++)
+ if (is_field_supported (editor, im_service[i].field)) {
+ no_ims_supported = FALSE;
+ break;
+ }
+ if (no_ims_supported)
+ enabled = FALSE;
+
+ for (i = 1; i <= IM_SLOTS; i++) {
sensitize_im_record (editor, i, enabled);
}
}