From 1dd41f136412d432612d2fa8fea332eefe963ffd Mon Sep 17 00:00:00 2001 From: Hans Petter Jansson Date: Fri, 9 Jan 2004 20:50:22 +0000 Subject: [PATCH] calendar_config -> calendar_setup. (edit_calendar_cb): Ditto. 2004-01-09 Hans Petter Jansson * gui/calendar-component.c (new_calendar_cb): calendar_config -> calendar_setup. (edit_calendar_cb): Ditto. (impl_requestCreateItem): Ditto. * gui/tasks-component.c (new_task_list_cb): Use calendar_setup. (edit_task_list_cb): Implement properties callback. (rename_task_list_cb): Remove. (fill_popup_menu_cb): Remove "rename" and add "properties". (impl_requestCreateItem): Use calendar_setup. * gui/dialogs/Makefile.am (libcal_dialogs_la_SOURCES): calendar_config -> calendar_setup. Remove new-task-list.[ch]. (glade_DATA): calendar_config -> calendar_setup. Remove new-task-list.glade. * gui/dialogs/new-task-list.[ch]: Remove. * gui/dialogs/calendar-config.[ch]: Rename to calendar-setup.[ch]. * gui/dialogs/calendar-config.glade: Rename to calendar-setup.glade. svn path=/trunk/; revision=24139 --- calendar/ChangeLog | 26 +- calendar/gui/calendar-component.c | 8 +- calendar/gui/dialogs/Makefile.am | 9 +- .../{calendar-config.c => calendar-setup.c} | 213 ++++++-- ...ndar-config.glade => calendar-setup.glade} | 512 ++++++++++++++++++ .../{calendar-config.h => calendar-setup.h} | 7 +- calendar/gui/dialogs/new-task-list.c | 145 ----- calendar/gui/dialogs/new-task-list.h | 28 - calendar/gui/tasks-component.c | 30 +- 9 files changed, 732 insertions(+), 246 deletions(-) rename calendar/gui/dialogs/{calendar-config.c => calendar-setup.c} (78%) rename calendar/gui/dialogs/{calendar-config.glade => calendar-setup.glade} (64%) rename calendar/gui/dialogs/{calendar-config.h => calendar-setup.h} (77%) delete mode 100644 calendar/gui/dialogs/new-task-list.c delete mode 100644 calendar/gui/dialogs/new-task-list.h diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 8984056033..31d9bda68b 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,27 @@ +2004-01-09 Hans Petter Jansson + + * gui/calendar-component.c (new_calendar_cb): calendar_config -> + calendar_setup. + (edit_calendar_cb): Ditto. + (impl_requestCreateItem): Ditto. + + * gui/tasks-component.c (new_task_list_cb): Use calendar_setup. + (edit_task_list_cb): Implement properties callback. + (rename_task_list_cb): Remove. + (fill_popup_menu_cb): Remove "rename" and add "properties". + (impl_requestCreateItem): Use calendar_setup. + + * gui/dialogs/Makefile.am (libcal_dialogs_la_SOURCES): calendar_config + -> calendar_setup. Remove new-task-list.[ch]. + (glade_DATA): calendar_config -> calendar_setup. Remove + new-task-list.glade. + + * gui/dialogs/new-task-list.[ch]: Remove. + + * gui/dialogs/calendar-config.[ch]: Rename to calendar-setup.[ch]. + + * gui/dialogs/calendar-config.glade: Rename to calendar-setup.glade. + 2004-01-09 JP Rosevear * gui/calendar-component.c (impl_upgradeFromVersion): make sure we @@ -10,7 +34,7 @@ * gui/calendar-component.c (impl_upgradeFromVersion): Create ESource for anniversaries -2003-01-09 Hans Petter Jansson +2004-01-09 Hans Petter Jansson * gui/calendar-component.c (new_calendar_cb): Call calendar_config_new_calendar(). diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index 399a3558bf..c7eaec9570 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -39,7 +39,7 @@ #include "e-comp-editor-registry.h" #include "comp-util.h" #include "common/authentication.h" -#include "dialogs/calendar-config.h" +#include "dialogs/calendar-setup.h" #include "dialogs/comp-editor.h" #include "dialogs/copy-source-dialog.h" #include "dialogs/event-editor.h" @@ -375,7 +375,7 @@ delete_calendar_cb (GtkWidget *widget, CalendarComponent *comp) static void new_calendar_cb (GtkWidget *widget, CalendarComponent *comp) { - calendar_config_new_calendar (GTK_WINDOW (gtk_widget_get_toplevel (widget))); + calendar_setup_new_calendar (GTK_WINDOW (gtk_widget_get_toplevel (widget))); } static void @@ -390,7 +390,7 @@ edit_calendar_cb (GtkWidget *widget, CalendarComponent *comp) if (!selected_source) return; - calendar_config_edit_calendar (GTK_WINDOW (gtk_widget_get_toplevel (widget)), selected_source); + calendar_setup_edit_calendar (GTK_WINDOW (gtk_widget_get_toplevel (widget)), selected_source); } static void @@ -837,7 +837,7 @@ impl_requestCreateItem (PortableServer_Servant servant, comp = get_default_event (priv->create_ecal, FALSE); is_meeting = TRUE; } else if (strcmp (item_type_name, CREATE_CALENDAR_ID) == 0) { - calendar_config_new_calendar (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->calendar)))); + calendar_setup_new_calendar (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->calendar)))); return; } else { bonobo_exception_set (ev, ex_GNOME_Evolution_Component_UnknownType); diff --git a/calendar/gui/dialogs/Makefile.am b/calendar/gui/dialogs/Makefile.am index 1749aa5482..18a83fb4de 100644 --- a/calendar/gui/dialogs/Makefile.am +++ b/calendar/gui/dialogs/Makefile.am @@ -37,8 +37,8 @@ libcal_dialogs_la_SOURCES = \ alarm-page.h \ cal-prefs-dialog.c \ cal-prefs-dialog.h \ - calendar-config.c \ - calendar-config.h \ + calendar-setup.c \ + calendar-setup.h \ cancel-comp.c \ cancel-comp.h \ changed-comp.c \ @@ -63,8 +63,6 @@ libcal_dialogs_la_SOURCES = \ event-page.h \ meeting-page.c \ meeting-page.h \ - new-task-list.c \ - new-task-list.h \ recurrence-page.c \ recurrence-page.h \ recur-comp.c \ @@ -86,11 +84,10 @@ glade_DATA = \ alarm-options.glade \ alarm-page.glade \ cal-prefs-dialog.glade \ - calendar-config.glade \ + calendar-setup.glade \ e-delegate-dialog.glade \ event-page.glade \ meeting-page.glade \ - new-task-list.glade \ recurrence-page.glade \ schedule-page.glade \ task-details-page.glade \ diff --git a/calendar/gui/dialogs/calendar-config.c b/calendar/gui/dialogs/calendar-setup.c similarity index 78% rename from calendar/gui/dialogs/calendar-config.c rename to calendar/gui/dialogs/calendar-setup.c index a5066c41d3..b310bada53 100644 --- a/calendar/gui/dialogs/calendar-config.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -36,9 +36,36 @@ #include #include #include -#include "calendar-config.h" +#include "calendar-setup.h" -#define GLADE_FILE_NAME "calendar-config.glade" +#define GLADE_FILE_NAME "calendar-setup.glade" + +typedef struct +{ + GladeXML *gui_xml; + + /* Main widgets */ + GtkWidget *window; + GtkWidget *druid; + + /* Source selection */ + ESourceList *source_list; + GtkWidget *group_optionmenu; + + /* ESource we're currently editing (if any) */ + ESource *source; + + /* Source group we're creating/editing source in */ + ESourceGroup *source_group; + + /* General page fields */ + GtkWidget *name_entry; + + /* Location page fields */ + GtkWidget *uri_entry; + GtkWidget *refresh_spin; +} +SourceDialog; static gchar * print_uri_noproto (EUri *uri) @@ -236,32 +263,16 @@ create_new_source_with_group (GtkWindow *parent, return source; } -typedef struct +static void +source_dialog_destroy (SourceDialog *source_dialog) { - GladeXML *gui_xml; + g_object_unref (source_dialog->gui_xml); - /* Main widgets */ - GtkWidget *window; - GtkWidget *druid; + if (source_dialog->source) + g_object_unref (source_dialog->source); - /* Source selection */ - ESourceList *source_list; - GtkWidget *group_optionmenu; - - /* ESource we're currently editing (if any) */ - ESource *source; - - /* Source group we're creating/editing source in */ - ESourceGroup *source_group; - - /* General page fields */ - GtkWidget *name_entry; - - /* Location page fields */ - GtkWidget *uri_entry; - GtkWidget *refresh_spin; + g_free (source_dialog); } -SourceDialog; static void source_to_dialog (SourceDialog *source_dialog) @@ -475,19 +486,8 @@ new_calendar_cancel (SourceDialog *source_dialog) gtk_widget_destroy (source_dialog->window); } -static void -source_dialog_destroy (SourceDialog *source_dialog) -{ - g_object_unref (source_dialog->gui_xml); - - if (source_dialog->source) - g_object_unref (source_dialog->source); - - g_free (source_dialog); -} - gboolean -calendar_config_new_calendar (GtkWindow *parent) +calendar_setup_new_calendar (GtkWindow *parent) { SourceDialog *source_dialog = g_new0 (SourceDialog, 1); GConfClient *gconf_client; @@ -580,7 +580,7 @@ edit_calendar_cancel (SourceDialog *source_dialog) } gboolean -calendar_config_edit_calendar (GtkWindow *parent, ESource *source) +calendar_setup_edit_calendar (GtkWindow *parent, ESource *source) { SourceDialog *source_dialog = g_new0 (SourceDialog, 1); @@ -632,3 +632,142 @@ calendar_config_edit_calendar (GtkWindow *parent, ESource *source) return TRUE; } + +static void +new_task_list_finish (SourceDialog *source_dialog) +{ + source_dialog->source = + create_new_source_with_group (GTK_WINDOW (source_dialog->window), source_dialog->source_group, + gtk_entry_get_text (GTK_ENTRY (source_dialog->name_entry)), + gtk_entry_get_text (GTK_ENTRY (source_dialog->uri_entry))); + dialog_to_source (source_dialog); + + gtk_widget_destroy (source_dialog->window); +} + +static void +new_task_list_cancel (SourceDialog *source_dialog) +{ + gtk_widget_destroy (source_dialog->window); +} + +gboolean +calendar_setup_new_task_list (GtkWindow *parent) +{ + SourceDialog *source_dialog = g_new0 (SourceDialog, 1); + GConfClient *gconf_client; + GtkWidget *page; + + source_dialog->gui_xml = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, "task-list-druid-window", NULL); + if (!source_dialog->gui_xml) { + g_warning (G_STRLOC ": Cannot load Glade file."); + g_free (source_dialog); + return FALSE; + } + + source_dialog->window = glade_xml_get_widget (source_dialog->gui_xml, "task-list-druid-window"); + source_dialog->druid = glade_xml_get_widget (source_dialog->gui_xml, "druid"); + + /* General page */ + page = glade_xml_get_widget (source_dialog->gui_xml, "general-page"); + source_dialog->name_entry = glade_xml_get_widget (source_dialog->gui_xml, "name-entry"); + g_signal_connect_swapped (source_dialog->name_entry, "changed", + G_CALLBACK (general_page_modified), source_dialog); + g_signal_connect_after (page, "prepare", + G_CALLBACK (general_page_prepare), source_dialog); + + gconf_client = gconf_client_get_default (); + source_dialog->source_list = + e_source_list_new_for_gconf (gconf_client, "/apps/evolution/tasks/sources"); + source_dialog->group_optionmenu = + glade_xml_get_widget (source_dialog->gui_xml, "group-optionmenu"); + if (!GTK_IS_MENU (gtk_option_menu_get_menu (GTK_OPTION_MENU (source_dialog->group_optionmenu)))) { + GtkWidget *menu = gtk_menu_new (); + gtk_option_menu_set_menu (GTK_OPTION_MENU (source_dialog->group_optionmenu), menu); + gtk_widget_show (menu); + } + + /* NOTE: This assumes that we have sources. If they don't exist, they're set up + * on startup of the calendar component. */ + 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_set_history (GTK_OPTION_MENU (source_dialog->group_optionmenu), 0); + 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), source_dialog); + + /* Finish page */ + page = glade_xml_get_widget (source_dialog->gui_xml, "finish-page"); + g_signal_connect_swapped (page, "finish", + G_CALLBACK (new_task_list_finish), source_dialog); + g_signal_connect_swapped (source_dialog->druid, "cancel", + G_CALLBACK (new_task_list_cancel), source_dialog); + g_object_weak_ref (G_OBJECT (source_dialog->window), + (GWeakNotify) source_dialog_destroy, source_dialog); + + /* Prepare and show dialog */ + source_to_dialog (source_dialog); + + gtk_window_set_type_hint (GTK_WINDOW (source_dialog->window), GDK_WINDOW_TYPE_HINT_DIALOG); + gtk_window_set_modal (GTK_WINDOW (source_dialog->window), TRUE); + + gtk_widget_show_all (source_dialog->window); + + return TRUE; +} + +static void +edit_task_list_finish (SourceDialog *source_dialog) +{ + dialog_to_source (source_dialog); + gtk_widget_destroy (source_dialog->window); +} + +static void +edit_task_list_cancel (SourceDialog *source_dialog) +{ + gtk_widget_destroy (source_dialog->window); +} + +gboolean +calendar_setup_edit_task_list (GtkWindow *parent, ESource *source) +{ + SourceDialog *source_dialog = g_new0 (SourceDialog, 1); + + g_return_val_if_fail (source != NULL, FALSE); + + source_dialog->gui_xml = glade_xml_new (EVOLUTION_GLADEDIR "/" GLADE_FILE_NAME, "task-list-editor-window", NULL); + if (!source_dialog->gui_xml) { + g_warning (G_STRLOC ": Cannot load Glade file."); + g_free (source_dialog); + return FALSE; + } + + source_dialog->source = source; + g_object_ref (source); + + source_dialog->window = glade_xml_get_widget (source_dialog->gui_xml, "task-list-editor-window"); + + /* General page */ + source_dialog->name_entry = glade_xml_get_widget (source_dialog->gui_xml, "name-entry"); + g_signal_connect_swapped (source_dialog->name_entry, "changed", + G_CALLBACK (general_page_modified), source_dialog); + + /* Finishing */ + g_signal_connect_swapped (glade_xml_get_widget (source_dialog->gui_xml, "ok-button"), "clicked", + G_CALLBACK (edit_task_list_finish), source_dialog); + g_signal_connect_swapped (glade_xml_get_widget (source_dialog->gui_xml, "cancel-button"), "clicked", + G_CALLBACK (edit_task_list_cancel), source_dialog); + g_object_weak_ref (G_OBJECT (source_dialog->window), + (GWeakNotify) source_dialog_destroy, source_dialog); + + /* Prepare and show dialog */ + source_to_dialog (source_dialog); + + gtk_window_set_type_hint (GTK_WINDOW (source_dialog->window), GDK_WINDOW_TYPE_HINT_DIALOG); + gtk_window_set_modal (GTK_WINDOW (source_dialog->window), TRUE); + + gtk_widget_show_all (source_dialog->window); + + return TRUE; +} diff --git a/calendar/gui/dialogs/calendar-config.glade b/calendar/gui/dialogs/calendar-setup.glade similarity index 64% rename from calendar/gui/dialogs/calendar-config.glade rename to calendar/gui/dialogs/calendar-setup.glade index 6428d63429..f38fd54aca 100644 --- a/calendar/gui/dialogs/calendar-config.glade +++ b/calendar/gui/dialogs/calendar-setup.glade @@ -898,4 +898,516 @@ Please click the "Finish" button to save the settings you have entered + + New Task List + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + True + False + + + + 6 + True + False + + + + True + GNOME_EDGE_START + Task List Creation Assistant + This assistant will help you create a new task list. + +Depending on the type of task list you create, additional +parameters may be required. Please contact your system +administrator if you need help finding this information. + + + + + + True + Step 1: Folder Characteristics + + + + 16 + True + False + 6 + + + + 6 + True + False + 6 + + + + True + Specifying a display name and group is the first step in setting up a task list. + False + False + GTK_JUSTIFY_LEFT + False + False + 7.45058e-09 + 0.5 + 3 + 0 + + + 0 + False + False + + + + + + True + + + 0 + False + False + + + + + + 3 + True + 2 + 2 + False + 6 + 3 + + + + True + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + _Display name: + True + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + name-entry + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Group: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + True + -1 + + + 1 + 2 + 0 + 1 + fill + + + + + + 0 + False + False + + + + + + True + False + False + GTK_POS_TOP + False + False + + + + True + This is the name that will appear in your Evolution folder list. It is for display purposes only. + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + False + True + + + + + + True + label163 + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + + True + Selecting this option will let you change Evolution's default settings for LDAP +searches, and for creating and editing contacts. + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + False + True + + + + + + True + label164 + False + False + GTK_JUSTIFY_CENTER + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + + + + 0 + False + False + GTK_PACK_END + + + + + 0 + True + True + + + + + + + + + + True + GNOME_EDGE_FINISH + Finished + Congratulations, you are finished setting up this task list. + +Please click the "Finish" button to save the settings you have entered here. + + + + + + + + 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 + + + + + 0 + True + True + + + + + + True + + + 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 + + + + + + diff --git a/calendar/gui/dialogs/calendar-config.h b/calendar/gui/dialogs/calendar-setup.h similarity index 77% rename from calendar/gui/dialogs/calendar-config.h rename to calendar/gui/dialogs/calendar-setup.h index 977c502474..c60afdf0e5 100644 --- a/calendar/gui/dialogs/calendar-config.h +++ b/calendar/gui/dialogs/calendar-setup.h @@ -23,7 +23,10 @@ #include -gboolean calendar_config_new_calendar (GtkWindow *parent); -gboolean calendar_config_edit_calendar (GtkWindow *parent, ESource *source); +gboolean calendar_setup_new_calendar (GtkWindow *parent); +gboolean calendar_setup_edit_calendar (GtkWindow *parent, ESource *source); + +gboolean calendar_setup_new_task_list (GtkWindow *parent); +gboolean calendar_setup_edit_task_list (GtkWindow *parent, ESource *source); #endif diff --git a/calendar/gui/dialogs/new-task-list.c b/calendar/gui/dialogs/new-task-list.c deleted file mode 100644 index e77d35d4ad..0000000000 --- a/calendar/gui/dialogs/new-task-list.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Evolution calendar - New task list dialog - * - * Copyright (C) 2003 Novell, Inc. - * - * Author: Rodrigo Moya - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "new-task-list.h" - -static gboolean -create_new_source_with_group (GtkWindow *parent, - ESourceGroup *group, - const char *source_name) -{ - ESource *source; - char *new_dir; - - if (e_source_group_peek_source_by_name (group, source_name)) { - e_notice (parent, GTK_MESSAGE_ERROR, - _("Source with name '%s' already exists in the selected group"), - source_name); - return FALSE; - } - - new_dir = g_build_filename (e_source_group_peek_base_uri (group), - source_name, NULL); - if (e_mkdir_hier (new_dir, 0700)) { - g_free (new_dir); - e_notice (parent, GTK_MESSAGE_ERROR, - _("Could not create directory for new task list")); - return FALSE; - } - - source = e_source_new (source_name, source_name); - g_free (new_dir); - - e_source_group_add_source (group, source, -1); - return TRUE; -} - -/** - * new_task_list_dialog - * - * Displays a dialog that allows the user to create a new task list. - */ -gboolean -new_task_list_dialog (GtkWindow *parent) -{ - GtkWidget *dialog, *task_group, *task_name; - GladeXML *xml; - ESourceList *source_list; - GConfClient *gconf_client; - GSList *groups, *sl; - gboolean result = FALSE, retry = TRUE; - - /* load the Glade file */ - xml = glade_xml_new (EVOLUTION_GLADEDIR "/new-task-list.glade", "new-task-list-dialog", NULL); - if (!xml) { - g_warning (G_STRLOC ": cannot load Glade file"); - return FALSE; - } - - dialog = glade_xml_get_widget (xml, "new-task-list-dialog"); - task_group = glade_xml_get_widget (xml, "task-list-group"); - task_name = glade_xml_get_widget (xml, "task-list-name"); - - /* set up widgets */ - gconf_client = gconf_client_get_default (); - source_list = e_source_list_new_for_gconf (gconf_client, "/apps/evolution/tasks/sources"); - - groups = e_source_list_peek_groups (source_list); - for (sl = groups; sl != NULL; sl = sl->next) { - GtkWidget *menu_item, *menu; - ESourceGroup *group = sl->data; - - menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (task_group)); - if (!GTK_IS_MENU (menu)) { - menu = gtk_menu_new (); - gtk_option_menu_set_menu (GTK_OPTION_MENU (task_group), menu); - gtk_widget_show (menu); - } - - menu_item = gtk_menu_item_new_with_label (e_source_group_peek_name (group)); - gtk_widget_show (menu_item); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item); - } - - if (groups) - gtk_option_menu_set_history (GTK_OPTION_MENU (task_group), 0); - - /* run the dialog */ - do { - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { - const char *name; - - name = gtk_entry_get_text (GTK_ENTRY (task_name)); - sl = g_slist_nth (groups, gtk_option_menu_get_history (GTK_OPTION_MENU (task_group))); - if (sl) { - if (create_new_source_with_group (GTK_WINDOW (dialog), - sl->data, - name)) - retry = FALSE; - } else { - e_notice (dialog, GTK_MESSAGE_ERROR, - _("A group must be selected")); - continue; - } - } else - retry = FALSE; /* user pressed Cancel */ - } while (retry); - - /* free memory */ - g_object_unref (gconf_client); - g_object_unref (source_list); - gtk_widget_destroy (dialog); - g_object_unref (xml); - - return result; -} diff --git a/calendar/gui/dialogs/new-task-list.h b/calendar/gui/dialogs/new-task-list.h deleted file mode 100644 index 3f529f39ad..0000000000 --- a/calendar/gui/dialogs/new-task-list.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Evolution calendar - New task list dialog - * - * Copyright (C) 2003 Novell, Inc. - * - * Author: Rodrigo Moya - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifndef NEW_TASK_LIST_H -#define NEW_TASK_LIST_H - -#include - -gboolean new_task_list_dialog (GtkWindow *parent); - -#endif diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index dfb668ac7f..e8f6d94776 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -40,9 +40,9 @@ #include "comp-util.h" #include "calendar-config.h" #include "common/authentication.h" +#include "dialogs/calendar-setup.h" #include "dialogs/comp-editor.h" #include "dialogs/copy-source-dialog.h" -#include "dialogs/new-task-list.h" #include "dialogs/task-editor.h" #include "widgets/misc/e-source-selector.h" @@ -367,15 +367,14 @@ delete_task_list_cb (GtkWidget *widget, TasksComponent *comp) static void new_task_list_cb (GtkWidget *widget, TasksComponent *component) { - new_task_list_dialog (GTK_WINDOW (gtk_widget_get_toplevel (widget))); + calendar_setup_new_task_list (GTK_WINDOW (gtk_widget_get_toplevel (widget))); } static void -rename_task_list_cb (GtkWidget *widget, TasksComponent *comp) +edit_task_list_cb (GtkWidget *widget, TasksComponent *comp) { TasksComponentPrivate *priv; ESource *selected_source; - GtkWidget *dialog, *entry; priv = comp->priv; @@ -383,22 +382,7 @@ rename_task_list_cb (GtkWidget *widget, TasksComponent *comp) if (!selected_source) return; - /* create the dialog to prompt the user for the new name */ - dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (widget)), - GTK_DIALOG_MODAL, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_OK_CANCEL, - _("Rename this task list to")); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); - entry = gtk_entry_new (); - gtk_entry_set_text (GTK_ENTRY (entry), e_source_peek_name (selected_source)); - gtk_widget_show (entry); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), entry, TRUE, FALSE, 6); - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) - e_source_set_name (selected_source, gtk_entry_get_text (GTK_ENTRY (entry))); - - gtk_widget_destroy (dialog); + calendar_setup_edit_task_list (GTK_WINDOW (gtk_widget_get_toplevel (widget)), selected_source); } static void @@ -413,10 +397,10 @@ fill_popup_menu_cb (ESourceSelector *selector, GtkMenu *menu, TasksComponent *co G_CALLBACK (new_task_list_cb), component, TRUE); add_popup_menu_item (menu, _("Copy"), EVOLUTION_IMAGESDIR "/folder-copy-16.png", G_CALLBACK (copy_task_list_cb), component, sensitive); - add_popup_menu_item (menu, _("Rename"), NULL, G_CALLBACK (rename_task_list_cb), - component, sensitive); add_popup_menu_item (menu, _("Delete"), GTK_STOCK_DELETE, G_CALLBACK (delete_task_list_cb), component, sensitive); + add_popup_menu_item (menu, _("Properties..."), NULL, G_CALLBACK (edit_task_list_cb), + component, sensitive); } static void @@ -769,7 +753,7 @@ impl_requestCreateItem (PortableServer_Servant servant, e_comp_editor_registry_add (comp_editor_registry, COMP_EDITOR (editor), TRUE); } else if (strcmp (item_type_name, CREATE_TASK_LIST_ID) == 0) { - new_task_list_dialog (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->tasks)))); + calendar_setup_new_task_list (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (priv->tasks)))); } else { bonobo_exception_set (ev, ex_GNOME_Evolution_Component_UnknownType); return;