diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2003-11-18 00:24:35 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2003-11-18 00:24:35 +0800 |
commit | 708935e0da1be156f123a066812629384bfa46dd (patch) | |
tree | 3aacefee8cdfba8e8abd97e3592f8b8eb9299ac2 | |
parent | d731705f509fb39e5d0d2e0fbfcaa3f6aed1e67b (diff) | |
download | gsoc2013-evolution-708935e0da1be156f123a066812629384bfa46dd.tar gsoc2013-evolution-708935e0da1be156f123a066812629384bfa46dd.tar.gz gsoc2013-evolution-708935e0da1be156f123a066812629384bfa46dd.tar.bz2 gsoc2013-evolution-708935e0da1be156f123a066812629384bfa46dd.tar.lz gsoc2013-evolution-708935e0da1be156f123a066812629384bfa46dd.tar.xz gsoc2013-evolution-708935e0da1be156f123a066812629384bfa46dd.tar.zst gsoc2013-evolution-708935e0da1be156f123a066812629384bfa46dd.zip |
peek the primary selection.
2003-11-17 Rodrigo Moya <rodrigo@ximian.com>
* gui/calendar-component.c (delete_calendar_cb, rename_calendar_cb):
* gui/tasks-component.c (delete_task_list_cb, rename_task_list_cb):
peek the primary selection.
svn path=/trunk/; revision=23392
-rw-r--r-- | calendar/ChangeLog | 6 | ||||
-rw-r--r-- | calendar/gui/calendar-component.c | 57 | ||||
-rw-r--r-- | calendar/gui/tasks-component.c | 59 |
3 files changed, 53 insertions, 69 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index efc0e3b1af..7a8b94098a 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,11 @@ 2003-11-17 Rodrigo Moya <rodrigo@ximian.com> + * gui/calendar-component.c (delete_calendar_cb, rename_calendar_cb): + * gui/tasks-component.c (delete_task_list_cb, rename_task_list_cb): + peek the primary selection. + +2003-11-17 Rodrigo Moya <rodrigo@ximian.com> + * gui/tasks-component.c (fill_popup_menu_cb): added 'Delete' and 'Rename' menu items. (delete_task_list_cb, rename_task_list_cb): callbacks for new diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 428d211d07..1b0f3b479e 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -257,42 +257,36 @@ add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap, static void delete_calendar_cb (GtkWidget *widget, CalendarComponent *comp) { - GSList *selection, *l; + ESource *selected_source; CalendarComponentPrivate *priv; + GtkWidget *dialog; priv = comp->priv; - selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (priv->source_selector)); - if (!selection) + selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->source_selector)); + if (!selected_source) return; - for (l = selection; l; l = l->next) { - GtkWidget *dialog; - ESource *selected_source = l->data; - - /* create the confirmation dialog */ - dialog = gtk_message_dialog_new ( - GTK_WINDOW (gtk_widget_get_toplevel (widget)), - GTK_DIALOG_MODAL, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - _("Calendar '%s' will be removed. Are you sure you want to continue?"), - e_source_peek_name (selected_source)); - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) { - if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->source_selector), - selected_source)) - e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->source_selector), - selected_source); - - e_source_group_remove_source (e_source_peek_group (selected_source), selected_source); - - /* FIXME: remove the calendar.ics file and the directory */ - } + /* create the confirmation dialog */ + dialog = gtk_message_dialog_new ( + GTK_WINDOW (gtk_widget_get_toplevel (widget)), + GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + _("Calendar '%s' will be removed. Are you sure you want to continue?"), + e_source_peek_name (selected_source)); + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) { + if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->source_selector), + selected_source)) + e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->source_selector), + selected_source); + + e_source_group_remove_source (e_source_peek_group (selected_source), selected_source); - gtk_widget_destroy (dialog); + /* FIXME: remove the calendar.ics file and the directory */ } - e_source_selector_free_selection (selection); + gtk_widget_destroy (dialog); } static void @@ -304,19 +298,16 @@ new_calendar_cb (GtkWidget *widget, CalendarComponent *comp) static void rename_calendar_cb (GtkWidget *widget, CalendarComponent *comp) { - GSList *selection; CalendarComponentPrivate *priv; ESource *selected_source; GtkWidget *dialog, *entry; priv = comp->priv; - selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (priv->source_selector)); - if (!selection) + selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->source_selector)); + if (!selected_source) return; - selected_source = selection->data; - /* create the dialog to prompt the user for the new name */ dialog = gtk_message_dialog_new (gtk_widget_get_toplevel (widget), GTK_DIALOG_MODAL, @@ -332,8 +323,6 @@ rename_calendar_cb (GtkWidget *widget, CalendarComponent *comp) e_source_set_name (selected_source, gtk_entry_get_text (GTK_ENTRY (entry))); gtk_widget_destroy (dialog); - - e_source_selector_free_selection (selection); } static void diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 46e67cc536..e1603893e2 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -228,42 +228,36 @@ add_popup_menu_item (GtkMenu *menu, const char *label, const char *pixmap, static void delete_task_list_cb (GtkWidget *widget, TasksComponent *comp) { - GSList *selection, *l; + ESource *selected_source; TasksComponentPrivate *priv; + GtkWidget *dialog; priv = comp->priv; - selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (priv->source_selector)); - if (!selection) + selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->source_selector)); + if (!selected_source) return; - for (l = selection; l; l = l->next) { - GtkWidget *dialog; - ESource *selected_source = l->data; - - /* create the confirmation dialog */ - dialog = gtk_message_dialog_new ( - GTK_WINDOW (gtk_widget_get_toplevel (widget)), - GTK_DIALOG_MODAL, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - _("Task List '%s' will be removed. Are you sure you want to continue?"), - e_source_peek_name (selected_source)); - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) { - if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->source_selector), - selected_source)) - e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->source_selector), - selected_source); - - e_source_group_remove_source (e_source_peek_group (selected_source), selected_source); - - /* FIXME: remove the tasks.ics file and the directory */ - } - - gtk_widget_destroy (dialog); + /* create the confirmation dialog */ + dialog = gtk_message_dialog_new ( + GTK_WINDOW (gtk_widget_get_toplevel (widget)), + GTK_DIALOG_MODAL, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + _("Task List '%s' will be removed. Are you sure you want to continue?"), + e_source_peek_name (selected_source)); + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_YES) { + if (e_source_selector_source_is_selected (E_SOURCE_SELECTOR (priv->source_selector), + selected_source)) + e_source_selector_unselect_source (E_SOURCE_SELECTOR (priv->source_selector), + selected_source); + + e_source_group_remove_source (e_source_peek_group (selected_source), selected_source); + + /* FIXME: remove the tasks.ics file and the directory */ } - e_source_selector_free_selection (selection); + gtk_widget_destroy (dialog); } static void @@ -274,19 +268,16 @@ new_task_list_cb (GtkWidget *widget, TasksComponent *component) static void rename_task_list_cb (GtkWidget *widget, TasksComponent *comp) { - GSList *selection; TasksComponentPrivate *priv; ESource *selected_source; GtkWidget *dialog, *entry; priv = comp->priv; - selection = e_source_selector_get_selection (E_SOURCE_SELECTOR (priv->source_selector)); - if (!selection) + selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (priv->source_selector)); + if (!selected_source) return; - selected_source = selection->data; - /* create the dialog to prompt the user for the new name */ dialog = gtk_message_dialog_new (gtk_widget_get_toplevel (widget), GTK_DIALOG_MODAL, @@ -302,8 +293,6 @@ rename_task_list_cb (GtkWidget *widget, TasksComponent *comp) e_source_set_name (selected_source, gtk_entry_get_text (GTK_ENTRY (entry))); gtk_widget_destroy (dialog); - - e_source_selector_free_selection (selection); } static void |