From 3e3ddfa5fc7e10ba2f8c011db9e0c0d974980c92 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 18 Mar 2004 19:18:00 +0000 Subject: create an ESourceSelector instead of a ESourceOptionMenu, to be consistent 2004-03-18 Rodrigo Moya * gui/dialogs/select-source-dialog.c (select_source_dialog): create an ESourceSelector instead of a ESourceOptionMenu, to be consistent with the other components, and create a scrolled window to hold the source selector. (primary_selection_changed_cb): callback for "primary_selection_changed" signal in the ESourceSelector. svn path=/trunk/; revision=25120 --- calendar/gui/dialogs/select-source-dialog.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c index 978b151d86..fb068b5232 100644 --- a/calendar/gui/dialogs/select-source-dialog.c +++ b/calendar/gui/dialogs/select-source-dialog.c @@ -22,18 +22,19 @@ #include #include #include +#include #include -#include "widgets/misc/e-source-option-menu.h" +#include "widgets/misc/e-source-selector.h" #include "select-source-dialog.h" static void -source_selected_cb (ESourceOptionMenu *menu, ESource *selected_source, gpointer user_data) +primary_selection_changed_cb (ESourceSelector *selector, gpointer user_data) { ESource **our_selection = user_data; if (*our_selection) g_object_unref (*our_selection); - *our_selection = g_object_ref (selected_source); + *our_selection = g_object_ref (e_source_selector_peek_primary_selection (selector)); } /** @@ -44,7 +45,7 @@ source_selected_cb (ESourceOptionMenu *menu, ESource *selected_source, gpointer ESource * select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) { - GtkWidget *dialog, *label, *source_selector; + GtkWidget *dialog, *label, *scroll, *source_selector; ESourceList *source_list; ESource *selected_source = NULL; const char *gconf_key; @@ -75,15 +76,24 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type) conf_client = gconf_client_get_default (); source_list = e_source_list_new_for_gconf (conf_client, gconf_key); - source_selector = e_source_option_menu_new (source_list); - g_signal_connect (G_OBJECT (source_selector), "source_selected", - G_CALLBACK (source_selected_cb), &selected_source); + + scroll = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + gtk_widget_show (scroll); + source_selector = e_source_selector_new (source_list); + e_source_selector_show_selection (E_SOURCE_SELECTOR (source_selector), FALSE); + g_signal_connect (G_OBJECT (source_selector), "primary_selection_changed", + G_CALLBACK (primary_selection_changed_cb), &selected_source); gtk_widget_show (source_selector); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), source_selector, FALSE, FALSE, 6); + gtk_container_add (GTK_CONTAINER (scroll), source_selector); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), scroll, TRUE, TRUE, 12); if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_OK) { if (selected_source) g_object_unref (selected_source); + selected_source = NULL; } g_object_unref (conf_client); -- cgit v1.2.3