From b3a61aaf1f5b61add460daef51b806957568a9bd Mon Sep 17 00:00:00 2001 From: Larry Ewing Date: Wed, 2 Jun 2004 03:53:44 +0000 Subject: rename can_add to is_mutable, add sensitivity logic for both readonly and 2004-06-01 Larry Ewing * gui/dialogs/calendar-setup.c: rename can_add to is_mutable, add sensitivity logic for both readonly and mutable cases. The esource attributes are a complete mess and need discussion. * gui/dialogs/calendar-setup.glade: remove edit dialogs and name the tables. svn path=/trunk/; revision=26149 --- calendar/gui/dialogs/calendar-setup.c | 67 +-- calendar/gui/dialogs/calendar-setup.glade | 722 +----------------------------- 2 files changed, 43 insertions(+), 746 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index 15599aab09..15a150b7de 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -202,31 +202,33 @@ validate_remote_uri (const gchar *source_location, gboolean interactive, GtkWidg } static gboolean -source_group_can_add (ESourceGroup *source_group) +source_group_is_mutable (ESourceGroup *source_group) { - gboolean can_add; + gboolean mutable; if (!source_group) return FALSE; - can_add = !e_source_group_get_readonly (source_group); + mutable = !e_source_group_get_readonly (source_group); - if (can_add) { - char *uri = e_source_group_peek_base_uri (source_group); + if (mutable) { + const char *uri = e_source_group_peek_base_uri (source_group); if (g_str_has_prefix (uri, "groupwise://") || g_str_has_prefix (uri, "exchange://")) - can_add = FALSE; + mutable = FALSE; } - return can_add; + return mutable; } static int -source_group_menu_add_groups (GtkMenuShell *menu_shell, ESourceList *source_list) +source_group_menu_add_groups (GtkMenuShell *menu_shell, SourceDialog *source_dialog) { + ESourceList *source_list = source_dialog->source_list; GSList *groups, *sl; int index=-1, i=0; + if (source_list == NULL) return index; @@ -238,12 +240,21 @@ source_group_menu_add_groups (GtkMenuShell *menu_shell, ESourceList *source_list menu_item = gtk_menu_item_new_with_label (e_source_group_peek_name (group)); gtk_widget_show (menu_item); - if (!source_group_can_add (group)) + + if (!source_group_is_mutable (group)) gtk_widget_set_sensitive(menu_item, FALSE); - else if (i == -1) + + if (source_dialog->source_group + && !strcmp (e_source_group_peek_uid (source_dialog->source_group), e_source_group_peek_uid (group))) index = i; gtk_menu_shell_append (menu_shell, menu_item); + i++; + } + + if (!source_dialog->source_group && groups) { + source_dialog->source_group = groups->data; + return -1; } return index; @@ -345,10 +356,10 @@ general_entry_modified (SourceDialog *source_dialog) const char *text = gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry)); gboolean sensitive = text && *text != '\0'; - sensitive &= (source_dialog->source_group != NULL); - - if (source_group_is_remote (source_dialog->source_group)) { - sensitive &= remote_page_verify (source_dialog); + sensitive = sensitive && (source_dialog->source_group != NULL); + + if (source_group_is_remote (source_dialog->source_group) && source_group_is_mutable (source_dialog->source_group)) { + sensitive = sensitive && remote_page_verify (source_dialog); } gtk_widget_set_sensitive (source_dialog->add_button, sensitive); @@ -358,6 +369,10 @@ static void general_update_dialog (SourceDialog *source_dialog) { gboolean remote = FALSE; + gboolean mutable = source_group_is_mutable (source_dialog->source_group); + + if (e_source_get_readonly (source_dialog->source)) + gtk_widget_set_sensitive (glade_xml_get_widget (source_dialog->gui_xml, "settings-table"), FALSE); /* These are calendar specific so make sure we have them */ if (source_dialog->uri_entry) @@ -365,7 +380,8 @@ general_update_dialog (SourceDialog *source_dialog) 0, 0, NULL, NULL, source_dialog); remote = (source_dialog->source && source_is_remote (source_dialog->source)) - || source_group_is_remote (source_dialog->source_group); + || source_group_is_remote (source_dialog->source_group); + if (!remote) { if (source_dialog->uri_entry) @@ -377,13 +393,13 @@ general_update_dialog (SourceDialog *source_dialog) general_entry_modified (source_dialog); if (source_dialog->uri_hbox) - gtk_widget_set_sensitive (source_dialog->uri_hbox, remote); + gtk_widget_set_sensitive (source_dialog->uri_hbox, remote && mutable); if (source_dialog->uri_label) - gtk_widget_set_sensitive (source_dialog->uri_label, remote); + gtk_widget_set_sensitive (source_dialog->uri_label, remote && mutable); if (source_dialog->refresh_label) - gtk_widget_set_sensitive (source_dialog->refresh_label, remote); + gtk_widget_set_sensitive (source_dialog->refresh_label, remote && mutable); if (source_dialog->refresh_hbox) - gtk_widget_set_sensitive (source_dialog->refresh_hbox, remote); + gtk_widget_set_sensitive (source_dialog->refresh_hbox, remote && mutable); if (source_dialog->uri_entry) g_signal_handlers_unblock_matched (source_dialog->uri_entry, G_SIGNAL_MATCH_DATA, @@ -642,6 +658,7 @@ calendar_setup_edit_calendar (GtkWindow *parent, ESource *source) source_dialog->window = glade_xml_get_widget (source_dialog->gui_xml, "add-calendar-window"); if (source) { source_dialog->source = source; + source_dialog->source_group = e_source_peek_group (source); g_object_ref (source); } @@ -659,15 +676,13 @@ calendar_setup_edit_calendar (GtkWindow *parent, ESource *source) gtk_option_menu_set_menu (GTK_OPTION_MENU (source_dialog->group_optionmenu), menu); gtk_widget_show (menu); } - gtk_widget_set_sensitive (source_dialog->group_optionmenu, source == NULL); /* NOTE: This assumes that we have sources. If they don't exist, they're set up * on startup of the calendar component. */ index = source_group_menu_add_groups (GTK_MENU_SHELL (gtk_option_menu_get_menu ( - GTK_OPTION_MENU (source_dialog->group_optionmenu))), source_dialog->source_list); + GTK_OPTION_MENU (source_dialog->group_optionmenu))), source_dialog); gtk_option_menu_set_history (GTK_OPTION_MENU (source_dialog->group_optionmenu), index); - if (e_source_list_peek_groups (source_dialog->source_list)) - source_dialog->source_group = e_source_list_peek_groups (source_dialog->source_list)->data; + g_signal_connect_swapped (source_dialog->group_optionmenu, "changed", G_CALLBACK (source_group_changed_sensitive), source_dialog); source_dialog->uri_entry = glade_xml_get_widget (source_dialog->gui_xml, "uri-entry"); @@ -769,6 +784,7 @@ calendar_setup_edit_task_list (GtkWindow *parent, ESource *source) source_dialog->window = glade_xml_get_widget (source_dialog->gui_xml, "add-task-list-window"); if (source) { source_dialog->source = source; + source_dialog->source_group = e_source_peek_group (source); g_object_ref (source); } @@ -791,10 +807,9 @@ calendar_setup_edit_task_list (GtkWindow *parent, ESource *source) /* NOTE: This assumes that we have sources. If they don't exist, they're set up * on startup of the calendar component. */ index = source_group_menu_add_groups (GTK_MENU_SHELL (gtk_option_menu_get_menu ( - GTK_OPTION_MENU (source_dialog->group_optionmenu))), source_dialog->source_list); + GTK_OPTION_MENU (source_dialog->group_optionmenu))), source_dialog); gtk_option_menu_set_history (GTK_OPTION_MENU (source_dialog->group_optionmenu), index); - if (e_source_list_peek_groups (source_dialog->source_list)) - source_dialog->source_group = e_source_list_peek_groups (source_dialog->source_list)->data; + g_signal_connect_swapped (source_dialog->group_optionmenu, "changed", G_CALLBACK (source_group_changed_sensitive), source_dialog); diff --git a/calendar/gui/dialogs/calendar-setup.glade b/calendar/gui/dialogs/calendar-setup.glade index 34bda0cd0d..d001544ba7 100644 --- a/calendar/gui/dialogs/calendar-setup.glade +++ b/calendar/gui/dialogs/calendar-setup.glade @@ -22,7 +22,7 @@ 12 - + True 5 2 @@ -445,724 +445,6 @@ - - Calendar Properties - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - - - - 6 - True - False - 6 - - - - 6 - True - True - True - True - GTK_POS_TOP - False - False - - - - 6 - True - False - 6 - - - - 3 - True - False - 4 - - - - True - _Display name: - True - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - 1 - 0.5 - 0.9 - 1 - - - - True - True - True - True - 0 - - True - * - False - - - - - 0 - True - True - - - - - 0 - False - False - - - - - - True - False - 0 - - - - - - - 0 - True - True - - - - - False - True - - - - - - True - General - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - 6 - True - 2 - 2 - False - 4 - 4 - - - - True - _Source URL: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - uri-entry - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - - - - - - - True - _Refresh Interval: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - False - 4 - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 30 1 9999 1 10 10 - - - 0 - True - True - - - - - - True - minute(s) - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 1 - 2 - 1 - 2 - fill - fill - - - - - False - True - - - - - - True - Remote - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - 6 - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - - - - - - True - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - - - - - 0 - True - True - - - - - 0 - False - False - - - - - - - - Task List Properties - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - - - - 6 - True - False - 6 - - - - 6 - True - True - True - True - GTK_POS_TOP - False - False - - - - 6 - True - False - 6 - - - - 3 - True - False - 4 - - - - True - _Display name: - True - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - 1 - 0.5 - 0.9 - 1 - - - - True - True - True - True - 0 - - True - * - False - - - - - 0 - True - True - - - - - 0 - False - False - - - - - - True - False - 0 - - - - - - - 0 - True - True - - - - - False - True - - - - - - True - General - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - - 6 - True - 2 - 2 - False - 4 - 4 - - - - True - _Source URL: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - uri-entry - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 0 - 1 - - - - - - - True - _Refresh Interval: - True - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - - - 0 - 1 - 1 - 2 - fill - - - - - - - True - False - 4 - - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 30 1 9999 1 10 10 - - - 0 - True - True - - - - - - True - minute(s) - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 1 - 2 - 1 - 2 - fill - fill - - - - - False - True - - - - - - True - Remote - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - tab - - - - - 0 - True - True - - - - - - True - False - 0 - - - - True - GTK_BUTTONBOX_END - 6 - - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - - - - - - True - False - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - - - - - 0 - True - True - - - - - 0 - False - False - - - - - - 450 300 @@ -1181,7 +463,7 @@ 12 - + True 5 2 -- cgit v1.2.3