aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo@novell.com>2004-10-22 00:08:38 +0800
committerRodrigo Moya <rodrigo@src.gnome.org>2004-10-22 00:08:38 +0800
commit5ad033037b080d22d66d8f8ca6e00da1ecf8f5ac (patch)
tree2df5f15e1de7ff82d74272235984daecece21fb0 /calendar
parentf3a62a04677545c9653780000b7ce69de18e0fca (diff)
downloadgsoc2013-evolution-5ad033037b080d22d66d8f8ca6e00da1ecf8f5ac.tar
gsoc2013-evolution-5ad033037b080d22d66d8f8ca6e00da1ecf8f5ac.tar.gz
gsoc2013-evolution-5ad033037b080d22d66d8f8ca6e00da1ecf8f5ac.tar.bz2
gsoc2013-evolution-5ad033037b080d22d66d8f8ca6e00da1ecf8f5ac.tar.lz
gsoc2013-evolution-5ad033037b080d22d66d8f8ca6e00da1ecf8f5ac.tar.xz
gsoc2013-evolution-5ad033037b080d22d66d8f8ca6e00da1ecf8f5ac.tar.zst
gsoc2013-evolution-5ad033037b080d22d66d8f8ca6e00da1ecf8f5ac.zip
use the new source selector dialog in libedataserverui.
2004-10-21 Rodrigo Moya <rodrigo@novell.com> * gui/dialogs/select-source-dialog.c: use the new source selector dialog in libedataserverui. svn path=/trunk/; revision=27679
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog5
-rw-r--r--calendar/gui/dialogs/select-source-dialog.c108
2 files changed, 12 insertions, 101 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 921a911d7b..7bb7e41149 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,3 +1,8 @@
+2004-10-21 Rodrigo Moya <rodrigo@novell.com>
+
+ * gui/dialogs/select-source-dialog.c: use the new source selector
+ dialog in libedataserverui.
+
2004-10-20 JP Rosevear <jpr@novell.com>
* gui/calendar-component.c: put an icon on the properties menu item
diff --git a/calendar/gui/dialogs/select-source-dialog.c b/calendar/gui/dialogs/select-source-dialog.c
index 66a671b1d3..408cb73b29 100644
--- a/calendar/gui/dialogs/select-source-dialog.c
+++ b/calendar/gui/dialogs/select-source-dialog.c
@@ -23,42 +23,11 @@
#endif
#include <bonobo/bonobo-i18n.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkdialog.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkscrolledwindow.h>
#include <gtk/gtkstock.h>
#include <e-util/e-icon-factory.h>
-#include <libedataserverui/e-source-selector.h>
+#include <libedataserverui/e-source-selector-dialog.h>
#include "select-source-dialog.h"
-static void
-row_activated_cb (GtkTreeView *tree_view, GtkTreePath *path,
- GtkTreeViewColumn *column, GtkWidget *dialog)
-{
- gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
-}
-
-static void
-primary_selection_changed_cb (ESourceSelector *selector, gpointer user_data)
-{
- ESource **our_selection = user_data;
-
- if (*our_selection)
- g_object_unref (*our_selection);
- *our_selection = e_source_selector_peek_primary_selection (selector);
- if (*our_selection) {
- g_object_ref (*our_selection);
- gtk_dialog_set_response_sensitive (
- GTK_DIALOG (gtk_widget_get_toplevel (GTK_WIDGET (selector))), GTK_RESPONSE_OK, TRUE);
- } else {
- gtk_dialog_set_response_sensitive (
- GTK_DIALOG (gtk_widget_get_toplevel (GTK_WIDGET (selector))), GTK_RESPONSE_OK, FALSE);
- }
-}
-
/**
* select_source_dialog
*
@@ -67,12 +36,10 @@ primary_selection_changed_cb (ESourceSelector *selector, gpointer user_data)
ESource *
select_source_dialog (GtkWindow *parent, ECalSourceType obj_type)
{
- GtkWidget *dialog, *label, *scroll, *source_selector;
- GtkWidget *vbox, *hbox, *spacer;
+ GtkWidget *dialog;
ESourceList *source_list;
ESource *selected_source = NULL;
const char *gconf_key;
- char *label_text;
GConfClient *conf_client;
GList *icon_list = NULL;
@@ -83,71 +50,11 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type)
else
return NULL;
- /* create the dialog */
- dialog = gtk_dialog_new ();
- gtk_window_set_title (GTK_WINDOW (dialog), _("Select destination"));
- gtk_window_set_transient_for (GTK_WINDOW (dialog),
- GTK_WINDOW (parent));
- gtk_window_set_default_size (GTK_WINDOW (dialog), 320, 240);
-
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
- gtk_widget_ensure_style (dialog);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
-
- vbox = gtk_vbox_new (FALSE, 12);
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 12);
- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
- gtk_widget_show (vbox);
-
- label_text = g_strdup_printf ("<b>%s %s</b>", _("_Destination"),
- obj_type == E_CAL_SOURCE_TYPE_EVENT ?
- _("Calendar") : _("Task List"));
- label = gtk_label_new_with_mnemonic (label_text);
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
- gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
- g_free (label_text);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
- hbox = gtk_hbox_new (FALSE, 12);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
- gtk_widget_show (hbox);
-
- spacer = gtk_label_new ("");
- gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0);
- gtk_widget_show (spacer);
-
conf_client = gconf_client_get_default ();
source_list = e_source_list_new_for_gconf (conf_client, gconf_key);
- scroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scroll),
- GTK_SHADOW_IN);
- 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), "row_activated",
- G_CALLBACK (row_activated_cb), dialog);
-
- g_signal_connect (G_OBJECT (source_selector), "primary_selection_changed",
- G_CALLBACK (primary_selection_changed_cb), &selected_source);
- gtk_widget_show (source_selector);
- gtk_container_add (GTK_CONTAINER (scroll), source_selector);
- gtk_box_pack_start (GTK_BOX (hbox), scroll, TRUE, TRUE, 0);
-
- gtk_label_set_mnemonic_widget (GTK_LABEL (label), source_selector);
+ /* create the dialog */
+ dialog = e_source_selector_dialog_new (parent, source_list);
if (obj_type == E_CAL_SOURCE_TYPE_EVENT)
icon_list = e_icon_factory_get_icon_list ("stock_calendar");
@@ -161,6 +68,7 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type)
}
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
+ selected_source = e_source_selector_dialog_peek_primary_selection (E_SOURCE_SELECTOR_DIALOG (dialog));
if (selected_source) {
char *absolute_uri;
@@ -169,13 +77,11 @@ select_source_dialog (GtkWindow *parent, ECalSourceType obj_type)
absolute_uri = e_source_build_absolute_uri (selected_source);
e_source_set_absolute_uri (selected_source, (const char *) absolute_uri);
+ g_object_ref (selected_source);
g_free (absolute_uri);
}
- } else {
- if (selected_source)
- g_object_unref (selected_source);
+ } else
selected_source = NULL;
- }
g_object_unref (conf_client);
g_object_unref (source_list);