diff options
Diffstat (limited to 'calendar/gui')
-rw-r--r-- | calendar/gui/calendar-component.c | 27 | ||||
-rw-r--r-- | calendar/gui/dialogs/calendar-setup.c | 3 | ||||
-rw-r--r-- | calendar/gui/e-cal-popup.c | 32 | ||||
-rw-r--r-- | calendar/gui/memos-component.c | 27 | ||||
-rw-r--r-- | calendar/gui/tasks-component.c | 29 |
5 files changed, 95 insertions, 23 deletions
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c index f5877a9904..791384079f 100644 --- a/calendar/gui/calendar-component.c +++ b/calendar/gui/calendar-component.c @@ -611,12 +611,39 @@ edit_calendar_cb (EPopup *ep, EPopupItem *pitem, void *data) calendar_setup_edit_calendar (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source, NULL); } +static void +set_offline_availability (EPopup *ep, EPopupItem *pitem, void *data, const char *value) +{ + CalendarComponentView *component_view = data; + ESource *selected_source; + + selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector)); + if (!selected_source) + return; + + e_source_set_property (selected_source, "offline_sync", value); +} + +static void +mark_no_offline_cb (EPopup *ep, EPopupItem *pitem, void *data) +{ + set_offline_availability (ep, pitem, data, "0"); +} + +static void +mark_offline_cb (EPopup *ep, EPopupItem *pitem, void *data) +{ + set_offline_availability (ep, pitem, data, "1"); +} + static EPopupItem ecc_source_popups[] = { { E_POPUP_ITEM, "10.new", N_("_New Calendar"), new_calendar_cb, NULL, "x-office-calendar", 0, 0 }, { E_POPUP_ITEM, "15.copy", N_("_Copy..."), copy_calendar_cb, NULL, "edit-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY }, { E_POPUP_BAR, "20.bar" }, { E_POPUP_ITEM, "20.delete", N_("_Delete"), delete_calendar_cb, NULL, "edit-delete", 0,E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_DELETE }, + { E_POPUP_ITEM, "30.mark_calendar_offline", N_("_Make available for offline use"), mark_offline_cb, NULL, "stock_disconnect", E_CAL_POPUP_SOURCE_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_OFFLINE }, + { E_POPUP_ITEM, "40.mark_calendar_no_offline", N_("_Do not make available for offline use"), mark_no_offline_cb, NULL, "stock_connect", E_CAL_POPUP_SOURCE_NO_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_NO_OFFLINE }, { E_POPUP_BAR, "99.bar" }, { E_POPUP_ITEM, "99.properties", N_("_Properties"), edit_calendar_cb, NULL, "document-properties", 0, E_CAL_POPUP_SOURCE_PRIMARY }, diff --git a/calendar/gui/dialogs/calendar-setup.c b/calendar/gui/dialogs/calendar-setup.c index f7ab2ee846..724206a072 100644 --- a/calendar/gui/dialogs/calendar-setup.c +++ b/calendar/gui/dialogs/calendar-setup.c @@ -259,7 +259,8 @@ eccp_general_offline (EConfig *ec, EConfigItem *item, struct _GtkWidget *parent, GtkWidget *offline_setting = NULL; const char *offline_sync; int row; - gboolean is_local = g_str_has_prefix (e_source_group_peek_base_uri (sdialog->source_group), "file:"); + const char *base_uri = e_source_group_peek_base_uri (sdialog->source_group); + gboolean is_local = base_uri && (g_str_has_prefix (base_uri, "file://") || g_str_has_prefix (base_uri, "contacts://")); offline_sync = e_source_get_property (sdialog->source, "offline_sync"); if (old) return old; diff --git a/calendar/gui/e-cal-popup.c b/calendar/gui/e-cal-popup.c index c18464d8ce..a8b0551bcb 100644 --- a/calendar/gui/e-cal-popup.c +++ b/calendar/gui/e-cal-popup.c @@ -696,7 +696,7 @@ e_cal_popup_target_new_source(ECalPopup *eabp, ESourceSelector *selector) { ECalPopupTargetSource *t = e_popup_target_new(&eabp->popup, E_CAL_POPUP_TARGET_SOURCE, sizeof(*t)); guint32 mask = ~0; - const char *source_uri; + const char *relative_uri; char *uri; ESource *source; const char *offline = NULL; @@ -713,42 +713,32 @@ e_cal_popup_target_new_source(ECalPopup *eabp, ESourceSelector *selector) mask &= ~E_CAL_POPUP_SOURCE_PRIMARY; /* FIXME Gross hack, should have a property or something */ - source_uri = e_source_peek_relative_uri(source); - if (source_uri && !strcmp("system", source_uri)) + relative_uri = e_source_peek_relative_uri(source); + if (relative_uri && !strcmp("system", relative_uri)) mask &= ~E_CAL_POPUP_SOURCE_SYSTEM; else mask &= ~E_CAL_POPUP_SOURCE_USER; - source = e_source_selector_peek_primary_selection (selector); uri = e_source_get_uri (source); if (!uri || (g_ascii_strncasecmp (uri, "file://", 7) && g_ascii_strncasecmp (uri, "contacts://", 11))) { /* check for e_target_selector's offline_status property here */ - offline = e_source_get_property (source, "offline"); - - if (offline && strcmp (offline,"1") == 0) { - /* set the menu item to Mark Offline - */ - mask &= ~E_CAL_POPUP_SOURCE_NO_OFFLINE; - } else { + offline = e_source_get_property (source, "offline_sync"); + if (offline && strcmp (offline, "1") == 0) + mask &= ~E_CAL_POPUP_SOURCE_NO_OFFLINE; /* set the menu item to Mark Offline */ + else mask &= ~E_CAL_POPUP_SOURCE_OFFLINE; - } } else { mask |= E_CAL_POPUP_SOURCE_NO_OFFLINE; mask |= E_CAL_POPUP_SOURCE_OFFLINE; } g_free (uri); - source = e_source_selector_peek_primary_selection (selector); - /*check for delete_status property here*/ + /* check for delete_status property here */ delete = e_source_get_property (source, "delete"); - - if (delete && strcmp (delete,"no") == 0) { - /*set the menu item to non deletable */ - mask &= ~E_CAL_POPUP_SOURCE_NO_DELETE; - } - else { + if (delete && strcmp (delete, "no") == 0) + mask &= ~E_CAL_POPUP_SOURCE_NO_DELETE; /* set the menu item to non deletable */ + else mask &= ~E_CAL_POPUP_SOURCE_DELETE; - } - t->target.mask = mask; diff --git a/calendar/gui/memos-component.c b/calendar/gui/memos-component.c index dc2b888fe4..931367cf39 100644 --- a/calendar/gui/memos-component.c +++ b/calendar/gui/memos-component.c @@ -460,12 +460,39 @@ edit_memo_list_cb (EPopup *ep, EPopupItem *pitem, void *data) calendar_setup_edit_memo_list (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source); } +static void +set_offline_availability (EPopup *ep, EPopupItem *pitem, void *data, const char *value) +{ + MemosComponentView *component_view = data; + ESource *selected_source; + + selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector)); + if (!selected_source) + return; + + e_source_set_property (selected_source, "offline_sync", value); +} + +static void +mark_no_offline_cb (EPopup *ep, EPopupItem *pitem, void *data) +{ + set_offline_availability (ep, pitem, data, "0"); +} + +static void +mark_offline_cb (EPopup *ep, EPopupItem *pitem, void *data) +{ + set_offline_availability (ep, pitem, data, "1"); +} + static EPopupItem emc_source_popups[] = { { E_POPUP_ITEM, "10.new", N_("_New Memo List"), new_memo_list_cb, NULL, "stock_notes", 0, 0 }, { E_POPUP_ITEM, "15.copy", N_("_Copy..."), copy_memo_list_cb, NULL, "edit-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY }, { E_POPUP_BAR, "20.bar" }, { E_POPUP_ITEM, "20.delete", N_("_Delete"), delete_memo_list_cb, NULL, "edit-delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY }, + { E_POPUP_ITEM, "30.mark_memos_offline", N_("_Make available for offline use"), mark_offline_cb, NULL, "stock_disconnect", E_CAL_POPUP_SOURCE_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_OFFLINE }, + { E_POPUP_ITEM, "40.mark_memos_no_offline", N_("_Do not make available for offline use"), mark_no_offline_cb, NULL, "stock_connect", E_CAL_POPUP_SOURCE_NO_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_NO_OFFLINE }, { E_POPUP_BAR, "99.bar" }, { E_POPUP_ITEM, "99.properties", N_("_Properties"), edit_memo_list_cb, NULL, "document-properties", 0, E_CAL_POPUP_SOURCE_PRIMARY }, diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c index 519d910987..d1f11c404c 100644 --- a/calendar/gui/tasks-component.c +++ b/calendar/gui/tasks-component.c @@ -134,7 +134,7 @@ ensure_sources (TasksComponent *component) personal_source = NULL; if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_TODO, NULL)) { - g_warning ("Could not get addressbook source list from GConf!"); + g_warning ("Could not get task source list from GConf!"); return; } @@ -451,12 +451,39 @@ edit_task_list_cb (EPopup *ep, EPopupItem *pitem, void *data) calendar_setup_edit_task_list (GTK_WINDOW (gtk_widget_get_toplevel(ep->target->widget)), selected_source); } +static void +set_offline_availability (EPopup *ep, EPopupItem *pitem, void *data, const char *value) +{ + TasksComponentView *component_view = data; + ESource *selected_source; + + selected_source = e_source_selector_peek_primary_selection (E_SOURCE_SELECTOR (component_view->source_selector)); + if (!selected_source) + return; + + e_source_set_property (selected_source, "offline_sync", value); +} + +static void +mark_no_offline_cb (EPopup *ep, EPopupItem *pitem, void *data) +{ + set_offline_availability (ep, pitem, data, "0"); +} + +static void +mark_offline_cb (EPopup *ep, EPopupItem *pitem, void *data) +{ + set_offline_availability (ep, pitem, data, "1"); +} + static EPopupItem etc_source_popups[] = { { E_POPUP_ITEM, "10.new", N_("_New Task List"), new_task_list_cb, NULL, "stock_todo", 0, 0 }, { E_POPUP_ITEM, "15.copy", N_("_Copy..."), copy_task_list_cb, NULL, "edit-copy", 0, E_CAL_POPUP_SOURCE_PRIMARY }, { E_POPUP_BAR, "20.bar" }, { E_POPUP_ITEM, "20.delete", N_("_Delete"), delete_task_list_cb, NULL, "edit-delete", 0, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY }, + { E_POPUP_ITEM, "30.mark_tasks_offline", N_("_Make available for offline use"), mark_offline_cb, NULL, "stock_disconnect", E_CAL_POPUP_SOURCE_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_OFFLINE }, + { E_POPUP_ITEM, "40.mark_tasks_no_offline", N_("_Do not make available for offline use"), mark_no_offline_cb, NULL, "stock_connect", E_CAL_POPUP_SOURCE_NO_OFFLINE, E_CAL_POPUP_SOURCE_USER|E_CAL_POPUP_SOURCE_PRIMARY|E_CAL_POPUP_SOURCE_NO_OFFLINE }, { E_POPUP_BAR, "99.bar" }, { E_POPUP_ITEM, "99.properties", N_("_Properties"), edit_task_list_cb, NULL, "document-properties", 0, E_CAL_POPUP_SOURCE_PRIMARY }, |