diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-08-30 13:37:36 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-08-30 13:40:49 +0800 |
commit | cfb9c32b6657165e4d5e11aa7b47804f679a61f8 (patch) | |
tree | 1f9c8954df7a357b5dc20a13ac82bf31c1112083 /calendar/gui/dialogs | |
parent | fefeb30f58447f2fa7bcbee16dbe68a9333ce89d (diff) | |
parent | 0f7f4cfe38b3c4cd83efbe9922ae15c5aee00317 (diff) | |
download | gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.tar.gz gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.tar.zst gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.zip |
Merge commit 'origin/kill-bonobo'
Diffstat (limited to 'calendar/gui/dialogs')
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.c | 405 | ||||
-rw-r--r-- | calendar/gui/dialogs/cal-prefs-dialog.h | 37 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-util.c | 30 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor-util.h | 7 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 207 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.h | 6 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 56 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.h | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-page.c | 220 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-editor.c | 14 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-editor.h | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-page.c | 17 | ||||
-rw-r--r-- | calendar/gui/dialogs/memo-page.glade | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/recurrence-page.c | 51 | ||||
-rw-r--r-- | calendar/gui/dialogs/schedule-page.c | 19 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.c | 14 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-details-page.glade | 190 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 60 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.h | 1 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-page.c | 200 |
20 files changed, 784 insertions, 753 deletions
diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 2fc17202cc..6fccf0cea1 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -31,16 +31,13 @@ #include "../calendar-config.h" #include "cal-prefs-dialog.h" #include <widgets/misc/e-dateedit.h> -#include "e-util/e-datetime-format.h" +#include <e-util/e-binding.h> +#include <e-util/e-datetime-format.h> #include <e-util/e-dialog-widgets.h> #include <e-util/e-util-private.h> #include <glib/gi18n.h> #include <string.h> -static const gint week_start_day_map[] = { - 1, 2, 3, 4, 5, 6, 0, -1 -}; - static const gint time_division_map[] = { 60, 30, 15, 10, 5, -1 }; @@ -99,32 +96,6 @@ eccp_widget_glade (EConfig *ec, EConfigItem *item, GtkWidget *parent, GtkWidget } static void -working_days_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) -{ - CalWeekdays working_days = 0; - guint32 mask = 1; - gint day; - - for (day = 0; day < 7; day++) { - if (e_dialog_toggle_get (prefs->working_days[day])) - working_days |= mask; - mask <<= 1; - } - - calendar_config_set_working_days (working_days); -} - -static void -timezone_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) -{ - icaltimezone *zone; - - zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (prefs->timezone)); - - calendar_config_set_timezone (icaltimezone_get_location (zone)); -} - -static void update_day_second_zone_caption (CalendarPrefsDialog *prefs) { gchar *location; @@ -268,27 +239,6 @@ end_of_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) calendar_config_set_day_end_hour (end_hour); calendar_config_set_day_end_minute (end_minute); } -static void -week_start_day_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) -{ - gint week_start_day; - - week_start_day = e_dialog_combo_box_get (prefs->week_start_day, week_start_day_map); - calendar_config_set_week_start_day (week_start_day); -} - -static void -use_24_hour_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) -{ - gboolean use_24_hour; - - use_24_hour = gtk_toggle_button_get_active (toggle); - - e_date_edit_set_use_24_hour_format (E_DATE_EDIT (prefs->start_of_day), use_24_hour); - e_date_edit_set_use_24_hour_format (E_DATE_EDIT (prefs->end_of_day), use_24_hour); - - calendar_config_set_24_hour_format (use_24_hour); -} static void time_divisions_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) @@ -300,30 +250,6 @@ time_divisions_changed (GtkWidget *widget, CalendarPrefsDialog *prefs) } static void -show_end_times_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) -{ - calendar_config_set_show_event_end (gtk_toggle_button_get_active (toggle)); -} - -static void -compress_weekend_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) -{ - calendar_config_set_compress_weekend (gtk_toggle_button_get_active (toggle)); -} - -static void -dnav_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) -{ - calendar_config_set_dnav_show_week_no (gtk_toggle_button_get_active (toggle)); -} - -static void -dview_show_week_no_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) -{ - calendar_config_set_dview_show_week_no (gtk_toggle_button_get_active (toggle)); -} - -static void month_scroll_by_week_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) { calendar_config_set_month_scroll_by_week (gtk_toggle_button_get_active (toggle)); @@ -356,30 +282,6 @@ hide_completed_tasks_units_changed (GtkWidget *widget, CalendarPrefsDialog *pref } static void -tasks_due_today_set_color (GtkColorButton *color_button, CalendarPrefsDialog *prefs) -{ - GdkColor color; - - gtk_color_button_get_color (color_button, &color); - calendar_config_set_tasks_due_today_color (&color); -} - -static void -tasks_overdue_set_color (GtkColorButton *color_button, CalendarPrefsDialog *prefs) -{ - GdkColor color; - - gtk_color_button_get_color (color_button, &color); - calendar_config_set_tasks_overdue_color (&color); -} - -static void -confirm_delete_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) -{ - calendar_config_set_confirm_delete (gtk_toggle_button_get_active (toggle)); -} - -static void default_reminder_toggled (GtkToggleButton *toggle, CalendarPrefsDialog *prefs) { calendar_config_set_use_default_reminder (gtk_toggle_button_get_active (toggle)); @@ -491,13 +393,9 @@ alarms_selection_changed (ESourceSelector *selector, CalendarPrefsDialog *prefs) } static void -template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs) -{ - calendar_config_set_free_busy_template (gtk_entry_get_text (entry)); -} - -static void -update_system_tz_widgets (CalendarPrefsDialog *prefs) +update_system_tz_widgets (EShellSettings *shell_settings, + GParamSpec *pspec, + CalendarPrefsDialog *prefs) { icaltimezone *zone; @@ -509,42 +407,18 @@ update_system_tz_widgets (CalendarPrefsDialog *prefs) } else { gtk_label_set_text (GTK_LABEL (prefs->system_tz_label), "(UTC)"); } - - gtk_widget_set_sensitive (prefs->timezone, !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (prefs->use_system_tz_check))); -} - -static void -use_system_tz_changed (GtkWidget *check, CalendarPrefsDialog *prefs) -{ - calendar_config_set_use_system_timezone (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))); - update_system_tz_widgets (prefs); } static void setup_changes (CalendarPrefsDialog *prefs) { - gint i; - - for (i = 0; i < 7; i ++) - g_signal_connect (G_OBJECT (prefs->working_days[i]), "toggled", G_CALLBACK (working_days_changed), prefs); - - g_signal_connect (G_OBJECT (prefs->use_system_tz_check), "toggled", G_CALLBACK (use_system_tz_changed), prefs); - g_signal_connect (G_OBJECT (prefs->timezone), "changed", G_CALLBACK (timezone_changed), prefs); g_signal_connect (G_OBJECT (prefs->day_second_zone), "clicked", G_CALLBACK (day_second_zone_clicked), prefs); g_signal_connect (G_OBJECT (prefs->start_of_day), "changed", G_CALLBACK (start_of_day_changed), prefs); g_signal_connect (G_OBJECT (prefs->end_of_day), "changed", G_CALLBACK (end_of_day_changed), prefs); - g_signal_connect (G_OBJECT (prefs->week_start_day), "changed", G_CALLBACK (week_start_day_changed), prefs); - - g_signal_connect (G_OBJECT (prefs->use_24_hour), "toggled", G_CALLBACK (use_24_hour_toggled), prefs); - g_signal_connect (G_OBJECT (prefs->time_divisions), "changed", G_CALLBACK (time_divisions_changed), prefs); - g_signal_connect (G_OBJECT (prefs->show_end_times), "toggled", G_CALLBACK (show_end_times_toggled), prefs); - g_signal_connect (G_OBJECT (prefs->compress_weekend), "toggled", G_CALLBACK (compress_weekend_toggled), prefs); - g_signal_connect (G_OBJECT (prefs->dnav_show_week_no), "toggled", G_CALLBACK (dnav_show_week_no_toggled), prefs); - g_signal_connect (G_OBJECT (prefs->dview_show_week_no), "toggled", G_CALLBACK (dview_show_week_no_toggled), prefs); g_signal_connect (G_OBJECT (prefs->month_scroll_by_week), "toggled", G_CALLBACK (month_scroll_by_week_toggled), prefs); g_signal_connect (G_OBJECT (prefs->tasks_hide_completed), "toggled", @@ -552,12 +426,7 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->tasks_hide_completed_interval), "value-changed", G_CALLBACK (hide_completed_tasks_changed), prefs); g_signal_connect (G_OBJECT (prefs->tasks_hide_completed_units), "changed", G_CALLBACK (hide_completed_tasks_units_changed), prefs); - g_signal_connect (G_OBJECT (prefs->tasks_due_today_color), "color-set", - G_CALLBACK (tasks_due_today_set_color), prefs); - g_signal_connect (G_OBJECT (prefs->tasks_overdue_color), "color-set", - G_CALLBACK (tasks_overdue_set_color), prefs); - g_signal_connect (G_OBJECT (prefs->confirm_delete), "toggled", G_CALLBACK (confirm_delete_toggled), prefs); g_signal_connect (G_OBJECT (prefs->default_reminder), "toggled", G_CALLBACK (default_reminder_toggled), prefs); g_signal_connect (G_OBJECT (prefs->default_reminder_interval), "changed", G_CALLBACK (default_reminder_interval_changed), prefs); @@ -570,39 +439,15 @@ setup_changes (CalendarPrefsDialog *prefs) g_signal_connect (G_OBJECT (prefs->notify_with_tray), "toggled", G_CALLBACK (notify_with_tray_toggled), prefs); g_signal_connect (G_OBJECT (prefs->alarm_list_widget), "selection_changed", G_CALLBACK (alarms_selection_changed), prefs); - - g_signal_connect (G_OBJECT (prefs->template_url), "changed", G_CALLBACK (template_url_changed), prefs); -} - -/* Shows the current Free/Busy settings in the dialog */ -static void -show_fb_config (CalendarPrefsDialog *prefs) -{ - gchar *template_url; - - template_url = calendar_config_get_free_busy_template (); - gtk_entry_set_text (GTK_ENTRY (prefs->template_url), (template_url ? template_url : "")); - - g_free (template_url); } /* Shows the current task list settings in the dialog */ static void show_task_list_config (CalendarPrefsDialog *prefs) { - GtkColorButton *color_button; - GdkColor color; CalUnits units; gboolean hide_completed_tasks; - color_button = GTK_COLOR_BUTTON (prefs->tasks_due_today_color); - calendar_config_get_tasks_due_today_color (&color); - gtk_color_button_set_color (color_button, &color); - - color_button = GTK_COLOR_BUTTON (prefs->tasks_overdue_color); - calendar_config_get_tasks_overdue_color (&color); - gtk_color_button_set_color (color_button, &color); - /* Hide Completed Tasks. */ hide_completed_tasks = calendar_config_get_hide_completed_tasks (); e_dialog_toggle_set (prefs->tasks_hide_completed, hide_completed_tasks); @@ -660,39 +505,16 @@ show_alarms_config (CalendarPrefsDialog *prefs) static void show_config (CalendarPrefsDialog *prefs) { - CalWeekdays working_days; - gint mask, day, week_start_day, time_divisions; - icaltimezone *zone; - gboolean sensitive, set = FALSE; - gchar *location; + gint time_divisions; + gboolean set = FALSE; CalUnits units; gint interval; - /* Use system timezone */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (prefs->use_system_tz_check), calendar_config_get_use_system_timezone ()); - gtk_widget_set_sensitive (prefs->system_tz_label, FALSE); - update_system_tz_widgets (prefs); - - /* Timezone. */ - location = calendar_config_get_timezone_stored (); - zone = icaltimezone_get_builtin_timezone (location); - e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (prefs->timezone), zone); - g_free (location); - /* Day's second zone */ update_day_second_zone_caption (prefs); - /* Working Days. */ - working_days = calendar_config_get_working_days (); - mask = 1 << 0; - for (day = 0; day < 7; day++) { - e_dialog_toggle_set (prefs->working_days[day], (working_days & mask) ? TRUE : FALSE); - mask <<= 1; - } - - /* Week Start Day. */ - week_start_day = calendar_config_get_week_start_day (); - e_dialog_combo_box_set (prefs->week_start_day, week_start_day, week_start_day_map); + /* Day's second zone */ + update_day_second_zone_caption (prefs); /* Start of Day. */ e_date_edit_set_time_of_day (E_DATE_EDIT (prefs->start_of_day), calendar_config_get_day_start_hour (), calendar_config_get_day_start_minute ()); @@ -700,32 +522,10 @@ show_config (CalendarPrefsDialog *prefs) /* End of Day. */ e_date_edit_set_time_of_day (E_DATE_EDIT (prefs->end_of_day), calendar_config_get_day_end_hour (), calendar_config_get_day_end_minute ()); - /* 12/24 Hour Format. */ - if (calendar_config_get_24_hour_format ()) - e_dialog_toggle_set (prefs->use_24_hour, TRUE); - else - e_dialog_toggle_set (prefs->use_12_hour, TRUE); - - sensitive = calendar_config_locale_supports_12_hour_format (); - gtk_widget_set_sensitive (prefs->use_12_hour, sensitive); - gtk_widget_set_sensitive (prefs->use_24_hour, sensitive); - /* Time Divisions. */ time_divisions = calendar_config_get_time_divisions (); e_dialog_combo_box_set (prefs->time_divisions, time_divisions, time_division_map); - /* Show Appointment End Times. */ - e_dialog_toggle_set (prefs->show_end_times, calendar_config_get_show_event_end ()); - - /* Compress Weekend. */ - e_dialog_toggle_set (prefs->compress_weekend, calendar_config_get_compress_weekend ()); - - /* Date Navigator - Show Week Numbers. */ - e_dialog_toggle_set (prefs->dnav_show_week_no, calendar_config_get_dnav_show_week_no ()); - - /* Day/Work Week view - Show Week Number. */ - e_dialog_toggle_set (prefs->dview_show_week_no, calendar_config_get_dview_show_week_no ()); - /* Month View - Scroll by a week */ e_dialog_toggle_set (prefs->month_scroll_by_week, calendar_config_get_month_scroll_by_week ()); @@ -735,11 +535,7 @@ show_config (CalendarPrefsDialog *prefs) /* Alarms list*/ show_alarms_config (prefs); - /* Free/Busy */ - show_fb_config (prefs); - /* Other page */ - e_dialog_toggle_set (prefs->confirm_delete, calendar_config_get_confirm_delete ()); e_dialog_toggle_set (prefs->default_reminder, calendar_config_get_use_default_reminder ()); e_dialog_spin_set (prefs->default_reminder_interval, calendar_config_get_default_reminder_interval ()); e_dialog_combo_box_set (prefs->default_reminder_units, calendar_config_get_default_reminder_units (), default_reminder_units_map); @@ -774,25 +570,26 @@ eccp_free (EConfig *ec, GSList *items, gpointer data) } static void -calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) +calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs, + EShell *shell) { GladeXML *gui; ECalConfig *ec; ECalConfigTargetPrefs *target; + EShellSettings *shell_settings; + gboolean locale_supports_12_hour_format; gint i; - GtkWidget *toplevel, *table; + GtkWidget *toplevel; + GtkWidget *widget; + GtkWidget *table; GSList *l; - const gchar *working_day_names[] = { - "sun_button", - "mon_button", - "tue_button", - "wed_button", - "thu_button", - "fri_button", - "sat_button", - }; gchar *gladefile; + shell_settings = e_shell_get_shell_settings (shell); + + locale_supports_12_hour_format = + calendar_config_locale_supports_12_hour_format (); + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "cal-prefs-dialog.glade", NULL); @@ -816,19 +613,97 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) l = g_slist_prepend (l, &eccp_items[i]); e_config_add_items ((EConfig *) ec, l, NULL, NULL, eccp_free, prefs); + widget = glade_xml_get_widget (gui, "use-system-tz-check"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-use-system-timezone", + G_OBJECT (widget), "active"); + g_signal_connect ( + G_OBJECT (shell_settings), "notify::cal-use-system-timezone", + G_CALLBACK (update_system_tz_widgets), prefs); + + widget = glade_xml_get_widget (gui, "timezone"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-timezone", + G_OBJECT (widget), "timezone"); + e_mutual_binding_new_with_negation ( + G_OBJECT (shell_settings), "cal-use-system-timezone", + G_OBJECT (widget), "sensitive"); + /* General tab */ - prefs->use_system_tz_check = glade_xml_get_widget (gui, "use-system-tz-check"); prefs->system_tz_label = glade_xml_get_widget (gui, "system-tz-label"); - prefs->timezone = glade_xml_get_widget (gui, "timezone"); prefs->day_second_zone = glade_xml_get_widget (gui, "day_second_zone"); - for (i = 0; i < 7; i++) - prefs->working_days[i] = glade_xml_get_widget (gui, working_day_names[i]); - prefs->week_start_day = glade_xml_get_widget (gui, "week_start_day"); - prefs->start_of_day = glade_xml_get_widget (gui, "start_of_day"); - prefs->end_of_day = glade_xml_get_widget (gui, "end_of_day"); - prefs->use_12_hour = glade_xml_get_widget (gui, "use_12_hour"); - prefs->use_24_hour = glade_xml_get_widget (gui, "use_24_hour"); - prefs->confirm_delete = glade_xml_get_widget (gui, "confirm_delete"); + + widget = glade_xml_get_widget (gui, "sun_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-sunday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "mon_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-monday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "tue_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-tuesday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "wed_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-wednesday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "thu_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-thursday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "fri_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-friday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "sat_button"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-working-days-saturday", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "week_start_day"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-week-start-day", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "start_of_day"); + prefs->start_of_day = widget; /* XXX delete this */ + if (locale_supports_12_hour_format) + e_binding_new ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (widget), "use-24-hour-format"); + + widget = glade_xml_get_widget (gui, "end_of_day"); + prefs->end_of_day = widget; /* XXX delete this */ + if (locale_supports_12_hour_format) + e_binding_new ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (widget), "use-24-hour-format"); + + widget = glade_xml_get_widget (gui, "use_12_hour"); + gtk_widget_set_sensitive (widget, locale_supports_12_hour_format); + e_mutual_binding_new_with_negation ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "use_24_hour"); + gtk_widget_set_sensitive (widget, locale_supports_12_hour_format); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "confirm_delete"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-confirm-delete", + G_OBJECT (widget), "active"); + prefs->default_reminder = glade_xml_get_widget (gui, "default_reminder"); prefs->default_reminder_interval = glade_xml_get_widget (gui, "default_reminder_interval"); prefs->default_reminder_units = glade_xml_get_widget (gui, "default_reminder_units"); @@ -838,13 +713,45 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) /* Display tab */ prefs->time_divisions = glade_xml_get_widget (gui, "time_divisions"); - prefs->show_end_times = glade_xml_get_widget (gui, "show_end_times"); - prefs->compress_weekend = glade_xml_get_widget (gui, "compress_weekend"); - prefs->dnav_show_week_no = glade_xml_get_widget (gui, "dnav_show_week_no"); - prefs->dview_show_week_no = glade_xml_get_widget (gui, "dview_show_week_no"); + + widget = glade_xml_get_widget (gui, "show_end_times"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-show-event-end-times", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "compress_weekend"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-compress-weekend", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "dnav_show_week_no"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-show-week-numbers", + G_OBJECT (widget), "active"); + + widget = glade_xml_get_widget (gui, "dview_show_week_no"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-day-view-show-week-numbers", + G_OBJECT (widget), "active"); + prefs->month_scroll_by_week = glade_xml_get_widget (gui, "month_scroll_by_week"); - prefs->tasks_due_today_color = glade_xml_get_widget (gui, "tasks_due_today_color"); - prefs->tasks_overdue_color = glade_xml_get_widget (gui, "tasks_overdue_color"); + + widget = glade_xml_get_widget (gui, "tasks_due_today_color"); + e_mutual_binding_new_full ( + G_OBJECT (shell_settings), "cal-tasks-color-due-today", + G_OBJECT (widget), "color", + e_binding_transform_string_to_color, + e_binding_transform_color_to_string, + (GDestroyNotify) NULL, NULL); + + widget = glade_xml_get_widget (gui, "tasks_overdue_color"); + e_mutual_binding_new_full ( + G_OBJECT (shell_settings), "cal-tasks-color-overdue", + G_OBJECT (widget), "color", + e_binding_transform_string_to_color, + e_binding_transform_color_to_string, + (GDestroyNotify) NULL, NULL); + prefs->tasks_hide_completed = glade_xml_get_widget (gui, "tasks_hide_completed"); prefs->tasks_hide_completed_interval = glade_xml_get_widget (gui, "tasks_hide_completed_interval"); prefs->tasks_hide_completed_units = glade_xml_get_widget (gui, "tasks_hide_completed_units"); @@ -854,7 +761,10 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) prefs->scrolled_window = glade_xml_get_widget (gui, "calendar-source-scrolled-window"); /* Free/Busy tab */ - prefs->template_url = glade_xml_get_widget (gui, "template_url"); + widget = glade_xml_get_widget (gui, "template_url"); + e_mutual_binding_new ( + G_OBJECT (shell_settings), "cal-free-busy-template", + G_OBJECT (widget), "text"); target = e_cal_config_target_new_prefs (ec, prefs->gconf); e_config_set_target ((EConfig *)ec, (EConfigTarget *) target); toplevel = e_config_create_widget ((EConfig *)ec); @@ -893,14 +803,18 @@ calendar_prefs_dialog_get_type (void) } GtkWidget * -calendar_prefs_dialog_new (void) +calendar_prefs_dialog_new (EShell *shell) { CalendarPrefsDialog *dialog; - dialog = (CalendarPrefsDialog *) g_object_new (calendar_prefs_dialog_get_type (), NULL); - calendar_prefs_dialog_construct (dialog); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); + + dialog = g_object_new (CALENDAR_TYPE_PREFS_DIALOG, NULL); + + /* FIXME Kill this function. */ + calendar_prefs_dialog_construct (dialog, shell); - return (GtkWidget *) dialog; + return GTK_WIDGET (dialog); } /* called by libglade to create our custom EDateEdit widgets. */ @@ -912,7 +826,6 @@ cal_prefs_dialog_create_time_edit (void) dedit = e_date_edit_new (); gtk_widget_show (GTK_WIDGET (dedit)); - e_date_edit_set_use_24_hour_format (E_DATE_EDIT (dedit), calendar_config_get_24_hour_format ()); e_date_edit_set_time_popup_range (E_DATE_EDIT (dedit), 0, 24); e_date_edit_set_show_date (E_DATE_EDIT (dedit), FALSE); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 611d4aabcc..ceaa379474 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -21,14 +21,33 @@ * */ -#ifndef _CAL_PREFS_DIALOG_H_ -#define _CAL_PREFS_DIALOG_H_ +#ifndef CAL_PREFS_DIALOG_H +#define CAL_PREFS_DIALOG_H #include <gtk/gtk.h> #include <glade/glade.h> #include <gconf/gconf-client.h> #include <libedataserverui/e-source-selector.h> -#include "evolution-config-control.h" +#include <shell/e-shell.h> + +/* Standard GObject macros */ +#define CALENDAR_TYPE_PREFS_DIALOG \ + (calendar_prefs_dialog_get_type ()) +#define CALENDAR_PREFS_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialog)) +#define CALENDAR_PREFS_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialogClass)) +#define CALENDAR_IS_PREFS_DIALOG(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), CALENDAR_TYPE_PREFS_DIALOG)) +#define CALENDAR_IS_PREFS_DIALOG_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), CALENDAR_TYPE_PREFS_DIALOG)) +#define CALENDAR_PREFS_DIALOG_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), CALENDAR_TYPE_PREFS_DIALOG, CalendarPrefsDialogClass)) G_BEGIN_DECLS @@ -43,16 +62,12 @@ struct _CalendarPrefsDialog { GConfClient *gconf; /* General tab */ - GtkWidget *use_system_tz_check; GtkWidget *system_tz_label; - GtkWidget *timezone; GtkWidget *day_second_zone; GtkWidget *working_days[7]; GtkWidget *week_start_day; GtkWidget *start_of_day; GtkWidget *end_of_day; - GtkWidget *use_12_hour; - GtkWidget *use_24_hour; GtkWidget *confirm_delete; GtkWidget *default_reminder; GtkWidget *default_reminder_interval; @@ -68,8 +83,6 @@ struct _CalendarPrefsDialog { GtkWidget *dnav_show_week_no; GtkWidget *dview_show_week_no; GtkWidget *month_scroll_by_week; - GtkWidget *tasks_due_today_color; - GtkWidget *tasks_overdue_color; GtkWidget *tasks_hide_completed; GtkWidget *tasks_hide_completed_interval; GtkWidget *tasks_hide_completed_units; @@ -96,9 +109,9 @@ struct _CalendarPrefsDialogClass { GtkVBoxClass parent; }; -GType calendar_prefs_dialog_get_type (void); -GtkWidget *calendar_prefs_dialog_new (void); +GType calendar_prefs_dialog_get_type (void); +GtkWidget * calendar_prefs_dialog_new (EShell *shell); G_END_DECLS -#endif /* _CAL_PREFS_DIALOG_H_ */ +#endif /* CAL_PREFS_DIALOG_H */ diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c index fa5d9a6583..6fc05d4a92 100644 --- a/calendar/gui/dialogs/comp-editor-util.c +++ b/calendar/gui/dialogs/comp-editor-util.c @@ -32,8 +32,9 @@ #include <glib/gi18n.h> #include <libedataserver/e-time-utils.h> #include <libecal/e-cal-time-util.h> +#include "e-util/e-binding.h" +#include "widgets/misc/e-dateedit.h" #include "../calendar-config.h" -#include "../e-date-edit-config.h" #include "../itip-utils.h" #include "comp-editor-util.h" @@ -205,16 +206,9 @@ comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label) gtk_label_set_text (GTK_LABEL (label), buffer); } -static void -date_edit_destroy_cb (EDateEdit *date_edit, gpointer data) -{ - EDateEditConfig *config = data; - - g_object_unref (config); -} - /** * comp_editor_new_date_edit: + * @shell_settings: an #EShellSettings * @show_date: Whether to show a date picker in the widget. * @show_time: Whether to show a time picker in the widget. * @make_time_insensitive: Whether the time field is made insensitive rather @@ -226,11 +220,14 @@ date_edit_destroy_cb (EDateEdit *date_edit, gpointer data) * Return value: A newly-created #EDateEdit widget. **/ GtkWidget * -comp_editor_new_date_edit (gboolean show_date, gboolean show_time, - gboolean make_time_insensitive) +comp_editor_new_date_edit (EShellSettings *shell_settings, + gboolean show_date, + gboolean show_time, + gboolean make_time_insensitive) { EDateEdit *dedit; - EDateEditConfig *config; + + g_return_val_if_fail (E_IS_SHELL_SETTINGS (shell_settings), NULL); dedit = E_DATE_EDIT (e_date_edit_new ()); @@ -242,8 +239,13 @@ comp_editor_new_date_edit (gboolean show_date, gboolean show_time, e_date_edit_set_make_time_insensitive (dedit, FALSE); #endif - config = e_date_edit_config_new (dedit); - g_signal_connect (G_OBJECT (dedit), "destroy", G_CALLBACK (date_edit_destroy_cb), config); + e_binding_new ( + G_OBJECT (shell_settings), "cal-show-week-numbers", + G_OBJECT (dedit), "show-week-numbers"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-week-start-day", + G_OBJECT (dedit), "week-start-day"); return GTK_WIDGET (dedit); } diff --git a/calendar/gui/dialogs/comp-editor-util.h b/calendar/gui/dialogs/comp-editor-util.h index cebb8f74c1..ec481fa457 100644 --- a/calendar/gui/dialogs/comp-editor-util.h +++ b/calendar/gui/dialogs/comp-editor-util.h @@ -26,6 +26,7 @@ #define _COMP_EDITOR_UTIL_H_ #include <gtk/gtk.h> +#include <shell/e-shell-settings.h> #include "comp-editor-page.h" #include "../e-meeting-attendee.h" @@ -34,8 +35,10 @@ void comp_editor_free_dates (CompEditorPageDates *dates); void comp_editor_date_label (CompEditorPageDates *dates, GtkWidget *label); -GtkWidget *comp_editor_new_date_edit (gboolean show_date, gboolean show_time, - gboolean make_time_insensitive); +GtkWidget * comp_editor_new_date_edit (EShellSettings *shell_settings, + gboolean show_date, + gboolean show_time, + gboolean make_time_insensitive); struct tm comp_editor_get_current_time (GtkObject *object, gpointer data); diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 5097c9f336..8995b0eddc 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -39,7 +39,7 @@ #include <e-util/e-dialog-utils.h> #include <e-util/e-util-private.h> #include <e-util/gconf-bridge.h> -#include <evolution-shell-component-utils.h> +#include <shell/e-shell.h> #include <camel/camel-url.h> #include <camel/camel-exception.h> @@ -61,7 +61,6 @@ #include "recur-comp.h" #include "comp-editor.h" #include "comp-editor-util.h" -#include "../e-cal-popup.h" #include "../calendar-config-keys.h" #include "cal-attachment-select-file.h" #include "widgets/misc/e-attachment-view.h" @@ -79,6 +78,9 @@ static gboolean comp_lite = FALSE; /* Private part of the CompEditor structure */ struct _CompEditorPrivate { + + gpointer shell; /* weak pointer */ + /* Client to use */ ECal *client; @@ -128,6 +130,7 @@ enum { PROP_CHANGED, PROP_CLIENT, PROP_FLAGS, + PROP_SHELL, PROP_SUMMARY }; @@ -136,7 +139,10 @@ static const gchar *ui = " <menubar action='main-menu'>" " <menu action='file-menu'>" " <menuitem action='save'/>" +" <separator/>" +" <menuitem action='print-preview'/>" " <menuitem action='print'/>" +" <separator/>" " <menuitem action='close'/>" " </menu>" " <menu action='edit-menu'>" @@ -173,8 +179,8 @@ static void close_dialog (CompEditor *editor); static void page_dates_changed_cb (CompEditor *editor, CompEditorPageDates *dates, CompEditorPage *page); -static void obj_modified_cb (ECal *client, GList *objs, gpointer data); -static void obj_removed_cb (ECal *client, GList *uids, gpointer data); +static void obj_modified_cb (ECal *client, GList *objs, CompEditor *editor); +static void obj_removed_cb (ECal *client, GList *uids, CompEditor *editor); G_DEFINE_TYPE (CompEditor, comp_editor, GTK_TYPE_WINDOW) @@ -183,7 +189,15 @@ enum { LAST_SIGNAL }; -static guint comp_editor_signals[LAST_SIGNAL] = { 0 }; +static guint signals[LAST_SIGNAL]; +static GList *active_editors; + +static void +comp_editor_weak_notify_cb (gpointer unused, + GObject *where_the_object_was) +{ + active_editors = g_list_remove (active_editors, where_the_object_was); +} static void attachment_store_changed_cb (CompEditor *editor) @@ -716,17 +730,22 @@ action_print_cb (GtkAction *action, CompEditor *editor) { CompEditorPrivate *priv = editor->priv; + GtkPrintOperationAction print_action; ECalComponent *comp; GList *l; - icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp); + icalcomponent *component; + icalcomponent *clone; comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp)); + component = e_cal_component_get_icalcomponent (priv->comp); + clone = icalcomponent_new_clone (component); + e_cal_component_set_icalcomponent (comp, clone); for (l = priv->pages; l != NULL; l = l->next) comp_editor_page_fill_component (l->data, comp); - print_comp (comp, priv->client, GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG); + print_action = GTK_PRINT_OPERATION_ACTION_PRINT_DIALOG; + print_comp (comp, priv->client, print_action); g_object_unref (comp); } @@ -736,15 +755,22 @@ action_print_preview_cb (GtkAction *action, CompEditor *editor) { CompEditorPrivate *priv = editor->priv; + GtkPrintOperationAction print_action; ECalComponent *comp; GList *l; - icalcomponent *icalcomp = e_cal_component_get_icalcomponent (priv->comp); + icalcomponent *component; + icalcomponent *clone; comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (icalcomp)); + component = e_cal_component_get_icalcomponent (priv->comp); + clone = icalcomponent_new_clone (component); + e_cal_component_set_icalcomponent (comp, clone); + for (l = priv->pages; l != NULL; l = l->next) comp_editor_page_fill_component (l->data, comp); - print_comp (comp, priv->client, TRUE); + + print_action = GTK_PRINT_OPERATION_ACTION_PREVIEW; + print_comp (comp, priv->client, print_action); g_object_unref (comp); } @@ -812,12 +838,10 @@ action_save_cb (GtkAction *action, if (e_cal_component_has_recurrences (priv->comp)) { if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor), delegated)) return; - } else if (e_cal_component_is_instance (priv->comp)) priv->mod = CALOBJ_MOD_THIS; comp = comp_editor_get_current_comp (editor, &correct); - e_cal_component_get_summary (comp, &text); g_object_unref (comp); @@ -1199,6 +1223,17 @@ comp_editor_setup_recent_menu (CompEditor *editor) } static void +comp_editor_set_shell (CompEditor *editor, + EShell *shell) +{ + g_return_if_fail (editor->priv->shell == NULL); + + editor->priv->shell = shell; + + g_object_add_weak_pointer (G_OBJECT (shell), &editor->priv->shell); +} + +static void comp_editor_set_property (GObject *object, guint property_id, const GValue *value, @@ -1223,6 +1258,12 @@ comp_editor_set_property (GObject *object, g_value_get_int (value)); return; + case PROP_SHELL: + comp_editor_set_shell ( + COMP_EDITOR (object), + g_value_get_object (value)); + return; + case PROP_SUMMARY: comp_editor_set_summary ( COMP_EDITOR (object), @@ -1258,6 +1299,12 @@ comp_editor_get_property (GObject *object, COMP_EDITOR (object))); return; + case PROP_SHELL: + g_value_set_object ( + value, comp_editor_get_shell ( + COMP_EDITOR (object))); + return; + case PROP_SUMMARY: g_value_set_string ( value, comp_editor_get_summary ( @@ -1275,6 +1322,12 @@ comp_editor_dispose (GObject *object) priv = COMP_EDITOR_GET_PRIVATE (object); + if (priv->shell != NULL) { + g_object_remove_weak_pointer ( + G_OBJECT (priv->shell), &priv->shell); + priv->shell = NULL; + } + if (priv->client) { g_object_unref (priv->client); priv->client = NULL; @@ -1333,42 +1386,39 @@ static void comp_editor_map (GtkWidget *widget) { CompEditor *editor = COMP_EDITOR (widget); - GConfBridge *bridge = gconf_bridge_get (); + GConfBridge *bridge; GtkAction *action; + const gchar *key; + + bridge = gconf_bridge_get (); /* Give subclasses a chance to construct their pages before * we fiddle with their widgets. That's why we don't do this * until after object construction. */ + key = "/apps/evolution/calendar/display/show_categories"; action = comp_editor_get_action (editor, "view-categories"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_CATEGORIES, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_role"; action = comp_editor_get_action (editor, "view-role"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_ROLE, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_rsvp"; action = comp_editor_get_action (editor, "view-rsvp"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_RSVP, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_status"; action = comp_editor_get_action (editor, "view-status"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_STATUS, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_timezone"; action = comp_editor_get_action (editor, "view-time-zone"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_TIMEZONE, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); + key = "/apps/evolution/calendar/display/show_type"; action = comp_editor_get_action (editor, "view-type"); - gconf_bridge_bind_property ( - bridge, CALENDAR_CONFIG_SHOW_TYPE, - G_OBJECT (action), "active"); + gconf_bridge_bind_property (bridge, key, G_OBJECT (action), "active"); /* Chain up to parent's map() method. */ GTK_WIDGET_CLASS (comp_editor_parent_class)->map (widget); @@ -1515,6 +1565,17 @@ comp_editor_class_init (CompEditorClass *class) g_object_class_install_property ( object_class, + PROP_SHELL, + g_param_spec_object ( + "shell", + NULL, + NULL, + E_TYPE_SHELL, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property ( + object_class, PROP_SUMMARY, g_param_spec_string ( "summary", @@ -1523,7 +1584,7 @@ comp_editor_class_init (CompEditorClass *class) NULL, G_PARAM_READWRITE)); - comp_editor_signals[OBJECT_CREATED] = + signals[OBJECT_CREATED] = g_signal_new ("object_created", G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, @@ -1547,11 +1608,18 @@ comp_editor_init (CompEditor *editor) GtkWidget *container; GtkWidget *widget; GtkWidget *scroll; + EShell *shell; gint n_targets; GError *error = NULL; editor->priv = priv = COMP_EDITOR_GET_PRIVATE (editor); + g_object_weak_ref ( + G_OBJECT (editor), (GWeakNotify) + comp_editor_weak_notify_cb, NULL); + + active_editors = g_list_prepend (active_editors, editor); + priv->pages = NULL; priv->changed = FALSE; priv->needs_send = FALSE; @@ -1734,6 +1802,10 @@ comp_editor_init (CompEditor *editor) g_signal_connect_swapped ( store, "row-inserted", G_CALLBACK (attachment_store_changed_cb), editor); + + /* FIXME Shell should be passed in. */ + shell = e_shell_get_default (); + e_shell_watch_window (shell, GTK_WINDOW (editor)); } static gboolean @@ -1815,7 +1887,18 @@ close_dialog (CompEditor *editor) gtk_widget_destroy (GTK_WIDGET (editor)); } - +gint +comp_editor_compare (CompEditor *editor_a, + CompEditor *editor_b) +{ + const gchar *uid_a = NULL; + const gchar *uid_b = NULL; + + e_cal_component_get_uid (editor_a->priv->comp, &uid_a); + e_cal_component_get_uid (editor_b->priv->comp, &uid_b); + + return g_strcmp0 (uid_a, uid_b); +} void comp_editor_set_existing_org (CompEditor *editor, gboolean existing_org) @@ -1901,6 +1984,14 @@ comp_editor_get_classification (CompEditor *editor) return gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action)); } +EShell * +comp_editor_get_shell (CompEditor *editor) +{ + g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); + + return editor->priv->shell; +} + void comp_editor_set_summary (CompEditor *editor, const gchar *summary) @@ -2010,7 +2101,7 @@ comp_editor_set_flags (CompEditor *editor, CompEditorFlags comp_editor_get_flags (CompEditor *editor) { - g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); + g_return_val_if_fail (IS_COMP_EDITOR (editor), 0); return editor->priv->flags; } @@ -2068,6 +2159,20 @@ comp_editor_get_managed_widget (CompEditor *editor, return widget; } +CompEditor * +comp_editor_find_instance (const gchar *uid) +{ + GList *link; + + g_return_val_if_fail (uid != NULL, NULL); + + link = g_list_find_custom ( + active_editors, uid, + (GCompareFunc) comp_editor_compare); + + return (link != NULL) ? link->data : NULL; +} + /** * comp_editor_set_needs_send: * @editor: A component editor @@ -2391,8 +2496,14 @@ fill_widgets (CompEditor *editor) EAttachmentStore *store; EAttachmentView *view; CompEditorPrivate *priv; - GList *l; GtkAction *action; + GList *iter; + + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); + store = e_attachment_view_get_store (view); + + view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); + store = e_attachment_view_get_store (view); view = E_ATTACHMENT_VIEW (editor->priv->attachment_view); store = e_attachment_view_get_store (view); @@ -2415,12 +2526,14 @@ fill_widgets (CompEditor *editor) } action = comp_editor_get_action (editor, "classify-public"); - g_signal_handlers_block_by_func (action, G_CALLBACK (action_classification_cb), editor); + g_signal_handlers_block_by_func ( + action, G_CALLBACK (action_classification_cb), editor); - for (l = priv->pages; l != NULL; l = l->next) - comp_editor_page_fill_widgets (l->data, priv->comp); + for (iter = priv->pages; iter != NULL; iter = iter->next) + comp_editor_page_fill_widgets (iter->data, priv->comp); - g_signal_handlers_unblock_by_func (action, G_CALLBACK (action_classification_cb), editor); + g_signal_handlers_unblock_by_func ( + action, G_CALLBACK (action_classification_cb), editor); } static void @@ -2836,9 +2949,10 @@ page_dates_changed_cb (CompEditor *editor, } static void -obj_modified_cb (ECal *client, GList *objects, gpointer data) +obj_modified_cb (ECal *client, + GList *objects, + CompEditor *editor) { - CompEditor *editor = COMP_EDITOR (data); CompEditorPrivate *priv; ECalComponent *comp = NULL; @@ -2871,12 +2985,11 @@ obj_modified_cb (ECal *client, GList *objects, gpointer data) } static void -obj_removed_cb (ECal *client, GList *uids, gpointer data) +obj_removed_cb (ECal *client, + GList *uids, + CompEditor *editor) { - CompEditor *editor = COMP_EDITOR (data); - CompEditorPrivate *priv; - - priv = editor->priv; + CompEditorPrivate *priv = editor->priv; if (changed_component_dialog ((GtkWindow *) editor, priv->comp, TRUE, priv->changed)) close_dialog (editor); diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index d95d496ffd..454f02b2e6 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -29,6 +29,7 @@ #include <libecal/e-cal.h> #include "../itip-utils.h" #include "comp-editor-page.h" +#include <shell/e-shell.h> /* Standard GObject macros */ #define TYPE_COMP_EDITOR \ @@ -88,6 +89,8 @@ typedef enum { } CompEditorFlags; GType comp_editor_get_type (void); +gint comp_editor_compare (CompEditor *editor_a, + CompEditor *editor_b); void comp_editor_set_changed (CompEditor *editor, gboolean changed); gboolean comp_editor_get_changed (CompEditor *editor); @@ -107,6 +110,7 @@ void comp_editor_set_classification (CompEditor *editor, ECalComponentClassification classification); ECalComponentClassification comp_editor_get_classification (CompEditor *editor); +EShell * comp_editor_get_shell (CompEditor *editor); void comp_editor_set_summary (CompEditor *editor, const gchar *summary); const gchar * comp_editor_get_summary (CompEditor *editor); @@ -150,9 +154,11 @@ GtkActionGroup * const gchar *group_name); GtkWidget * comp_editor_get_managed_widget (CompEditor *editor, const gchar *widget_path); +CompEditor * comp_editor_find_instance (const gchar *uid); void comp_editor_set_lite (gboolean status); gboolean comp_editor_get_lite (void); + G_END_DECLS #endif diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 7251123100..91c879928c 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -34,9 +34,9 @@ #include <glib/gi18n.h> #include <misc/e-dateedit.h> +#include <e-util/e-binding.h> #include <e-util/e-plugin-ui.h> #include <e-util/e-util-private.h> -#include <evolution-shell-component-utils.h> #include "event-page.h" #include "recurrence-page.h" @@ -249,15 +249,6 @@ static GtkActionEntry meeting_entries[] = { }; static void -event_editor_client_changed_cb (EventEditor *ee) -{ - ECal *client; - - client = comp_editor_get_client (COMP_EDITOR (ee)); - e_meeting_store_set_e_cal (ee->priv->model, client); -} - -static void event_editor_model_changed_cb (EventEditor *ee) { if (!ee->priv->updating) { @@ -370,6 +361,31 @@ event_editor_dispose (GObject *object) } static void +event_editor_constructed (GObject *object) +{ + EventEditorPrivate *priv; + EShellSettings *shell_settings; + EShell *shell; + + priv = EVENT_EDITOR_GET_PRIVATE (object); + + shell = comp_editor_get_shell (COMP_EDITOR (object)); + shell_settings = e_shell_get_shell_settings (shell); + + e_binding_new ( + G_OBJECT (object), "client", + G_OBJECT (priv->model), "client"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-free-busy-template", + G_OBJECT (priv->model), "free-busy-template"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-timezone", + G_OBJECT (priv->model), "timezone"); +} + +static void event_editor_show_categories (CompEditor *editor, gboolean visible) { @@ -446,6 +462,7 @@ event_editor_class_init (EventEditorClass *class) object_class = G_OBJECT_CLASS (class); object_class->constructor = event_editor_constructor; object_class->dispose = event_editor_dispose; + object_class->constructed = event_editor_constructed; editor_class = COMP_EDITOR_CLASS (class); editor_class->help_section = "usage-calendar-apts"; @@ -466,6 +483,7 @@ event_editor_init (EventEditor *ee) GtkUIManager *ui_manager; GtkActionGroup *action_group; GtkAction *action; + const gchar *id; GError *error = NULL; ee->priv = EVENT_EDITOR_GET_PRIVATE (ee); @@ -488,7 +506,10 @@ event_editor_init (EventEditor *ee) ui_manager = comp_editor_get_ui_manager (editor); gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error); - e_plugin_ui_register_manager ("event-editor", ui_manager, ee); + + id = "org.gnome.evolution.event-editor"; + e_plugin_ui_register_manager (ui_manager, id, ee); + e_plugin_ui_enable_manager (ui_manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); @@ -499,10 +520,6 @@ event_editor_init (EventEditor *ee) action = comp_editor_get_action (editor, "send-options"); gtk_action_set_visible (action, FALSE); - g_signal_connect ( - ee, "notify::client", - G_CALLBACK (event_editor_client_changed_cb), NULL); - g_signal_connect_swapped ( ee->priv->model, "row_changed", G_CALLBACK (event_editor_model_changed_cb), ee); @@ -637,7 +654,7 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboo ECal *client; gboolean result; - client = e_meeting_store_get_e_cal (priv->model); + client = e_meeting_store_get_client (priv->model); result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL, NULL, NULL, strip_alarms, FALSE); g_object_unref (comp); @@ -663,13 +680,16 @@ event_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gboo * editor could not be created. **/ CompEditor * -event_editor_new (ECal *client, CompEditorFlags flags) +event_editor_new (ECal *client, + EShell *shell, + CompEditorFlags flags) { g_return_val_if_fail (E_IS_CAL (client), NULL); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); return g_object_new ( TYPE_EVENT_EDITOR, - "flags", flags, "client", client, NULL); + "client", client, "flags", flags, "shell", shell, NULL); } void diff --git a/calendar/gui/dialogs/event-editor.h b/calendar/gui/dialogs/event-editor.h index 03afd6448a..abb8f0e659 100644 --- a/calendar/gui/dialogs/event-editor.h +++ b/calendar/gui/dialogs/event-editor.h @@ -66,6 +66,7 @@ struct _EventEditorClass { GType event_editor_get_type (void); CompEditor * event_editor_new (ECal *client, + EShell *shell, CompEditorFlags flags); void event_editor_show_meeting (EventEditor *ee); diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c index eb95245128..5a9b8ec47a 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -39,7 +39,6 @@ #include "common/authentication.h" #include "e-util/e-categories-config.h" #include "e-util/e-dialog-widgets.h" -#include "e-util/e-popup.h" #include "misc/e-dateedit.h" #include "misc/e-send-options.h" #include <libecal/e-cal-time-util.h> @@ -52,7 +51,6 @@ #include "../e-meeting-attendee.h" #include "../e-meeting-store.h" #include "../e-meeting-list-view.h" -#include "../e-cal-popup.h" #include "comp-editor.h" #include "comp-editor-util.h" #include "../e-alarm-list.h" @@ -384,9 +382,11 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD EventPagePrivate *priv = epage->priv; CompEditor *editor; ECal *client; + GtkAction *action; struct icaltimetype *start_tt, *end_tt, implied_tt; icaltimezone *start_zone = NULL, *def_zone = NULL; gboolean all_day_event, homezone=TRUE; + gboolean show_timezone; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); client = comp_editor_get_client (editor); @@ -458,7 +458,9 @@ update_time (EventPage *epage, ECalComponentDateTime *start_date, ECalComponentD if (!def_zone || !start_zone || strcmp (icaltimezone_get_tzid(def_zone), icaltimezone_get_tzid (start_zone))) homezone = FALSE; - event_page_set_show_timezone (epage, (calendar_config_get_show_timezone()|| !homezone) & !all_day_event); + action = comp_editor_get_action (editor, "view-time-zone"); + show_timezone = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + event_page_set_show_timezone (epage, (show_timezone || !homezone) & !all_day_event); /*unblock the endtimezone widget*/ g_signal_handlers_unblock_matched (priv->end_timezone, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); @@ -1833,15 +1835,10 @@ remove_clicked_cb (GtkButton *btn, EventPage *epage) } static void -invite_cb (GtkWidget *widget, gpointer data) +invite_cb (GtkWidget *widget, + EventPage *page) { - EventPage *page; - EventPagePrivate *priv; - - page = EVENT_PAGE (data); - priv = page->priv; - - e_meeting_list_view_invite_others_dialog (priv->list_view); + e_meeting_list_view_invite_others_dialog (page->priv->list_view); } static void @@ -1884,102 +1881,6 @@ attendee_added_cb (EMeetingListView *emlv, } } -/* Callbacks for list view*/ -static void -popup_add_cb (EPopup *ep, EPopupItem *pitem, gpointer data) -{ - EventPage *epage = data; - - add_clicked_cb (NULL, epage); -} - -static void -popup_delete_cb (EPopup *ep, EPopupItem *pitem, gpointer data) -{ - EventPage *epage = data; - - remove_clicked_cb (NULL, epage); -} - -enum { - ATTENDEE_CAN_DELEGATE = 1<<1, - ATTENDEE_CAN_DELETE = 1<<2, - ATTENDEE_CAN_ADD = 1<<3, - ATTENDEE_LAST = 1<<4 -}; - -static EPopupItem context_menu_items[] = { - { E_POPUP_ITEM, (gchar *) "10.delete", (gchar *) N_("_Remove"), popup_delete_cb, NULL, (gchar *) GTK_STOCK_REMOVE, ATTENDEE_CAN_DELETE }, - { E_POPUP_ITEM, (gchar *) "15.add", (gchar *) N_("_Add "), popup_add_cb, NULL, (gchar *) GTK_STOCK_ADD, ATTENDEE_CAN_ADD }, -}; - -static void -context_popup_free(EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free(items); -} - -static gint -button_press_event (GtkWidget *widget, GdkEventButton *event, EventPage *epage) -{ - EventPagePrivate *priv = epage->priv; - CompEditor *editor; - CompEditorFlags flags; - GtkMenu *menu; - EMeetingAttendee *ia; - GtkTreePath *path; - GtkTreeIter iter; - gchar *address; - guint32 disable_mask = ~0; - GSList *menus = NULL; - ECalPopup *ep; - gint i; - - /* only process right-clicks */ - if (event->button != 3 || event->type != GDK_BUTTON_PRESS) - return FALSE; - - editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); - flags = comp_editor_get_flags (editor); - - /* only if we right-click on an attendee */ - if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->list_view), event->x, event->y, &path, NULL, NULL, NULL)) { - GtkTreeSelection *selection; - - if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path)) { - - gtk_tree_model_get (GTK_TREE_MODEL (priv->model), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1); - ia = e_meeting_store_find_attendee (priv->model, address, &priv->row); - g_free (address); - - if (ia) { - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->list_view)); - gtk_tree_selection_unselect_all (selection); - gtk_tree_selection_select_path (selection, path); - - if (e_meeting_attendee_get_edit_level (ia) == E_MEETING_ATTENDEE_EDIT_FULL) - disable_mask &= ~ATTENDEE_CAN_DELETE; - } - } - } - - if (GTK_WIDGET_IS_SENSITIVE(priv->add)) - disable_mask &= ~ATTENDEE_CAN_ADD; - else if (flags & COMP_EDITOR_USER_ORG) - disable_mask &= ~ATTENDEE_CAN_ADD; - - ep = e_cal_popup_new("org.gnome.evolution.calendar.meeting.popup"); - - for (i=0;i<sizeof(context_menu_items)/sizeof(context_menu_items[0]);i++) - menus = g_slist_prepend(menus, &context_menu_items[i]); - - e_popup_add_items((EPopup *)ep, menus, NULL, context_popup_free, epage); - menu = e_popup_create_menu_once((EPopup *)ep, NULL, disable_mask); - gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time); - - return TRUE; -} - static gboolean list_view_event (EMeetingListView *list_view, GdkEvent *event, EventPage *epage) { @@ -2032,6 +1933,7 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day) CompEditor *editor; GtkAction *action; gboolean date_set; + gboolean active; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); @@ -2110,7 +2012,10 @@ event_page_set_all_day_event (EventPage *epage, gboolean all_day) TRUE); } - event_page_set_show_timezone (epage, calendar_config_get_show_timezone() & !all_day); + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + event_page_set_show_timezone (epage, active & !all_day); + g_signal_handlers_block_matched (priv->start_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); g_signal_handlers_block_matched (priv->end_time, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, epage); @@ -2192,10 +2097,12 @@ event_page_set_info_string (EventPage *epage, const gchar *icon, const gchar *ms static gboolean get_widgets (EventPage *epage) { + CompEditor *editor; CompEditorPage *page = COMP_EDITOR_PAGE (epage); GtkEntryCompletion *completion; EventPagePrivate *priv; GSList *accel_groups; + GtkAction *action; GtkWidget *toplevel; GtkWidget *sw; @@ -2203,6 +2110,8 @@ get_widgets (EventPage *epage) #define GW(name) glade_xml_get_widget (priv->xml, name) + editor = comp_editor_page_get_editor (page); + priv->main = GW ("event-page"); if (!priv->main) return FALSE; @@ -2224,7 +2133,8 @@ get_widgets (EventPage *epage) gtk_widget_show (priv->status_icons); - if (!calendar_config_get_show_timezone()) { + action = comp_editor_get_action (editor, "view-time-zone"); + if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { gtk_widget_hide (priv->timezone_label); gtk_widget_hide (priv->start_timezone); } else { @@ -2503,14 +2413,10 @@ times_updated (EventPage *epage, gboolean adjust_end_time) * start date < end date and we set the "all day event" button as appropriate. */ static void -start_date_changed_cb (GtkWidget *dedit, gpointer data) +start_date_changed_cb (GtkWidget *dedit, + EventPage *epage) { - EventPage *epage; - - epage = EVENT_PAGE (data); - hour_minute_changed (epage); - times_updated (epage, TRUE); } @@ -2518,12 +2424,9 @@ start_date_changed_cb (GtkWidget *dedit, gpointer data) * start date < end date and we set the "all day event" button as appropriate. */ static void -end_date_changed_cb (GtkWidget *dedit, gpointer data) +end_date_changed_cb (GtkWidget *dedit, + EventPage *epage) { - EventPage *epage; - - epage = EVENT_PAGE (data); - times_updated (epage, FALSE); } @@ -2532,15 +2435,12 @@ end_date_changed_cb (GtkWidget *dedit, gpointer data) * labels on the other notebook pages. */ static void -start_timezone_changed_cb (GtkWidget *widget, gpointer data) +start_timezone_changed_cb (GtkWidget *widget, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; + EventPagePrivate *priv = epage->priv; icaltimezone *zone; - epage = EVENT_PAGE (data); - priv = epage->priv; - if (priv->sync_timezones) { zone = e_timezone_entry_get_timezone (E_TIMEZONE_ENTRY (priv->start_timezone)); comp_editor_page_set_updating (COMP_EDITOR_PAGE (epage), TRUE); @@ -2557,17 +2457,13 @@ start_timezone_changed_cb (GtkWidget *widget, gpointer data) * category list dialog. */ static void -categories_clicked_cb (GtkWidget *button, gpointer data) +categories_clicked_cb (GtkWidget *button, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; - GtkWidget *entry; - - epage = EVENT_PAGE (data); - priv = epage->priv; + GtkEntry *entry; - entry = priv->categories; - e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); + entry = GTK_ENTRY (epage->priv->categories); + e_categories_config_open_dialog_for_entry (entry); } void @@ -2692,13 +2588,10 @@ set_subscriber_info_string (EventPage *epage, const gchar *backend_address) } static void -alarm_changed_cb (GtkWidget *widget, gpointer data) +alarm_changed_cb (GtkWidget *widget, + EventPage *epage) { - EventPage *epage; - EventPagePrivate *priv; - - epage = EVENT_PAGE (data); - priv = epage->priv; + EventPagePrivate *priv = epage->priv; if (e_dialog_combo_box_get (priv->alarm_time_combo, priv->alarm_map) != ALARM_NONE) { ECalComponentAlarm *ca; @@ -2840,7 +2733,9 @@ init_widgets (EventPage *epage) GtkTextBuffer *text_buffer; icaltimezone *zone; gchar *combo_label = NULL; + GtkAction *action; GtkTreeSelection *selection; + gboolean active; ECal *client; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); @@ -2896,16 +2791,32 @@ init_widgets (EventPage *epage) g_signal_connect((priv->start_timezone), "changed", G_CALLBACK (start_timezone_changed_cb), epage); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, calendar_config_get_show_role ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, calendar_config_get_show_rsvp ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, calendar_config_get_show_status ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, calendar_config_get_show_type ()); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); + + action = comp_editor_get_action (editor, "view-role"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ROLE_COL, active); + + action = comp_editor_get_action (editor, "view-rsvp"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_RSVP_COL, active); + + action = comp_editor_get_action (editor, "view-status"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_STATUS_COL, active); + + action = comp_editor_get_action (editor, "view-type"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_TYPE_COL, active); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->list_view)); gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); - g_signal_connect (G_OBJECT (priv->list_view), "button_press_event", G_CALLBACK (button_press_event), epage); g_signal_connect (G_OBJECT (priv->list_view), "event", G_CALLBACK (list_view_event), epage); g_signal_connect (priv->list_view, "key_press_event", G_CALLBACK (list_key_press), epage); @@ -2936,7 +2847,8 @@ init_widgets (EventPage *epage) gtk_widget_show (GTK_WIDGET (priv->list_view)); /* categories */ - if (!calendar_config_get_show_categories()) { + action = comp_editor_get_action (editor, "view-categories"); + if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action))) { gtk_widget_hide (priv->categories_btn); gtk_widget_hide (priv->categories); } else { @@ -3030,7 +2942,9 @@ init_widgets (EventPage *epage) e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->start_timezone), zone); e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->end_timezone), zone); - event_page_set_show_timezone (epage, calendar_config_get_show_timezone()); + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + event_page_set_show_timezone (epage, active); return TRUE; } @@ -3194,7 +3108,13 @@ GtkWidget *make_date_edit (void); GtkWidget * make_date_edit (void) { - return comp_editor_new_date_edit (TRUE, TRUE, TRUE); + EShell *shell; + EShellSettings *shell_settings; + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + return comp_editor_new_date_edit (shell_settings, TRUE, TRUE, TRUE); } GtkWidget *make_timezone_entry (void); diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index cf3781a3c2..bda54e55eb 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -34,7 +34,6 @@ #include <e-util/e-plugin-ui.h> #include <e-util/e-util-private.h> -#include <evolution-shell-component-utils.h> #include "memo-page.h" #include "cancel-comp.h" @@ -135,6 +134,7 @@ memo_editor_init (MemoEditor *me) { CompEditor *editor = COMP_EDITOR (me); GtkUIManager *ui_manager; + const gchar *id; GError *error = NULL; me->priv = MEMO_EDITOR_GET_PRIVATE (me); @@ -142,7 +142,10 @@ memo_editor_init (MemoEditor *me) ui_manager = comp_editor_get_ui_manager (editor); gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error); - e_plugin_ui_register_manager ("memo-editor", ui_manager, me); + + id = "org.gnome.evolution.memo-editor"; + e_plugin_ui_register_manager (ui_manager, id, me); + e_plugin_ui_enable_manager (ui_manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); @@ -160,11 +163,14 @@ memo_editor_init (MemoEditor *me) * editor could not be created. **/ CompEditor * -memo_editor_new (ECal *client, CompEditorFlags flags) +memo_editor_new (ECal *client, + EShell *shell, + CompEditorFlags flags) { g_return_val_if_fail (E_IS_CAL (client), NULL); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); return g_object_new ( TYPE_MEMO_EDITOR, - "flags", flags, "client", client, NULL); + "client", client, "flags", flags, "shell", shell, NULL); } diff --git a/calendar/gui/dialogs/memo-editor.h b/calendar/gui/dialogs/memo-editor.h index 2e431b507f..cd4bc194ac 100644 --- a/calendar/gui/dialogs/memo-editor.h +++ b/calendar/gui/dialogs/memo-editor.h @@ -68,6 +68,7 @@ struct _MemoEditorClass { GType memo_editor_get_type (void); CompEditor * memo_editor_new (ECal *client, + EShell *shell, CompEditorFlags flags); G_END_DECLS diff --git a/calendar/gui/dialogs/memo-page.c b/calendar/gui/dialogs/memo-page.c index 8026a467ee..595a0e409e 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -948,9 +948,14 @@ to_button_clicked_cb (GtkButton *button, static gboolean init_widgets (MemoPage *mpage) { + CompEditor *editor; MemoPagePrivate *priv = mpage->priv; GtkTextBuffer *buffer; GtkTextView *view; + GtkAction *action; + gboolean active; + + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (mpage)); /* Generic informative messages */ gtk_widget_hide (priv->info_hbox); @@ -1015,8 +1020,9 @@ init_widgets (MemoPage *mpage) G_CALLBACK (comp_editor_page_changed), mpage); } - memo_page_set_show_categories ( - mpage, calendar_config_get_show_categories()); + action = comp_editor_get_action (editor, "view-categories"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + memo_page_set_show_categories (mpage, active); return TRUE; } @@ -1215,9 +1221,14 @@ GtkWidget *memo_page_create_date_edit (void); GtkWidget * memo_page_create_date_edit (void) { + EShell *shell; + EShellSettings *shell_settings; GtkWidget *widget; - widget = comp_editor_new_date_edit (TRUE, FALSE, TRUE); + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + widget = comp_editor_new_date_edit (shell_settings, TRUE, FALSE, TRUE); e_date_edit_set_allow_no_date_set (E_DATE_EDIT (widget), TRUE); gtk_widget_show (widget); diff --git a/calendar/gui/dialogs/memo-page.glade b/calendar/gui/dialogs/memo-page.glade index b1ff10f3f4..8728c9366e 100644 --- a/calendar/gui/dialogs/memo-page.glade +++ b/calendar/gui/dialogs/memo-page.glade @@ -159,6 +159,7 @@ <widget class="GtkLabel" id="label18"> <property name="visible">True</property> <property name="label" translatable="yes">_Description:</property> + <property name="mnemonic_widget">memo_content</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_CENTER</property> diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c index 385b4eeea0..ca53a41737 100644 --- a/calendar/gui/dialogs/recurrence-page.c +++ b/calendar/gui/dialogs/recurrence-page.c @@ -34,6 +34,7 @@ #include <glib/gi18n.h> #include <glade/glade.h> #include <libedataserver/e-time-utils.h> +#include <e-util/e-binding.h> #include <e-util/e-dialog-widgets.h> #include <e-util/e-util-private.h> #include <misc/e-dateedit.h> @@ -44,7 +45,6 @@ #include "../weekday-picker.h" #include "comp-editor-util.h" #include "../e-date-time-list.h" -#include "../e-mini-calendar-config.h" #include "recurrence-page.h" #define RECURRENCE_PAGE_GET_PRIVATE(obj) \ @@ -188,7 +188,6 @@ struct _RecurrencePagePrivate { /* For the recurrence preview, the actual widget */ GtkWidget *preview_calendar; - EMiniCalendarConfig *preview_calendar_config; }; @@ -323,11 +322,6 @@ recurrence_page_dispose (GObject *object) priv->exception_list_store = NULL; } - if (priv->preview_calendar_config != NULL) { - g_object_unref (priv->preview_calendar_config); - priv->preview_calendar_config = NULL; - } - /* Chain up to parent's dispose() method. */ G_OBJECT_CLASS (recurrence_page_parent_class)->dispose (object); } @@ -1338,6 +1332,8 @@ static void make_ending_until_special (RecurrencePage *rpage) { RecurrencePagePrivate *priv = rpage->priv; + EShell *shell; + EShellSettings *shell_settings; CompEditor *editor; CompEditorFlags flags; EDateEdit *de; @@ -1349,10 +1345,13 @@ make_ending_until_special (RecurrencePage *rpage) editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); flags = comp_editor_get_flags (editor); + shell = comp_editor_get_shell (editor); + shell_settings = e_shell_get_shell_settings (shell); + /* Create the widget */ - priv->ending_date_edit = comp_editor_new_date_edit (TRUE, FALSE, - FALSE); + priv->ending_date_edit = comp_editor_new_date_edit ( + shell_settings, TRUE, FALSE, FALSE); de = E_DATE_EDIT (priv->ending_date_edit); gtk_container_add (GTK_CONTAINER (priv->ending_special), @@ -2077,9 +2076,16 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget ** { RecurrencePagePrivate *priv; GtkWidget *dialog, *toplevel; + CompEditor *editor; + EShell *shell; + EShellSettings *shell_settings; priv = rpage->priv; + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); + shell = comp_editor_get_shell (editor); + shell_settings = e_shell_get_shell_settings (shell); + toplevel = gtk_widget_get_toplevel (priv->main); dialog = gtk_dialog_new_with_buttons (title, GTK_WINDOW (toplevel), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, @@ -2087,7 +2093,7 @@ create_exception_dialog (RecurrencePage *rpage, const gchar *title, GtkWidget ** GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); - *date_edit = comp_editor_new_date_edit (TRUE, FALSE, TRUE); + *date_edit = comp_editor_new_date_edit (shell_settings, TRUE, FALSE, TRUE); gtk_widget_show (*date_edit); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), *date_edit, FALSE, TRUE, 6); @@ -2243,6 +2249,9 @@ static void init_widgets (RecurrencePage *rpage) { RecurrencePagePrivate *priv; + EShell *shell; + EShellSettings *shell_settings; + CompEditor *editor; ECalendar *ecal; GtkAdjustment *adj; GtkTreeViewColumn *column; @@ -2250,11 +2259,23 @@ init_widgets (RecurrencePage *rpage) priv = rpage->priv; + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (rpage)); + shell = comp_editor_get_shell (editor); + shell_settings = e_shell_get_shell_settings (shell); + /* Recurrence preview */ priv->preview_calendar = e_calendar_new (); ecal = E_CALENDAR (priv->preview_calendar); - priv->preview_calendar_config = e_mini_calendar_config_new (ecal); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-show-week-numbers", + G_OBJECT (ecal->calitem), "show-week-numbers"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-week-start-day", + G_OBJECT (ecal->calitem), "week-start-day"); + g_signal_connect((ecal->calitem), "date_range_changed", G_CALLBACK (preview_date_range_changed_cb), rpage); @@ -2401,6 +2422,12 @@ GtkWidget *make_exdate_date_edit (void); GtkWidget * make_exdate_date_edit (void) { - return comp_editor_new_date_edit (TRUE, TRUE, FALSE); + EShell *shell; + EShellSettings *shell_settings; + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + return comp_editor_new_date_edit (shell_settings, TRUE, TRUE, FALSE); } diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c index 712d2708b9..5a7277084b 100644 --- a/calendar/gui/dialogs/schedule-page.c +++ b/calendar/gui/dialogs/schedule-page.c @@ -32,6 +32,7 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <glade/glade.h> +#include <e-util/e-binding.h> #include <e-util/e-dialog-widgets.h> #include <e-util/e-util-private.h> #include <misc/e-dateedit.h> @@ -218,7 +219,7 @@ update_time (SchedulePage *spage, ECalComponentDateTime *start_date, ECalCompone if (start_zone != end_zone) { icaltimezone_convert_time (&end_tt, end_zone, start_zone); } - e_meeting_store_set_zone (priv->model, priv->zone); + e_meeting_store_set_timezone (priv->model, priv->zone); all_day = (start_tt.is_date && end_tt.is_date) ? TRUE : FALSE; @@ -385,10 +386,14 @@ SchedulePage * schedule_page_construct (SchedulePage *spage, EMeetingStore *ems) { SchedulePagePrivate *priv = spage->priv; + EShellSettings *shell_settings; + EShell *shell; CompEditor *editor; gchar *gladefile; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (spage)); + shell = comp_editor_get_shell (editor); + shell_settings = e_shell_get_shell_settings (shell); gladefile = g_build_filename (EVOLUTION_GLADEDIR, "schedule-page.glade", @@ -423,6 +428,18 @@ schedule_page_construct (SchedulePage *spage, EMeetingStore *ems) gtk_widget_show (GTK_WIDGET (priv->sel)); gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->sel), TRUE, TRUE, 6); + e_binding_new ( + G_OBJECT (shell_settings), "cal-show-week-numbers", + G_OBJECT (priv->sel), "show-week-numbers"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-use-24-hour-format", + G_OBJECT (priv->sel), "use-24-hour-format"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-week-start-day", + G_OBJECT (priv->sel), "week-start-day"); + if (!init_widgets (spage)) { g_message ("schedule_page_construct(): " "Could not initialize the widgets!"); diff --git a/calendar/gui/dialogs/task-details-page.c b/calendar/gui/dialogs/task-details-page.c index 8c63c4dd02..38faa99c0b 100644 --- a/calendar/gui/dialogs/task-details-page.c +++ b/calendar/gui/dialogs/task-details-page.c @@ -515,16 +515,15 @@ complete_date_changed (TaskDetailsPage *tdpage, time_t ctime, gboolean complete) } static void -date_changed_cb (EDateEdit *dedit, gpointer data) +date_changed_cb (EDateEdit *dedit, + TaskDetailsPage *tdpage) { - TaskDetailsPage *tdpage; - TaskDetailsPagePrivate *priv; + TaskDetailsPagePrivate *priv = tdpage->priv; CompEditorPageDates dates = {NULL, NULL, NULL, NULL}; struct icaltimetype completed_tt = icaltime_null_time (); icalproperty_status status; gboolean date_set; - tdpage = TASK_DETAILS_PAGE (data); priv = tdpage->priv; if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tdpage))) @@ -769,9 +768,14 @@ GtkWidget *task_details_page_create_date_edit (void); GtkWidget * task_details_page_create_date_edit (void) { + EShell *shell; + EShellSettings *shell_settings; GtkWidget *dedit; - dedit = comp_editor_new_date_edit (TRUE, TRUE, FALSE); + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + dedit = comp_editor_new_date_edit (shell_settings, TRUE, TRUE, FALSE); e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE); return dedit; diff --git a/calendar/gui/dialogs/task-details-page.glade b/calendar/gui/dialogs/task-details-page.glade index 44fc3b2fbb..aac90876ed 100644 --- a/calendar/gui/dialogs/task-details-page.glade +++ b/calendar/gui/dialogs/task-details-page.glade @@ -4,7 +4,7 @@ <glade-interface> <widget class="GtkWindow" id="task-details-toplevel"> - <property name="title">window1</property> + <property name="title" translatable="no">window1</property> <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_NONE</property> <property name="modal">False</property> @@ -15,8 +15,6 @@ <property name="skip_pager_hint">False</property> <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - <property name="focus_on_map">True</property> - <property name="urgency_hint">False</property> <child> <widget class="GtkVBox" id="task-details-page"> @@ -38,10 +36,6 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -69,10 +63,6 @@ <property name="yalign">0.5</property> <property name="xpad">12</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -103,10 +93,7 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> + <property name="mnemonic_widget">status</property> </widget> <packing> <property name="left_attach">0</property> @@ -132,10 +119,6 @@ <property name="xpad">0</property> <property name="ypad">0</property> <property name="mnemonic_widget">percent-complete</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="left_attach">0</property> @@ -160,10 +143,7 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> + <property name="mnemonic_widget">priority</property> </widget> <packing> <property name="left_attach">0</property> @@ -188,10 +168,6 @@ <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="left_attach">0</property> @@ -204,85 +180,153 @@ </child> <child> - <widget class="GtkSpinButton" id="percent-complete"> + <widget class="GtkOptionMenu" id="priority"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="climb_rate">1</property> - <property name="digits">0</property> - <property name="numeric">True</property> - <property name="update_policy">GTK_UPDATE_ALWAYS</property> - <property name="snap_to_ticks">False</property> - <property name="wrap">False</property> - <property name="adjustment">0 0 100 1 10 0</property> + <property name="history">0</property> + + <child internal-child="menu"> + <widget class="GtkMenu" id="convertwidget7"> + <property name="visible">True</property> + + <child> + <widget class="GtkMenuItem" id="convertwidget8"> + <property name="visible">True</property> + <property name="label" translatable="yes">High</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget9"> + <property name="visible">True</property> + <property name="label" translatable="yes">Normal</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget10"> + <property name="visible">True</property> + <property name="label" translatable="yes">Low</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget11"> + <property name="visible">True</property> + <property name="label" translatable="yes">Undefined</property> + <property name="use_underline">True</property> + </widget> + </child> + </widget> + </child> </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="top_attach">2</property> + <property name="bottom_attach">3</property> <property name="x_options">fill</property> <property name="y_options"></property> </packing> </child> <child> - <widget class="Custom" id="completed-date"> + <widget class="GtkOptionMenu" id="status"> <property name="visible">True</property> - <property name="creation_function">task_details_page_create_date_edit</property> - <property name="int1">0</property> - <property name="int2">0</property> - <property name="last_modification_time">Fri, 01 Jun 2001 18:58:51 GMT</property> - <accessibility> - <atkrelation target="date_completed_label" type="labelled-by"/> - </accessibility> + <property name="can_focus">True</property> + <property name="history">0</property> + + <child internal-child="menu"> + <widget class="GtkMenu" id="convertwidget1"> + <property name="visible">True</property> + + <child> + <widget class="GtkMenuItem" id="convertwidget2"> + <property name="visible">True</property> + <property name="label" translatable="yes">Not Started</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget3"> + <property name="visible">True</property> + <property name="label" translatable="yes">In Progress</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget5"> + <property name="visible">True</property> + <property name="label" translatable="yes">Completed</property> + <property name="use_underline">True</property> + </widget> + </child> + + <child> + <widget class="GtkMenuItem" id="convertwidget6"> + <property name="visible">True</property> + <property name="label" translatable="yes">Canceled</property> + <property name="use_underline">True</property> + </widget> + </child> + </widget> + </child> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">3</property> - <property name="bottom_attach">4</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="GtkComboBox" id="priority-combobox"> + <widget class="GtkSpinButton" id="percent-complete"> <property name="visible">True</property> - <property name="items" translatable="yes">High -Normal -Low -Undefined</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> + <property name="can_focus">True</property> + <property name="climb_rate">1</property> + <property name="digits">0</property> + <property name="numeric">True</property> + <property name="update_policy">GTK_UPDATE_ALWAYS</property> + <property name="snap_to_ticks">False</property> + <property name="wrap">False</property> + <property name="adjustment">0 0 100 1 10 0</property> </widget> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">2</property> - <property name="bottom_attach">3</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> <property name="x_options">fill</property> - <property name="y_options">fill</property> + <property name="y_options"></property> </packing> </child> <child> - <widget class="GtkComboBox" id="status-combobox"> + <widget class="Custom" id="completed-date"> <property name="visible">True</property> - <property name="items" translatable="yes">Not Started -In Progress -Completed -Canceled</property> - <property name="add_tearoffs">False</property> - <property name="focus_on_click">True</property> + <property name="creation_function">task_details_page_create_date_edit</property> + <property name="int1">0</property> + <property name="int2">0</property> + <property name="last_modification_time">Fri, 01 Jun 2001 18:58:51 GMT</property> + <accessibility> + <atkrelation target="date_completed_label" type="labelled-by"/> + </accessibility> </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="top_attach">3</property> + <property name="bottom_attach">4</property> <property name="x_options">fill</property> - <property name="y_options">fill</property> + <property name="y_options"></property> </packing> </child> </widget> @@ -313,10 +357,6 @@ Canceled</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -344,10 +384,6 @@ Canceled</property> <property name="yalign">0.5</property> <property name="xpad">12</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="padding">0</property> @@ -379,10 +415,6 @@ Canceled</property> <property name="yalign">0.5</property> <property name="xpad">0</property> <property name="ypad">0</property> - <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> - <property name="width_chars">-1</property> - <property name="single_line_mode">False</property> - <property name="angle">0</property> </widget> <packing> <property name="left_attach">0</property> diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 0ca6ff5a3d..edd54859d6 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -33,9 +33,9 @@ #include <glade/glade.h> #include <glib/gi18n.h> -#include <e-util/e-plugin-ui.h> -#include <e-util/e-util-private.h> -#include <evolution-shell-component-utils.h> +#include "e-util/e-binding.h" +#include "e-util/e-plugin-ui.h" +#include "e-util/e-util-private.h" #include "task-page.h" #include "task-details-page.h" @@ -127,15 +127,6 @@ static GtkActionEntry assigned_task_entries[] = { }; static void -task_editor_client_changed_cb (TaskEditor *te) -{ - ECal *client; - - client = comp_editor_get_client (COMP_EDITOR (te)); - e_meeting_store_set_e_cal (te->priv->model, client); -} - -static void task_editor_model_changed_cb (TaskEditor *te) { if (!te->priv->updating) { @@ -209,6 +200,31 @@ task_editor_dispose (GObject *object) } static void +task_editor_constructed (GObject *object) +{ + TaskEditorPrivate *priv; + EShellSettings *shell_settings; + EShell *shell; + + priv = TASK_EDITOR_GET_PRIVATE (object); + + shell = comp_editor_get_shell (COMP_EDITOR (object)); + shell_settings = e_shell_get_shell_settings (shell); + + e_binding_new ( + G_OBJECT (object), "client", + G_OBJECT (priv->model), "client"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-free-busy-template", + G_OBJECT (priv->model), "free-busy-template"); + + e_binding_new ( + G_OBJECT (shell_settings), "cal-timezone", + G_OBJECT (priv->model), "timezone"); +} + +static void task_editor_show_categories (CompEditor *editor, gboolean visible) { @@ -285,6 +301,7 @@ task_editor_class_init (TaskEditorClass *class) object_class = G_OBJECT_CLASS (class); object_class->constructor = task_editor_constructor; object_class->dispose = task_editor_dispose; + object_class->constructed = task_editor_constructed; editor_class = COMP_EDITOR_CLASS (class); editor_class->help_section = "usage-calendar-todo"; @@ -304,6 +321,7 @@ task_editor_init (TaskEditor *te) CompEditor *editor = COMP_EDITOR (te); GtkUIManager *ui_manager; GtkActionGroup *action_group; + const gchar *id; GError *error = NULL; te->priv = TASK_EDITOR_GET_PRIVATE (te); @@ -346,17 +364,16 @@ task_editor_init (TaskEditor *te) ui_manager = comp_editor_get_ui_manager (editor); gtk_ui_manager_add_ui_from_string (ui_manager, ui, -1, &error); - e_plugin_ui_register_manager ("task-editor", ui_manager, te); + + id = "org.gnome.evolution.task-editor"; + e_plugin_ui_register_manager (ui_manager, id, te); + e_plugin_ui_enable_manager (ui_manager, id); if (error != NULL) { g_critical ("%s: %s", G_STRFUNC, error->message); g_error_free (error); } - g_signal_connect ( - te, "notify::client", - G_CALLBACK (task_editor_client_changed_cb), NULL); - g_signal_connect_swapped ( te->priv->model, "row_changed", G_CALLBACK (task_editor_model_changed_cb), te); @@ -462,7 +479,7 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gbool ECal *client; gboolean result; - client = e_meeting_store_get_e_cal (priv->model); + client = e_meeting_store_get_client (priv->model); result = itip_send_comp (E_CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL, NULL, NULL, strip_alarms, FALSE); g_object_unref (comp); @@ -488,13 +505,16 @@ task_editor_send_comp (CompEditor *editor, ECalComponentItipMethod method, gbool * editor could not be created. **/ CompEditor * -task_editor_new (ECal *client, CompEditorFlags flags) +task_editor_new (ECal *client, + EShell *shell, + CompEditorFlags flags) { g_return_val_if_fail (E_IS_CAL (client), NULL); + g_return_val_if_fail (E_IS_SHELL (shell), NULL); return g_object_new ( TYPE_TASK_EDITOR, - "flags", flags, "client", client, NULL); + "client", client, "flags", flags, "shell", shell, NULL); } void diff --git a/calendar/gui/dialogs/task-editor.h b/calendar/gui/dialogs/task-editor.h index 57ab33b54f..f026acae0c 100644 --- a/calendar/gui/dialogs/task-editor.h +++ b/calendar/gui/dialogs/task-editor.h @@ -66,6 +66,7 @@ struct _TaskEditorClass { GType task_editor_get_type (void); CompEditor * task_editor_new (ECal *client, + EShell *shell, CompEditorFlags flags); void task_editor_show_assignment (TaskEditor *te); diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c index 8b5c02843e..2f0c258f3a 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -39,7 +39,6 @@ #include <misc/e-dateedit.h> #include <e-util/e-dialog-utils.h> #include "common/authentication.h" -#include "e-util/e-popup.h" #include "e-util/e-dialog-widgets.h" #include "e-util/e-categories-config.h" #include "e-util/e-util-private.h" @@ -53,7 +52,6 @@ #include "../e-meeting-attendee.h" #include "../e-meeting-store.h" #include "../e-meeting-list-view.h" -#include "../e-cal-popup.h" #define TASK_PAGE_GET_PRIVATE(obj) \ (G_TYPE_INSTANCE_GET_PRIVATE \ @@ -466,12 +464,14 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) ECalComponentClassification cl; CompEditor *editor; CompEditorFlags flags; + GtkAction *action; ECal *client; GSList *l; icalcomponent *icalcomp; const gchar *categories, *uid; icaltimezone *zone, *default_zone; gchar *backend_addr = NULL; + gboolean active; tpage = TASK_PAGE (page); priv = tpage->priv; @@ -554,7 +554,10 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->timezone), zone ? zone : default_zone); - task_page_set_show_timezone (tpage, calendar_config_get_show_timezone()); + + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + task_page_set_show_timezone (tpage, active); if (!(flags & COMP_EDITOR_NEW_ITEM) && !zone) { GtkAction *action; @@ -1140,15 +1143,10 @@ remove_clicked_cb (GtkButton *btn, TaskPage *page) } static void -invite_cb (GtkWidget *widget, gpointer data) +invite_cb (GtkWidget *widget, + TaskPage *page) { - TaskPage *page; - TaskPagePrivate *priv; - - page = TASK_PAGE (data); - priv = page->priv; - - e_meeting_list_view_invite_others_dialog (priv->list_view); + e_meeting_list_view_invite_others_dialog (page->priv->list_view); } static void @@ -1191,102 +1189,6 @@ attendee_added_cb (EMeetingListView *emlv, } } -/* Callbacks for list view*/ -static void -popup_add_cb (EPopup *ep, EPopupItem *pitem, gpointer data) -{ - TaskPage *page = data; - - add_clicked_cb (NULL, page); -} - -static void -popup_delete_cb (EPopup *ep, EPopupItem *pitem, gpointer data) -{ - TaskPage *page = data; - - remove_clicked_cb (NULL, page); -} - -enum { - ATTENDEE_CAN_DELEGATE = 1<<1, - ATTENDEE_CAN_DELETE = 1<<2, - ATTENDEE_CAN_ADD = 1<<3, - ATTENDEE_LAST = 1<<4 -}; - -static EPopupItem context_menu_items[] = { - { E_POPUP_ITEM, (gchar *) "10.delete", (gchar *) N_("_Remove"), popup_delete_cb, NULL, (gchar *) GTK_STOCK_REMOVE, ATTENDEE_CAN_DELETE }, - { E_POPUP_ITEM, (gchar *) "15.add", (gchar *) N_("_Add "), popup_add_cb, NULL, (gchar *) GTK_STOCK_ADD, ATTENDEE_CAN_ADD }, -}; - -static void -context_popup_free(EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free(items); -} - -static gint -button_press_event (GtkWidget *widget, GdkEventButton *event, TaskPage *page) -{ - TaskPagePrivate *priv = page->priv; - CompEditor *editor; - CompEditorFlags flags; - GtkMenu *menu; - EMeetingAttendee *ia; - GtkTreePath *path; - GtkTreeIter iter; - gchar *address; - guint32 disable_mask = ~0; - GSList *menus = NULL; - ECalPopup *ep; - gint i; - - /* only process right-clicks */ - if (event->button != 3 || event->type != GDK_BUTTON_PRESS) - return FALSE; - - editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (page)); - flags = comp_editor_get_flags (editor); - - /* only if we right-click on an attendee */ - if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (priv->list_view), event->x, event->y, &path, NULL, NULL, NULL)) { - GtkTreeSelection *selection; - - if (gtk_tree_model_get_iter (GTK_TREE_MODEL (priv->model), &iter, path)) { - - gtk_tree_model_get (GTK_TREE_MODEL (priv->model), &iter, E_MEETING_STORE_ADDRESS_COL, &address, -1); - ia = e_meeting_store_find_attendee (priv->model, address, &priv->row); - g_free (address); - - if (ia) { - selection = gtk_tree_view_get_selection ((GtkTreeView *) priv->list_view); - gtk_tree_selection_unselect_all (selection); - gtk_tree_selection_select_path (selection, path); - - if (e_meeting_attendee_get_edit_level (ia) == E_MEETING_ATTENDEE_EDIT_FULL) - disable_mask &= ~ATTENDEE_CAN_DELETE; - } - } - } - - if (GTK_WIDGET_IS_SENSITIVE(priv->add)) - disable_mask &= ~ATTENDEE_CAN_ADD; - else if (flags & COMP_EDITOR_USER_ORG) - disable_mask &= ~ATTENDEE_CAN_ADD; - - ep = e_cal_popup_new("org.gnome.evolution.calendar.task.popup"); - - for (i=0;i<sizeof(context_menu_items)/sizeof(context_menu_items[0]);i++) - menus = g_slist_prepend(menus, &context_menu_items[i]); - - e_popup_add_items((EPopup *)ep, menus, NULL, context_popup_free, page); - menu = e_popup_create_menu_once((EPopup *)ep, NULL, disable_mask); - gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time); - - return TRUE; -} - static gboolean list_view_event (EMeetingListView *list_view, GdkEvent *event, TaskPage *page) { @@ -1510,17 +1412,16 @@ summary_changed_cb (GtkEditable *editable, * other pages in the task editor, so they can update any labels. */ static void -date_changed_cb (EDateEdit *dedit, gpointer data) +date_changed_cb (EDateEdit *dedit, + TaskPage *tpage) { - TaskPage *tpage; - TaskPagePrivate *priv; + TaskPagePrivate *priv = tpage->priv; CompEditorPageDates dates; gboolean date_set, time_set; ECalComponentDateTime start_dt, due_dt; struct icaltimetype start_tt = icaltime_null_time(); struct icaltimetype due_tt = icaltime_null_time(); - tpage = TASK_PAGE (data); priv = tpage->priv; if (comp_editor_page_get_updating (COMP_EDITOR_PAGE (tpage))) @@ -1579,33 +1480,24 @@ date_changed_cb (EDateEdit *dedit, gpointer data) } static void -timezone_changed_cb (EDateEdit *dedit, gpointer data) +timezone_changed_cb (EDateEdit *dedit, + TaskPage *tpage) { - TaskPage *tpage; - TaskPagePrivate *priv; - - tpage = TASK_PAGE (data); - priv = tpage->priv; - - date_changed_cb ((EDateEdit *) priv->start_date, tpage); - date_changed_cb ((EDateEdit *) priv->due_date, tpage); + date_changed_cb ((EDateEdit *) tpage->priv->start_date, tpage); + date_changed_cb ((EDateEdit *) tpage->priv->due_date, tpage); } /* Callback used when the categories button is clicked; we must bring up the * category list dialog. */ static void -categories_clicked_cb (GtkWidget *button, gpointer data) +categories_clicked_cb (GtkWidget *button, + TaskPage *tpage) { - TaskPage *tpage; - TaskPagePrivate *priv; - GtkWidget *entry; + GtkEntry *entry; - tpage = TASK_PAGE (data); - priv = tpage->priv; - - entry = priv->categories; - e_categories_config_open_dialog_for_entry (GTK_ENTRY (entry)); + entry = GTK_ENTRY (tpage->priv->categories); + e_categories_config_open_dialog_for_entry (entry); } static gboolean @@ -1865,12 +1757,17 @@ task_page_sendoptions_clicked_cb (TaskPage *tpage) static gboolean init_widgets (TaskPage *tpage) { + CompEditor *editor; TaskPagePrivate *priv; + GtkAction *action; GtkTextBuffer *text_buffer; icaltimezone *zone; + gboolean active; priv = tpage->priv; + editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (tpage)); + /* Make sure the EDateEdit widgets use our timezones to get the current time. */ e_date_edit_set_get_time_callback (E_DATE_EDIT (priv->start_date), @@ -1938,9 +1835,6 @@ init_widgets (TaskPage *tpage) G_CALLBACK (comp_editor_page_changed), tpage); g_signal_connect ( - priv->list_view, "button_press_event", - G_CALLBACK (button_press_event), tpage); - g_signal_connect ( priv->list_view, "event", G_CALLBACK (list_view_event), tpage); g_signal_connect ( @@ -1966,15 +1860,36 @@ init_widgets (TaskPage *tpage) zone = calendar_config_get_icaltimezone (); e_timezone_entry_set_default_timezone (E_TIMEZONE_ENTRY (priv->timezone), zone); - task_page_set_show_timezone (tpage, calendar_config_get_show_timezone()); + action = comp_editor_get_action (editor, "view-time-zone"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + task_page_set_show_timezone (tpage, active); + + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ATTENDEE_COL, TRUE); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_ROLE_COL, calendar_config_get_show_role ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_RSVP_COL, calendar_config_get_show_rsvp ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_STATUS_COL, calendar_config_get_show_status ()); - e_meeting_list_view_column_set_visible (priv->list_view, E_MEETING_STORE_TYPE_COL, calendar_config_get_show_type ()); + action = comp_editor_get_action (editor, "view-role"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_ROLE_COL, active); - task_page_set_show_categories (tpage, calendar_config_get_show_categories()); + action = comp_editor_get_action (editor, "view-rsvp"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_RSVP_COL, active); + + action = comp_editor_get_action (editor, "view-status"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_STATUS_COL, active); + + action = comp_editor_get_action (editor, "view-type"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + e_meeting_list_view_column_set_visible ( + priv->list_view, E_MEETING_STORE_TYPE_COL, active); + + action = comp_editor_get_action (editor, "view-categories"); + active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)); + task_page_set_show_categories (tpage, active); return TRUE; } @@ -2159,9 +2074,14 @@ GtkWidget *task_page_create_date_edit (void); GtkWidget * task_page_create_date_edit (void) { + EShell *shell; + EShellSettings *shell_settings; GtkWidget *dedit; - dedit = comp_editor_new_date_edit (TRUE, TRUE, TRUE); + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + dedit = comp_editor_new_date_edit (shell_settings, TRUE, TRUE, TRUE); e_date_edit_set_allow_no_date_set (E_DATE_EDIT (dedit), TRUE); return dedit; |