aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorSivaiah Nallagatla <snallagatla@novell.com>2005-01-29 02:40:16 +0800
committerSivaiah Nallagatla <siva@src.gnome.org>2005-01-29 02:40:16 +0800
commitdb9ecaacf2dbf3699c41fa0cbfcdc04439dd8f40 (patch)
treef32649733e7af06143483de27fe52c12b1f9e056 /addressbook/gui
parent98191f8ddc365d12b956f67f2590bda4029498f1 (diff)
downloadgsoc2013-evolution-db9ecaacf2dbf3699c41fa0cbfcdc04439dd8f40.tar
gsoc2013-evolution-db9ecaacf2dbf3699c41fa0cbfcdc04439dd8f40.tar.gz
gsoc2013-evolution-db9ecaacf2dbf3699c41fa0cbfcdc04439dd8f40.tar.bz2
gsoc2013-evolution-db9ecaacf2dbf3699c41fa0cbfcdc04439dd8f40.tar.lz
gsoc2013-evolution-db9ecaacf2dbf3699c41fa0cbfcdc04439dd8f40.tar.xz
gsoc2013-evolution-db9ecaacf2dbf3699c41fa0cbfcdc04439dd8f40.tar.zst
gsoc2013-evolution-db9ecaacf2dbf3699c41fa0cbfcdc04439dd8f40.zip
new function to sensitize im types based on supported fields
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 svn path=/trunk/; revision=28603
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c44
1 files changed, 39 insertions, 5 deletions
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);
}
}