diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-04-26 07:37:21 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-04-26 07:37:21 +0800 |
commit | d261d0b2e46d4793c2d54540782552846535eb60 (patch) | |
tree | 5e37dd30639f8ae27c298ccdbbe4cb18d79b0830 /calendar | |
parent | dc7efb1311d23c32a76a9a8092f734223ce3207e (diff) | |
download | gsoc2013-evolution-d261d0b2e46d4793c2d54540782552846535eb60.tar.gz gsoc2013-evolution-d261d0b2e46d4793c2d54540782552846535eb60.tar.zst gsoc2013-evolution-d261d0b2e46d4793c2d54540782552846535eb60.zip |
Begin migrating calendar settings to EShellSettings.
Begin dismantling calendar-config.c and migrating calendar settings to
EShellSettings. EShellSettings utilizes GObject properties instead of
separate get/set/notify functions for each setting.
Diffstat (limited to 'calendar')
33 files changed, 508 insertions, 299 deletions
diff --git a/calendar/gui/calendar-config-keys.h b/calendar/gui/calendar-config-keys.h index 691b4f0281..15edb32c8e 100644 --- a/calendar/gui/calendar-config-keys.h +++ b/calendar/gui/calendar-config-keys.h @@ -28,18 +28,10 @@ G_BEGIN_DECLS #define CALENDAR_CONFIG_PREFIX "/apps/evolution/calendar" /* Display settings */ -#define CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE CALENDAR_CONFIG_PREFIX "/display/use_system_timezone" #define CALENDAR_CONFIG_TIMEZONE CALENDAR_CONFIG_PREFIX "/display/timezone" #define CALENDAR_CONFIG_SELECTED_CALENDARS CALENDAR_CONFIG_PREFIX "/display/selected_calendars" -#define CALENDAR_CONFIG_PRIMARY_CALENDAR CALENDAR_CONFIG_PREFIX "/display/primary_calendar" #define CALENDAR_CONFIG_24HOUR CALENDAR_CONFIG_PREFIX "/display/use_24hour_format" #define CALENDAR_CONFIG_SHOW_ATTENDEE CALENDAR_CONFIG_PREFIX "/display/show_attendee" -#define CALENDAR_CONFIG_SHOW_ROLE CALENDAR_CONFIG_PREFIX "/display/show_role" -#define CALENDAR_CONFIG_SHOW_STATUS CALENDAR_CONFIG_PREFIX "/display/show_status" -#define CALENDAR_CONFIG_SHOW_TYPE CALENDAR_CONFIG_PREFIX "/display/show_type" -#define CALENDAR_CONFIG_SHOW_RSVP CALENDAR_CONFIG_PREFIX "/display/show_rsvp" -#define CALENDAR_CONFIG_SHOW_TIMEZONE CALENDAR_CONFIG_PREFIX "/display/show_timezone" -#define CALENDAR_CONFIG_SHOW_CATEGORIES CALENDAR_CONFIG_PREFIX "/display/show_categories" #define CALENDAR_CONFIG_WEEK_START CALENDAR_CONFIG_PREFIX "/display/week_start_day" #define CALENDAR_CONFIG_DAY_START_HOUR CALENDAR_CONFIG_PREFIX "/display/day_start_hour" #define CALENDAR_CONFIG_DAY_START_MINUTE CALENDAR_CONFIG_PREFIX "/display/day_start_minute" diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c index 9d15944569..3f62cd9e9f 100644 --- a/calendar/gui/calendar-config.c +++ b/calendar/gui/calendar-config.c @@ -35,6 +35,7 @@ #include <libecal/e-cal-time-util.h> #include <libedataserver/e-data-server-util.h> #include <widgets/e-timezone-dialog/e-timezone-dialog.h> +#include <shell/e-shell.h> #include "calendar-config-keys.h" #include "calendar-config.h" @@ -150,73 +151,23 @@ calendar_config_add_notification_calendars_selected (GConfClientNotifyFunc func, return id; } -/* The primary calendar */ -char * -calendar_config_get_primary_calendar (void) -{ - calendar_config_init (); - - return gconf_client_get_string (config, CALENDAR_CONFIG_PRIMARY_CALENDAR, NULL); -} - -void -calendar_config_set_primary_calendar (const char *primary_uid) -{ - calendar_config_init (); - - gconf_client_set_string (config, CALENDAR_CONFIG_PRIMARY_CALENDAR, primary_uid, NULL); -} - - -guint -calendar_config_add_notification_primary_calendar (GConfClientNotifyFunc func, gpointer data) -{ - guint id; - - calendar_config_init (); - - id = gconf_client_notify_add (config, CALENDAR_CONFIG_PRIMARY_CALENDAR, func, data, NULL, NULL); - - return id; -} - -gboolean -calendar_config_get_use_system_timezone (void) -{ - calendar_config_init (); - - return gconf_client_get_bool (config, CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE, NULL); -} - -void -calendar_config_set_use_system_timezone (gboolean use) -{ - calendar_config_init (); - - if (calendar_config_get_use_system_timezone () != use) { - gconf_client_set_bool (config, CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE, use, NULL); - gconf_client_notify (config, CALENDAR_CONFIG_TIMEZONE); - - /* FIXME: notify CALENDAR_CONFIG_TIMEZONE change on system timezone change - itself too, when using system timezone. How to receive such change? */ - } -} - -guint -calendar_config_add_notification_use_system_timezone (GConfClientNotifyFunc func, gpointer data) -{ - calendar_config_init (); - - return gconf_client_notify_add (config, CALENDAR_CONFIG_USE_SYSTEM_TIMEZONE, func, data, NULL, NULL); -} - /* The current timezone, e.g. "Europe/London". It may be NULL, in which case you should assume UTC (though Evolution will show the timezone-setting dialog the next time a calendar or task folder is selected). */ gchar * calendar_config_get_timezone (void) { - if (calendar_config_get_use_system_timezone ()) + EShell *shell; + EShellSettings *shell_settings; + gboolean use_system_timezone; + + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + + use_system_timezone = e_shell_settings_get_boolean ( + shell_settings, "cal-use-system-timezone"); + + if (use_system_timezone) return e_cal_util_get_system_timezone_location (); return calendar_config_get_timezone_stored (); @@ -309,107 +260,6 @@ calendar_config_add_notification_24_hour_format (GConfClientNotifyFunc func, gpo return id; } -/* Show RSVP*/ -gboolean -calendar_config_get_show_rsvp (void) -{ - calendar_config_init (); - - return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_RSVP, NULL); -} - -void -calendar_config_set_show_rsvp (gboolean state) -{ - calendar_config_init (); - - gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_RSVP, state, NULL); -} - -/* Show Role*/ -gboolean -calendar_config_get_show_role (void) -{ - calendar_config_init (); - - return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_ROLE, NULL); -} - -void -calendar_config_set_show_role (gboolean state) -{ - calendar_config_init (); - - gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_ROLE, state, NULL); -} - -/* Show Type*/ -gboolean -calendar_config_get_show_type (void) -{ - calendar_config_init (); - - return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_TYPE, NULL); -} - -void -calendar_config_set_show_type (gboolean state) -{ - calendar_config_init (); - - gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_TYPE, state, NULL); -} - -/* Show status */ -gboolean -calendar_config_get_show_status (void) -{ - calendar_config_init (); - - return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_STATUS, NULL); -} - -void -calendar_config_set_show_status (gboolean state) -{ - calendar_config_init (); - - gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_STATUS, state, NULL); -} - -/* Show timezone */ -gboolean -calendar_config_get_show_timezone (void) -{ - calendar_config_init (); - - return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_TIMEZONE, NULL); -} - -void -calendar_config_set_show_timezone (gboolean status) -{ - calendar_config_init (); - - gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_TIMEZONE, status, NULL); -} - -gboolean -calendar_config_get_show_categories (void) -{ - calendar_config_init (); - - return gconf_client_get_bool (config, CALENDAR_CONFIG_SHOW_CATEGORIES, NULL); -} -void -calendar_config_set_show_categories (gboolean status) -{ - calendar_config_init (); - - gconf_client_set_bool (config, CALENDAR_CONFIG_SHOW_CATEGORIES, status, NULL); -} - - /* The start day of the week (0 = Sun to 6 = Mon). */ gint calendar_config_get_week_start_day (void) diff --git a/calendar/gui/calendar-config.h b/calendar/gui/calendar-config.h index 224d528078..97e4fe13d7 100644 --- a/calendar/gui/calendar-config.h +++ b/calendar/gui/calendar-config.h @@ -68,16 +68,6 @@ GSList *calendar_config_get_calendars_selected (void); void calendar_config_set_calendars_selected (GSList *selected); guint calendar_config_add_notification_calendars_selected (GConfClientNotifyFunc func, gpointer data); -/* The primary calendar */ -char *calendar_config_get_primary_calendar (void); -void calendar_config_set_primary_calendar (const char *primary_uid); -guint calendar_config_add_notification_primary_calendar (GConfClientNotifyFunc func, gpointer data); - -/* Use system timezone; if TRUE, then influences also the current timezone functions. */ -gboolean calendar_config_get_use_system_timezone (void); -void calendar_config_set_use_system_timezone (gboolean use); -guint calendar_config_add_notification_use_system_timezone (GConfClientNotifyFunc func, gpointer data); - /* The current timezone, e.g. "Europe/London". */ gchar* calendar_config_get_timezone (void); gchar* calendar_config_get_timezone_stored (void); @@ -117,25 +107,6 @@ gboolean calendar_config_get_24_hour_format (void); void calendar_config_set_24_hour_format (gboolean use_24_hour); guint calendar_config_add_notification_24_hour_format (GConfClientNotifyFunc func, gpointer data); -gboolean calendar_config_get_show_status (void); -void calendar_config_set_show_status (gboolean status); - -gboolean calendar_config_get_show_type (void); -void calendar_config_set_show_type (gboolean status); - -gboolean calendar_config_get_show_rsvp (void); -void calendar_config_set_show_rsvp (gboolean status); - -gboolean calendar_config_get_show_timezone (void); -void calendar_config_set_show_timezone (gboolean status); - -gboolean calendar_config_get_show_categories (void); -void calendar_config_set_show_categories (gboolean status); - -gboolean calendar_config_get_show_role (void); -void calendar_config_set_show_role (gboolean state); - - /* The time divisions in the Day/Work-Week view in minutes (5/10/15/30/60). */ gint calendar_config_get_time_divisions (void); void calendar_config_set_time_divisions (gint divisions); diff --git a/calendar/gui/dialogs/cal-prefs-dialog.c b/calendar/gui/dialogs/cal-prefs-dialog.c index 70058bcd89..6d50a406b3 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.c +++ b/calendar/gui/dialogs/cal-prefs-dialog.c @@ -31,6 +31,7 @@ #include "../calendar-config.h" #include "cal-prefs-dialog.h" #include <widgets/misc/e-dateedit.h> +#include <e-util/e-binding.h> #include <e-util/e-dialog-widgets.h> #include <e-util/e-util-private.h> #include <glib/gi18n.h> @@ -480,7 +481,9 @@ template_url_changed (GtkEntry *entry, CalendarPrefsDialog *prefs) } static void -update_system_tz_widgets (CalendarPrefsDialog *prefs) +update_system_tz_widgets (EShellSettings *shell_settings, + GParamSpec *pspec, + CalendarPrefsDialog *prefs) { icaltimezone *zone; @@ -492,15 +495,6 @@ 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 @@ -511,7 +505,6 @@ setup_changes (CalendarPrefsDialog *prefs) 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); @@ -645,11 +638,6 @@ show_config (CalendarPrefsDialog *prefs) CalUnits units; int 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); @@ -752,13 +740,16 @@ eccp_free (EConfig *ec, GSList *items, void *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; int i; GtkWidget *toplevel; + GtkWidget *widget; GSList *l; const char *working_day_names[] = { "sun_button", @@ -771,6 +762,8 @@ calendar_prefs_dialog_construct (CalendarPrefsDialog *prefs) }; char *gladefile; + shell_settings = e_shell_get_shell_settings (shell); + gladefile = g_build_filename (EVOLUTION_GLADEDIR, "cal-prefs-dialog.glade", NULL); @@ -794,8 +787,20 @@ 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_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"); @@ -865,14 +870,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. */ diff --git a/calendar/gui/dialogs/cal-prefs-dialog.h b/calendar/gui/dialogs/cal-prefs-dialog.h index 0ef1e4a667..84c1873e9a 100644 --- a/calendar/gui/dialogs/cal-prefs-dialog.h +++ b/calendar/gui/dialogs/cal-prefs-dialog.h @@ -21,13 +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 <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 @@ -42,7 +62,6 @@ struct _CalendarPrefsDialog { GConfClient *gconf; /* General tab */ - GtkWidget *use_system_tz_check; GtkWidget *system_tz_label; GtkWidget *timezone; GtkWidget *day_second_zone; @@ -93,9 +112,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.c b/calendar/gui/dialogs/comp-editor.c index 4cf74613cf..4db6c66b12 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -76,6 +76,9 @@ /* Private part of the CompEditor structure */ struct _CompEditorPrivate { + + gpointer shell; /* weak pointer */ + /* Client to use */ ECal *client; @@ -125,6 +128,7 @@ enum { PROP_CHANGED, PROP_CLIENT, PROP_FLAGS, + PROP_SHELL, PROP_SUMMARY }; @@ -1232,6 +1236,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, @@ -1256,6 +1271,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), @@ -1291,6 +1312,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 ( @@ -1366,42 +1393,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); @@ -1510,6 +1534,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", @@ -1849,6 +1884,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) diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 7fdc17ba16..a6231d55b5 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 \ @@ -108,6 +109,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); diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index c39e25acd5..be12f71ab8 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -667,13 +667,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 (client), 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 c050b92dfb..c2dde76673 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 b0fcdc4632..7c548797ab 100644 --- a/calendar/gui/dialogs/event-page.c +++ b/calendar/gui/dialogs/event-page.c @@ -368,9 +368,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); @@ -442,7 +444,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); @@ -1994,6 +1998,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)); @@ -2072,7 +2077,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); @@ -2154,10 +2162,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; @@ -2165,6 +2175,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; @@ -2186,7 +2198,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 { @@ -2778,7 +2791,9 @@ init_widgets (EventPage *epage) GtkTextBuffer *text_buffer; icaltimezone *zone; char *combo_label = NULL; + GtkAction *action; GtkTreeSelection *selection; + gboolean active; ECal *client; editor = comp_editor_page_get_editor (COMP_EDITOR_PAGE (epage)); @@ -2835,11 +2850,28 @@ 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); @@ -2875,7 +2907,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 { @@ -2966,7 +2999,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; } diff --git a/calendar/gui/dialogs/memo-editor.c b/calendar/gui/dialogs/memo-editor.c index ec7ab841c9..8de23430c9 100644 --- a/calendar/gui/dialogs/memo-editor.c +++ b/calendar/gui/dialogs/memo-editor.c @@ -163,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 b45edd18ce..34db230121 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 4f8c37c0a3..a15c1b1f88 100644 --- a/calendar/gui/dialogs/memo-page.c +++ b/calendar/gui/dialogs/memo-page.c @@ -929,9 +929,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); @@ -996,8 +1001,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; } diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index b7edd0a566..9ee3f02a17 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -492,13 +492,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 9376b4149a..64180ec1fb 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 4c5a5536ea..d020d5cd4f 100644 --- a/calendar/gui/dialogs/task-page.c +++ b/calendar/gui/dialogs/task-page.c @@ -451,12 +451,14 @@ task_page_fill_widgets (CompEditorPage *page, ECalComponent *comp) ECalComponentClassification cl; CompEditor *editor; CompEditorFlags flags; + GtkAction *action; ECal *client; GSList *l; icalcomponent *icalcomp; const char *categories, *uid; icaltimezone *zone, *default_zone; gchar *backend_addr = NULL; + gboolean active; tpage = TASK_PAGE (page); priv = tpage->priv; @@ -538,7 +540,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; @@ -1829,12 +1834,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), @@ -1930,15 +1940,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); + + 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); - 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-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); - task_page_set_show_categories (tpage, calendar_config_get_show_categories()); + 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; } diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 848a54ffa3..2294c0b0ed 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -37,6 +37,7 @@ #include <e-util/e-icon-factory.h> #include <libecal/e-cal-time-util.h> #include <libecal/e-cal-component.h> +#include <shell/e-shell.h> #include "common/authentication.h" #include "calendar-commands.h" @@ -2013,13 +2014,16 @@ open_event_with_flags (ECalendarView *cal_view, ECal *client, icalcomponent *ica CompEditor *ce; const char *uid; ECalComponent *comp; + EShell *shell; + /* FIXME ECalendarView should own an EShell pointer. */ + shell = e_shell_get_default (); uid = icalcomponent_get_uid (icalcomp); ce = comp_editor_find_instance (uid); if (!ce) { - ce = event_editor_new (client, flags); + ce = event_editor_new (client, shell, flags); g_signal_connect (ce, "object_created", G_CALLBACK (object_created_cb), cal_view); diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 91f24a973c..4ecacd2bfe 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -50,6 +50,7 @@ #include "itip-utils.h" #include "e-itip-control.h" #include "common/authentication.h" +#include <shell/e-shell.h> struct _EItipControlPrivate { GtkWidget *html; @@ -241,12 +242,18 @@ source_changed_cb (ESourceComboBox *escb, EItipControl *itip) static void find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) { + EShell *shell; + EShellSettings *shell_settings; EItipControlFindData *fd = data; EItipControlPrivate *priv; ESource *source; ECalSourceType source_type; icalcomponent *icalcomp; + /* FIXME Pass this in. */ + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + source_type = e_cal_get_source_type (ecal); source = e_cal_get_source (ecal); @@ -273,20 +280,24 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) if (fd->count == 0) { if (fd->show_selector && !priv->current_ecal && priv->vbox.widget) { GtkWidget *escb; + const gchar *property_name; char *uid; switch (priv->type) { case E_CAL_SOURCE_TYPE_EVENT: - uid = calendar_config_get_primary_calendar (); + property_name = "cal-primary-calendar"; break; case E_CAL_SOURCE_TYPE_TODO: - uid = calendar_config_get_primary_tasks (); + property_name = "cal-primary-tasks"; break; default: uid = NULL; g_return_if_reached (); } + uid = e_shell_settings_get_string ( + shell_settings, property_name); + if (uid) { source = e_source_list_peek_source_by_uid (priv->source_lists[priv->type], uid); g_free (uid); diff --git a/calendar/modules/Makefile.am b/calendar/modules/Makefile.am index 7b2e636eac..9a90c99794 100644 --- a/calendar/modules/Makefile.am +++ b/calendar/modules/Makefile.am @@ -18,6 +18,8 @@ libevolution_module_calendars_la_SOURCES = \ e-cal-shell-module.c \ e-cal-shell-module-migrate.c \ e-cal-shell-module-migrate.h \ + e-cal-shell-module-settings.c \ + e-cal-shell-module-settings.h \ e-cal-shell-content.c \ e-cal-shell-content.h \ e-cal-shell-sidebar.c \ diff --git a/calendar/modules/e-cal-shell-module-migrate.c b/calendar/modules/e-cal-shell-module-migrate.c index 0c5d02ce26..5ebb6af54f 100644 --- a/calendar/modules/e-cal-shell-module-migrate.c +++ b/calendar/modules/e-cal-shell-module-migrate.c @@ -42,6 +42,7 @@ #include "calendar/gui/calendar-config.h" #include "calendar/gui/calendar-config-keys.h" #include "calendar/gui/e-cal-event.h" +#include "shell/e-shell.h" #define WEBCAL_BASE_URI "webcal://" #define CONTACTS_BASE_URI "contacts://" @@ -498,6 +499,8 @@ create_calendar_sources (EShellModule *shell_module, ESourceGroup **on_the_web, ESourceGroup **contacts) { + EShell *shell; + EShellSettings *shell_settings; GSList *groups; ESourceGroup *group; char *base_uri, *base_uri_proto; @@ -508,6 +511,9 @@ create_calendar_sources (EShellModule *shell_module, *contacts = NULL; *personal_source = NULL; + shell = e_shell_module_get_shell (shell_module); + shell_settings = e_shell_get_shell_settings (shell); + base_dir = e_shell_module_get_config_dir (shell_module); base_uri = g_build_filename (base_dir, "local", NULL); @@ -563,16 +569,21 @@ create_calendar_sources (EShellModule *shell_module, } if (!*personal_source) { - char *primary_calendar = calendar_config_get_primary_calendar (); + char *primary_calendar; /* Create the default Person calendar */ ESource *source = e_source_new (_("Personal"), PERSONAL_RELATIVE_URI); e_source_group_add_source (*on_this_computer, source, -1); + primary_calendar = e_shell_settings_get_string ( + shell_settings, "cal-primary-calendar"); + if (!primary_calendar && !calendar_config_get_calendars_selected ()) { GSList selected; - calendar_config_set_primary_calendar (e_source_peek_uid (source)); + e_shell_settings_set_string ( + shell_settings, "cal-primary-calendar", + e_source_peek_uid (source)); selected.data = (gpointer)e_source_peek_uid (source); selected.next = NULL; diff --git a/calendar/modules/e-cal-shell-module-settings.c b/calendar/modules/e-cal-shell-module-settings.c new file mode 100644 index 0000000000..ff6bd8e500 --- /dev/null +++ b/calendar/modules/e-cal-shell-module-settings.c @@ -0,0 +1,59 @@ +/* + * e-cal-shell-module-settings.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include "e-cal-shell-module-settings.h" + +#include <gconf/gconf-client.h> + +void +e_cal_shell_module_init_settings (EShell *shell) +{ + EShellSettings *shell_settings; + + shell_settings = e_shell_get_shell_settings (shell); + + /* XXX Default values should match the GConf schema. + * Yes it's redundant, but we're stuck with GConf. */ + + e_shell_settings_install_property ( + g_param_spec_string ( + "cal-primary-calendar", + NULL, + NULL, + NULL, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "cal-primary-calendar", + "/apps/evolution/calendar/display/primary_calendar"); + + e_shell_settings_install_property ( + g_param_spec_boolean ( + "cal-use-system-timezone", + NULL, + NULL, + TRUE, + G_PARAM_READWRITE)); + + e_shell_settings_bind_to_gconf ( + shell_settings, "cal-use-system-timezone", + "/apps/evolution/calendar/display/use_system_timezone"); +} diff --git a/calendar/modules/e-cal-shell-module-settings.h b/calendar/modules/e-cal-shell-module-settings.h new file mode 100644 index 0000000000..92be6da749 --- /dev/null +++ b/calendar/modules/e-cal-shell-module-settings.h @@ -0,0 +1,33 @@ +/* + * e-cal-shell-module-settings.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef E_CAL_SHELL_MODULE_SETTINGS_H +#define E_CAL_SHELL_MODULE_SETTINGS_H + +#include <shell/e-shell.h> + +G_BEGIN_DECLS + +void e_cal_shell_module_init_settings (EShell *shell); + +G_END_DECLS + +#endif /* E_CAL_SHELL_MODULE_SETTINGS_H */ diff --git a/calendar/modules/e-cal-shell-module.c b/calendar/modules/e-cal-shell-module.c index 15b5af2d20..a73f0b5960 100644 --- a/calendar/modules/e-cal-shell-module.c +++ b/calendar/modules/e-cal-shell-module.c @@ -46,6 +46,7 @@ #include "e-cal-shell-view.h" #include "e-cal-shell-module-migrate.h" +#include "e-cal-shell-module-settings.h" #define MODULE_NAME "calendar" #define MODULE_ALIASES "" @@ -73,6 +74,8 @@ cal_shell_module_ensure_sources (EShellModule *shell_module) ESourceGroup *weather; ESource *birthdays; ESource *personal; + EShell *shell; + EShellSettings *shell_settings; GSList *groups, *iter; const gchar *data_dir; const gchar *name; @@ -87,6 +90,9 @@ cal_shell_module_ensure_sources (EShellModule *shell_module) birthdays = NULL; personal = NULL; + shell = e_shell_module_get_shell (shell_module); + shell_settings = e_shell_get_shell_settings (shell); + if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) { g_warning ("Could not get calendar sources from GConf!"); return; @@ -195,7 +201,9 @@ cal_shell_module_ensure_sources (EShellModule *shell_module) e_source_group_add_source (on_this_computer, source, -1); g_object_unref (source); - primary = calendar_config_get_primary_calendar (); + primary = e_shell_settings_get_string ( + shell_settings, "cal-primary-calendar"); + selected = calendar_config_get_calendars_selected (); if (primary == NULL && selected == NULL) { @@ -204,7 +212,8 @@ cal_shell_module_ensure_sources (EShellModule *shell_module) uid = e_source_peek_uid (source); selected = g_slist_prepend (NULL, g_strdup (uid)); - calendar_config_set_primary_calendar (uid); + e_shell_settings_set_string ( + shell_settings, "cal-primary-calendar", uid); calendar_config_set_calendars_selected (selected); } @@ -321,12 +330,16 @@ cal_shell_module_cal_opened_cb (ECal *cal, ECalendarStatus status, GtkAction *action) { + EShell *shell; ECalComponent *comp; CompEditor *editor; CompEditorFlags flags = 0; const gchar *action_name; gboolean all_day; + /* FIXME Pass this in. */ + shell = e_shell_get_default (); + /* XXX Handle errors better. */ if (status != E_CALENDAR_STATUS_OK) return; @@ -340,7 +353,7 @@ cal_shell_module_cal_opened_cb (ECal *cal, all_day = (strcmp (action_name, "event-all-day-new") == 0); - editor = event_editor_new (cal, flags); + editor = event_editor_new (cal, shell, flags); comp = cal_comp_event_new_with_current_time (cal, all_day); comp_editor_edit_comp (editor, comp); @@ -357,18 +370,24 @@ action_event_new_cb (GtkAction *action, ECal *cal = NULL; ECalSourceType source_type; ESourceList *source_list; + EShellSettings *shell_settings; + EShell *shell; gchar *uid; /* This callback is used for both appointments and meetings. */ source_type = E_CAL_SOURCE_TYPE_EVENT; + shell = e_shell_window_get_shell (shell_window); + shell_settings = e_shell_get_shell_settings (shell); + if (!e_cal_get_sources (&source_list, source_type, NULL)) { g_warning ("Could not get calendar sources from GConf!"); return; } - uid = calendar_config_get_primary_calendar (); + uid = e_shell_settings_get_string ( + shell_settings, "cal-primary-calendar"); if (uid != NULL) { ESource *source; @@ -469,7 +488,7 @@ cal_shell_module_init_preferences (EShell *shell) "calendar-and-tasks", "preferences-calendar-and-tasks", _("Calendar and Tasks"), - calendar_prefs_dialog_new (), + calendar_prefs_dialog_new (shell), 600); } @@ -541,6 +560,10 @@ e_shell_module_init (GTypeModule *type_module) cal_shell_module_init_hooks (); cal_shell_module_init_importers (); + + /* Initialize settings before initializing preferences, + * since the preferences bind to the shell settings. */ + e_cal_shell_module_init_settings (shell); cal_shell_module_init_preferences (shell); e_attachment_handler_calendar_get_type (); diff --git a/calendar/modules/e-cal-shell-sidebar.c b/calendar/modules/e-cal-shell-sidebar.c index ee887cecba..61a1a727e6 100644 --- a/calendar/modules/e-cal-shell-sidebar.c +++ b/calendar/modules/e-cal-shell-sidebar.c @@ -272,8 +272,12 @@ static void cal_shell_sidebar_primary_selection_changed_cb (ECalShellSidebar *cal_shell_sidebar, ESourceSelector *selector) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; + EShellSidebar *shell_sidebar; + EShellSettings *shell_settings; ESource *source; - const gchar *uid; /* XXX ESourceSelector needs a "primary-selection-uid" property * so we can just bind the property with GConfBridge. */ @@ -282,8 +286,16 @@ cal_shell_sidebar_primary_selection_changed_cb (ECalShellSidebar *cal_shell_side if (source == NULL) return; - uid = e_source_peek_uid (source); - calendar_config_set_primary_calendar (uid); + shell_sidebar = E_SHELL_SIDEBAR (cal_shell_sidebar); + shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_window = e_shell_view_get_shell_window (shell_view); + + shell = e_shell_window_get_shell (shell_window); + shell_settings = e_shell_get_shell_settings (shell); + + e_shell_settings_set_string ( + shell_settings, "cal-primary-calendar", + e_source_peek_uid (source)); } static void @@ -359,8 +371,11 @@ static void cal_shell_sidebar_constructed (GObject *object) { ECalShellSidebarPrivate *priv; + EShell *shell; EShellView *shell_view; + EShellWindow *shell_window; EShellSidebar *shell_sidebar; + EShellSettings *shell_settings; ECalShellView *cal_shell_view; ESourceSelector *selector; ESourceList *source_list; @@ -382,6 +397,11 @@ cal_shell_sidebar_constructed (GObject *object) shell_sidebar = E_SHELL_SIDEBAR (object); shell_view = e_shell_sidebar_get_shell_view (shell_sidebar); + shell_window = e_shell_view_get_shell_window (shell_view); + + shell = e_shell_window_get_shell (shell_window); + shell_settings = e_shell_get_shell_settings (shell); + cal_shell_view = E_CAL_SHELL_VIEW (shell_view); source_list = e_cal_shell_view_get_source_list (cal_shell_view); @@ -437,7 +457,8 @@ cal_shell_sidebar_constructed (GObject *object) object); source = NULL; - uid = calendar_config_get_primary_calendar (); + uid = e_shell_settings_get_string ( + shell_settings, "cal-primary-calendar"); if (uid != NULL) source = e_source_list_peek_source_by_uid (source_list, uid); if (source == NULL) diff --git a/calendar/modules/e-cal-shell-view-memopad.c b/calendar/modules/e-cal-shell-view-memopad.c index f5988dc125..dbde52d1eb 100644 --- a/calendar/modules/e-cal-shell-view-memopad.c +++ b/calendar/modules/e-cal-shell-view-memopad.c @@ -112,6 +112,9 @@ static void action_calendar_memopad_new_cb (GtkAction *action, ECalShellView *cal_shell_view) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; ECalShellContent *cal_shell_content; EMemoTable *memo_table; ECalModelComponent *comp_data; @@ -120,6 +123,10 @@ action_calendar_memopad_new_cb (GtkAction *action, CompEditor *editor; GSList *list; + shell_view = E_SHELL_VIEW (cal_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + cal_shell_content = cal_shell_view->priv->cal_shell_content; memo_table = e_cal_shell_content_get_memo_table (cal_shell_content); @@ -129,7 +136,7 @@ action_calendar_memopad_new_cb (GtkAction *action, g_slist_free (list); client = comp_data->client; - editor = memo_editor_new (client, COMP_EDITOR_NEW_ITEM); + editor = memo_editor_new (client, shell, COMP_EDITOR_NEW_ITEM); comp = cal_comp_memo_new_with_defaults (client); comp_editor_edit_comp (editor, comp); @@ -441,6 +448,9 @@ void e_cal_shell_view_memopad_open_memo (ECalShellView *cal_shell_view, ECalModelComponent *comp_data) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; CompEditor *editor; CompEditorFlags flags = 0; ECalComponent *comp; @@ -450,6 +460,10 @@ e_cal_shell_view_memopad_open_memo (ECalShellView *cal_shell_view, g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view)); g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data)); + shell_view = E_SHELL_VIEW (cal_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + uid = icalcomponent_get_uid (comp_data->icalcomp); editor = comp_editor_find_instance (uid); @@ -466,7 +480,7 @@ e_cal_shell_view_memopad_open_memo (ECalShellView *cal_shell_view, if (itip_organizer_is_user (comp, comp_data->client)) flags |= COMP_EDITOR_USER_ORG; - editor = memo_editor_new (comp_data->client, flags); + editor = memo_editor_new (comp_data->client, shell, flags); comp_editor_edit_comp (editor, comp); g_object_unref (comp); diff --git a/calendar/modules/e-cal-shell-view-private.c b/calendar/modules/e-cal-shell-view-private.c index 6022b712c2..f344333598 100644 --- a/calendar/modules/e-cal-shell-view-private.c +++ b/calendar/modules/e-cal-shell-view-private.c @@ -411,6 +411,9 @@ void e_cal_shell_view_open_event (ECalShellView *cal_shell_view, ECalModelComponent *comp_data) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; CompEditor *editor; CompEditorFlags flags = 0; ECalComponent *comp; @@ -421,6 +424,10 @@ e_cal_shell_view_open_event (ECalShellView *cal_shell_view, g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view)); g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data)); + shell_view = E_SHELL_VIEW (cal_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + uid = icalcomponent_get_uid (comp_data->icalcomp); editor = comp_editor_find_instance (uid); @@ -445,7 +452,7 @@ e_cal_shell_view_open_event (ECalShellView *cal_shell_view, if (!e_cal_component_has_attendees (comp)) flags |= COMP_EDITOR_USER_ORG; - editor = event_editor_new (comp_data->client, flags); + editor = event_editor_new (comp_data->client, shell, flags); comp_editor_edit_comp (editor, comp); g_object_ref (comp); diff --git a/calendar/modules/e-cal-shell-view-taskpad.c b/calendar/modules/e-cal-shell-view-taskpad.c index 49b7f3635f..92fcdba69f 100644 --- a/calendar/modules/e-cal-shell-view-taskpad.c +++ b/calendar/modules/e-cal-shell-view-taskpad.c @@ -181,6 +181,9 @@ static void action_calendar_taskpad_new_cb (GtkAction *action, ECalShellView *cal_shell_view) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; ECalShellContent *cal_shell_content; ECalendarTable *task_table; ECalModelComponent *comp_data; @@ -189,6 +192,10 @@ action_calendar_taskpad_new_cb (GtkAction *action, CompEditor *editor; GSList *list; + shell_view = E_SHELL_VIEW (cal_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + cal_shell_content = cal_shell_view->priv->cal_shell_content; task_table = e_cal_shell_content_get_task_table (cal_shell_content); @@ -198,7 +205,7 @@ action_calendar_taskpad_new_cb (GtkAction *action, g_slist_free (list); client = comp_data->client; - editor = task_editor_new (client, COMP_EDITOR_NEW_ITEM); + editor = task_editor_new (client, shell, COMP_EDITOR_NEW_ITEM); comp = cal_comp_task_new_with_defaults (client); comp_editor_edit_comp (editor, comp); @@ -560,6 +567,9 @@ void e_cal_shell_view_taskpad_open_task (ECalShellView *cal_shell_view, ECalModelComponent *comp_data) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; CompEditor *editor; CompEditorFlags flags = 0; ECalComponent *comp; @@ -570,6 +580,10 @@ e_cal_shell_view_taskpad_open_task (ECalShellView *cal_shell_view, g_return_if_fail (E_IS_CAL_SHELL_VIEW (cal_shell_view)); g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data)); + shell_view = E_SHELL_VIEW (cal_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + uid = icalcomponent_get_uid (comp_data->icalcomp); editor = comp_editor_find_instance (uid); @@ -591,7 +605,7 @@ e_cal_shell_view_taskpad_open_task (ECalShellView *cal_shell_view, if (!e_cal_component_has_attendees (comp)) flags |= COMP_EDITOR_USER_ORG; - editor = task_editor_new (comp_data->client, flags); + editor = task_editor_new (comp_data->client, shell, flags); comp_editor_edit_comp (editor, comp); g_object_ref (comp); diff --git a/calendar/modules/e-memo-shell-module.c b/calendar/modules/e-memo-shell-module.c index 873bdb26d0..913d5b3a26 100644 --- a/calendar/modules/e-memo-shell-module.c +++ b/calendar/modules/e-memo-shell-module.c @@ -213,11 +213,15 @@ memo_module_cal_opened_cb (ECal *cal, ECalendarStatus status, GtkAction *action) { + EShell *shell; ECalComponent *comp; CompEditor *editor; CompEditorFlags flags = 0; const gchar *action_name; + /* FIXME Pass this in. */ + shell = e_shell_get_default (); + /* XXX Handle errors better. */ if (status != E_CALENDAR_STATUS_OK) return; @@ -230,7 +234,7 @@ memo_module_cal_opened_cb (ECal *cal, flags |= COMP_EDITOR_USER_ORG; } - editor = memo_editor_new (cal, flags); + editor = memo_editor_new (cal, shell, flags); comp = cal_comp_memo_new_with_defaults (cal); comp_editor_edit_comp (editor, comp); @@ -319,6 +323,7 @@ static gboolean memo_module_handle_uri_cb (EShellModule *shell_module, const gchar *uri) { + EShell *shell; CompEditor *editor; CompEditorFlags flags = 0; ECal *client; @@ -336,6 +341,7 @@ memo_module_handle_uri_cb (EShellModule *shell_module, GError *error = NULL; source_type = E_CAL_SOURCE_TYPE_JOURNAL; + shell = e_shell_module_get_shell (shell_module); if (strncmp (uri, "memo:", 5) != 0) return FALSE; @@ -431,7 +437,7 @@ memo_module_handle_uri_cb (EShellModule *shell_module, if (itip_organizer_is_user (comp, client)) flags |= COMP_EDITOR_USER_ORG; - editor = memo_editor_new (client, flags); + editor = memo_editor_new (client, shell, flags); comp_editor_edit_comp (editor, comp); g_object_unref (comp); diff --git a/calendar/modules/e-memo-shell-view-actions.c b/calendar/modules/e-memo-shell-view-actions.c index 2d0837afc1..d45f74fc38 100644 --- a/calendar/modules/e-memo-shell-view-actions.c +++ b/calendar/modules/e-memo-shell-view-actions.c @@ -335,6 +335,9 @@ static void action_memo_new_cb (GtkAction *action, EMemoShellView *memo_shell_view) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; EMemoShellContent *memo_shell_content; EMemoTable *memo_table; ECalModelComponent *comp_data; @@ -343,6 +346,10 @@ action_memo_new_cb (GtkAction *action, CompEditor *editor; GSList *list; + shell_view = E_SHELL_VIEW (memo_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + memo_shell_content = memo_shell_view->priv->memo_shell_content; memo_table = e_memo_shell_content_get_memo_table (memo_shell_content); @@ -352,7 +359,7 @@ action_memo_new_cb (GtkAction *action, g_slist_free (list); client = comp_data->client; - editor = memo_editor_new (client, COMP_EDITOR_NEW_ITEM); + editor = memo_editor_new (client, shell, COMP_EDITOR_NEW_ITEM); comp = cal_comp_memo_new_with_defaults (client); comp_editor_edit_comp (editor, comp); diff --git a/calendar/modules/e-memo-shell-view-private.c b/calendar/modules/e-memo-shell-view-private.c index 86b959eb03..113def55ad 100644 --- a/calendar/modules/e-memo-shell-view-private.c +++ b/calendar/modules/e-memo-shell-view-private.c @@ -413,6 +413,9 @@ void e_memo_shell_view_open_memo (EMemoShellView *memo_shell_view, ECalModelComponent *comp_data) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; CompEditor *editor; CompEditorFlags flags = 0; ECalComponent *comp; @@ -422,6 +425,10 @@ e_memo_shell_view_open_memo (EMemoShellView *memo_shell_view, g_return_if_fail (E_IS_MEMO_SHELL_VIEW (memo_shell_view)); g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data)); + shell_view = E_SHELL_VIEW (memo_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + uid = icalcomponent_get_uid (comp_data->icalcomp); editor = comp_editor_find_instance (uid); @@ -438,7 +445,7 @@ e_memo_shell_view_open_memo (EMemoShellView *memo_shell_view, if (itip_organizer_is_user (comp, comp_data->client)) flags |= COMP_EDITOR_USER_ORG; - editor = memo_editor_new (comp_data->client, flags); + editor = memo_editor_new (comp_data->client, shell, flags); comp_editor_edit_comp (editor, comp); g_object_unref (comp); diff --git a/calendar/modules/e-task-shell-module.c b/calendar/modules/e-task-shell-module.c index c92e07ebea..5e35008541 100644 --- a/calendar/modules/e-task-shell-module.c +++ b/calendar/modules/e-task-shell-module.c @@ -213,11 +213,15 @@ task_module_cal_opened_cb (ECal *cal, ECalendarStatus status, GtkAction *action) { + EShell *shell; ECalComponent *comp; CompEditor *editor; CompEditorFlags flags = 0; const gchar *action_name; + /* FIXME Pass this in. */ + shell = e_shell_get_default (); + /* XXX Handle errors better. */ if (status != E_CALENDAR_STATUS_OK) return; @@ -230,7 +234,7 @@ task_module_cal_opened_cb (ECal *cal, flags |= COMP_EDITOR_USER_ORG; } - editor = task_editor_new (cal, flags); + editor = task_editor_new (cal, shell, flags); comp = cal_comp_task_new_with_defaults (cal); comp_editor_edit_comp (editor, comp); @@ -319,6 +323,7 @@ static gboolean task_module_handle_uri_cb (EShellModule *shell_module, const gchar *uri) { + EShell *shell; CompEditor *editor; CompEditorFlags flags = 0; ECal *client; @@ -337,6 +342,7 @@ task_module_handle_uri_cb (EShellModule *shell_module, GError *error = NULL; source_type = E_CAL_SOURCE_TYPE_TODO; + shell = e_shell_module_get_shell (shell_module); if (strncmp (uri, "task:", 5) != 0) return FALSE; @@ -437,7 +443,7 @@ task_module_handle_uri_cb (EShellModule *shell_module, if (!e_cal_component_has_attendees (comp)) flags |= COMP_EDITOR_USER_ORG; - editor = task_editor_new (client, flags); + editor = task_editor_new (client, shell, flags); comp_editor_edit_comp (editor, comp); g_object_unref (comp); diff --git a/calendar/modules/e-task-shell-view-actions.c b/calendar/modules/e-task-shell-view-actions.c index c1810beee5..d924043e5f 100644 --- a/calendar/modules/e-task-shell-view-actions.c +++ b/calendar/modules/e-task-shell-view-actions.c @@ -428,6 +428,9 @@ static void action_task_new_cb (GtkAction *action, ETaskShellView *task_shell_view) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; ETaskShellContent *task_shell_content; ECalendarTable *task_table; ECalModelComponent *comp_data; @@ -436,6 +439,10 @@ action_task_new_cb (GtkAction *action, CompEditor *editor; GSList *list; + shell_view = E_SHELL_VIEW (task_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + task_shell_content = task_shell_view->priv->task_shell_content; task_table = e_task_shell_content_get_task_table (task_shell_content); @@ -445,7 +452,7 @@ action_task_new_cb (GtkAction *action, g_slist_free (list); client = comp_data->client; - editor = task_editor_new (client, COMP_EDITOR_NEW_ITEM); + editor = task_editor_new (client, shell, COMP_EDITOR_NEW_ITEM); comp = cal_comp_task_new_with_defaults (client); comp_editor_edit_comp (editor, comp); diff --git a/calendar/modules/e-task-shell-view-private.c b/calendar/modules/e-task-shell-view-private.c index e1e14b2547..9c6a3a94bb 100644 --- a/calendar/modules/e-task-shell-view-private.c +++ b/calendar/modules/e-task-shell-view-private.c @@ -595,6 +595,9 @@ void e_task_shell_view_open_task (ETaskShellView *task_shell_view, ECalModelComponent *comp_data) { + EShell *shell; + EShellView *shell_view; + EShellWindow *shell_window; CompEditor *editor; CompEditorFlags flags = 0; ECalComponent *comp; @@ -605,6 +608,10 @@ e_task_shell_view_open_task (ETaskShellView *task_shell_view, g_return_if_fail (E_IS_TASK_SHELL_VIEW (task_shell_view)); g_return_if_fail (E_IS_CAL_MODEL_COMPONENT (comp_data)); + shell_view = E_SHELL_VIEW (task_shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + shell = e_shell_window_get_shell (shell_window); + uid = icalcomponent_get_uid (comp_data->icalcomp); editor = comp_editor_find_instance (uid); @@ -626,7 +633,7 @@ e_task_shell_view_open_task (ETaskShellView *task_shell_view, if (!e_cal_component_has_attendees (comp)) flags |= COMP_EDITOR_USER_ORG; - editor = task_editor_new (comp_data->client, flags); + editor = task_editor_new (comp_data->client, shell, flags); comp_editor_edit_comp (editor, comp); g_object_ref (comp); |