diff options
author | Hans Petter Jansson <hpj@ximian.com> | 2004-01-10 04:50:22 +0800 |
---|---|---|
committer | Hans Petter <hansp@src.gnome.org> | 2004-01-10 04:50:22 +0800 |
commit | 1dd41f136412d432612d2fa8fea332eefe963ffd (patch) | |
tree | dd6ad00a47d098e3ef50d549105e490b159cb679 /calendar/gui | |
parent | 1a2190aef718d7a5909f9bfd4898e80823b10876 (diff) | |
download | gsoc2013-evolution-1dd41f136412d432612d2fa8fea332eefe963ffd.tar gsoc2013-evolution-1dd41f136412d432612d2fa8fea332eefe963ffd.tar.gz gsoc2013-evolution-1dd41f136412d432612d2fa8fea332eefe963ffd.tar.bz2 gsoc2013-evolution-1dd41f136412d432612d2fa8fea332eefe963ffd.tar.lz gsoc2013-evolution-1dd41f136412d432612d2fa8fea332eefe963ffd.tar.xz gsoc2013-evolution-1dd41f136412d432612d2fa8fea332eefe963ffd.tar.zst gsoc2013-evolution-1dd41f136412d432612d2fa8fea332eefe963ffd.zip |
calendar_config -> calendar_setup. (edit_calendar_cb): Ditto.
2004-01-09 Hans Petter Jansson <hpj@ximian.com>
* 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
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/calendar-component.c | 8 | ||||
-rw-r--r-- | calendar/gui/dialogs/Makefile.am | 9 | ||||
-rw-r--r-- | calendar/gui/dialogs/calendar-setup.c (renamed from calendar/gui/dialogs/calendar-config.c) | 213 | ||||
-rw-r--r-- | calendar/gui/dialogs/calendar-setup.glade (renamed from calendar/gui/dialogs/calendar-config.glade) | 512 | ||||
-rw-r--r-- | calendar/gui/dialogs/calendar-setup.h (renamed from calendar/gui/dialogs/calendar-config.h) | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/new-task-list.c | 145 | ||||
-rw-r--r-- | calendar/gui/dialogs/new-task-list.h | 28 | ||||
-rw-r--r-- | calendar/gui/tasks-component.c | 30 |
8 files changed, 707 insertions, 245 deletions
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 index a5066c41d3..b310bada53 100644 --- a/calendar/gui/dialogs/calendar-config.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -36,9 +36,36 @@ #include <libedataserver/e-source-list.h> #include <e-util/e-dialog-utils.h> #include <e-util/e-url.h> -#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; - - /* 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; + g_object_unref (source_dialog->gui_xml); - /* General page fields */ - GtkWidget *name_entry; + if (source_dialog->source) + g_object_unref (source_dialog->source); - /* 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 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 </child> </widget> +<widget class="GtkWindow" id="task-list-druid-window"> + <property name="title" translatable="yes">New Task List</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + + <child> + <widget class="GnomeDruid" id="druid"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="show_help">False</property> + + <child> + <widget class="GnomeDruidPageEdge" id="druidpageedge2"> + <property name="visible">True</property> + <property name="position">GNOME_EDGE_START</property> + <property name="title" translatable="yes">Task List Creation Assistant</property> + <property name="text" translatable="yes">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.</property> + </widget> + </child> + + <child> + <widget class="GnomeDruidPageStandard" id="general-page"> + <property name="visible">True</property> + <property name="title" translatable="yes">Step 1: Folder Characteristics</property> + + <child internal-child="vbox"> + <widget class="GtkVBox" id="vbox80"> + <property name="border_width">16</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkVBox" id="vbox81"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkLabel" id="label577"> + <property name="visible">True</property> + <property name="label" translatable="yes">Specifying a display name and group is the first step in setting up a task list.</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">7.45058e-09</property> + <property name="yalign">0.5</property> + <property name="xpad">3</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHSeparator" id="hseparator14"> + <property name="visible">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkTable" id="table39"> + <property name="border_width">3</property> + <property name="visible">True</property> + <property name="n_rows">2</property> + <property name="n_columns">2</property> + <property name="homogeneous">False</property> + <property name="row_spacing">6</property> + <property name="column_spacing">3</property> + + <child> + <widget class="GtkEntry" id="name-entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="has_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char" translatable="yes">*</property> + <property name="activates_default">False</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label578"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Display name:</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="mnemonic_widget">name-entry</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label579"> + <property name="visible">True</property> + <property name="label" translatable="yes">Group:</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkOptionMenu" id="group-optionmenu"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="history">-1</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkNotebook" id="notebook16"> + <property name="visible">True</property> + <property name="show_tabs">False</property> + <property name="show_border">False</property> + <property name="tab_pos">GTK_POS_TOP</property> + <property name="scrollable">False</property> + <property name="enable_popup">False</property> + + <child> + <widget class="GtkLabel" id="label580"> + <property name="visible">True</property> + <property name="label" translatable="yes">This is the name that will appear in your Evolution folder list. It is for display purposes only. </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label581"> + <property name="visible">True</property> + <property name="label" translatable="yes">label163</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label582"> + <property name="visible">True</property> + <property name="label" translatable="yes">Selecting this option will let you change Evolution's default settings for LDAP +searches, and for creating and editing contacts. </property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label583"> + <property name="visible">True</property> + <property name="label" translatable="yes">label164</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="pack_type">GTK_PACK_END</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + </child> + </widget> + </child> + + <child> + <widget class="GnomeDruidPageEdge" id="finish-page"> + <property name="visible">True</property> + <property name="position">GNOME_EDGE_FINISH</property> + <property name="title" translatable="yes">Finished</property> + <property name="text" translatable="yes">Congratulations, you are finished setting up this task list. + +Please click the "Finish" button to save the settings you have entered here.</property> + </widget> + </child> + </widget> + </child> +</widget> + +<widget class="GtkWindow" id="task-list-editor-window"> + <property name="title" translatable="yes">Task List Properties</property> + <property name="type">GTK_WINDOW_TOPLEVEL</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + + <child> + <widget class="GtkVBox" id="vbox84"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkNotebook" id="notebook17"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="show_tabs">True</property> + <property name="show_border">True</property> + <property name="tab_pos">GTK_POS_TOP</property> + <property name="scrollable">False</property> + <property name="enable_popup">False</property> + + <child> + <widget class="GtkVBox" id="vbox85"> + <property name="border_width">6</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkHBox" id="hbox123"> + <property name="border_width">3</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">4</property> + + <child> + <widget class="GtkLabel" id="label585"> + <property name="visible">True</property> + <property name="label" translatable="yes">_Display name:</property> + <property name="use_underline">True</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkAlignment" id="alignment46"> + <property name="visible">True</property> + <property name="xalign">1</property> + <property name="yalign">0.5</property> + <property name="xscale">0.9</property> + <property name="yscale">1</property> + + <child> + <widget class="GtkEntry" id="name-entry"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="editable">True</property> + <property name="visibility">True</property> + <property name="max_length">0</property> + <property name="text" translatable="yes"></property> + <property name="has_frame">True</property> + <property name="invisible_char" translatable="yes">*</property> + <property name="activates_default">False</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox86"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <placeholder/> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label586"> + <property name="visible">True</property> + <property name="label" translatable="yes">General</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_CENTER</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkHSeparator" id="hseparator15"> + <property name="visible">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox125"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkHButtonBox" id="hbuttonbox21"> + <property name="visible">True</property> + <property name="layout_style">GTK_BUTTONBOX_END</property> + <property name="spacing">6</property> + + <child> + <widget class="GtkButton" id="cancel-button"> + <property name="visible">True</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-cancel</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + </widget> + </child> + + <child> + <widget class="GtkButton" id="ok-button"> + <property name="visible">True</property> + <property name="sensitive">False</property> + <property name="can_default">True</property> + <property name="can_focus">True</property> + <property name="label">gtk-ok</property> + <property name="use_stock">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + </child> +</widget> + </glade-interface> diff --git a/calendar/gui/dialogs/calendar-config.h b/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 <gtk/gtkwindow.h> -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 <rodrigo@ximian.com> - * - * 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 <config.h> -#endif - -#include <bonobo/bonobo-i18n.h> -#include <gtk/gtkentry.h> -#include <gtk/gtkmenu.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkmessagedialog.h> -#include <gtk/gtkoptionmenu.h> -#include <glade/glade.h> -#include <e-util/e-dialog-utils.h> -#include <libedataserver/e-source-list.h> -#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 <rodrigo@ximian.com> - * - * 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 <gtk/gtkwindow.h> - -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; |