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
This commit is contained in:
Sivaiah Nallagatla
2005-01-28 18:40:16 +00:00
committed by Sivaiah Nallagatla
parent 98191f8ddc
commit db9ecaacf2
2 changed files with 51 additions and 5 deletions

View File

@ -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) :

View File

@ -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 = 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++) {
gboolean enabled = TRUE;
if (!editor->target_editable)
enabled = FALSE;
sensitize_im_record (editor, i, enabled);
}
}