evolution r36610 - in trunk: . calendar calendar/gui calendar/gui/dialogs plugins/mark-calendar-offline plugins/select-one-source



Author: msuman
Date: Mon Oct 13 10:24:07 2008
New Revision: 36610
URL: http://svn.gnome.org/viewvc/evolution?rev=36610&view=rev

Log:
Fix for bug #424818 (bugzilla.novell.com) - Integrate the mark-calendar-offline plugin into the main code as we already have a similar per-calendar option which does the same thing.

Removed:
   trunk/plugins/mark-calendar-offline/
   trunk/plugins/select-one-source/mark-calendar-offline.c
Modified:
   trunk/ChangeLog
   trunk/calendar/ChangeLog
   trunk/calendar/gui/calendar-component.c
   trunk/calendar/gui/dialogs/calendar-setup.c
   trunk/calendar/gui/e-cal-popup.c
   trunk/calendar/gui/memos-component.c
   trunk/calendar/gui/tasks-component.c
   trunk/configure.in
   trunk/plugins/select-one-source/ChangeLog

Modified: trunk/calendar/gui/calendar-component.c
==============================================================================
--- trunk/calendar/gui/calendar-component.c	(original)
+++ trunk/calendar/gui/calendar-component.c	Mon Oct 13 10:24:07 2008
@@ -611,12 +611,39 @@
 	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 },

Modified: trunk/calendar/gui/dialogs/calendar-setup.c
==============================================================================
--- trunk/calendar/gui/dialogs/calendar-setup.c	(original)
+++ trunk/calendar/gui/dialogs/calendar-setup.c	Mon Oct 13 10:24:07 2008
@@ -259,7 +259,8 @@
 	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;

Modified: trunk/calendar/gui/e-cal-popup.c
==============================================================================
--- trunk/calendar/gui/e-cal-popup.c	(original)
+++ trunk/calendar/gui/e-cal-popup.c	Mon Oct 13 10:24:07 2008
@@ -696,7 +696,7 @@
 {
 	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 @@
 		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;
 

Modified: trunk/calendar/gui/memos-component.c
==============================================================================
--- trunk/calendar/gui/memos-component.c	(original)
+++ trunk/calendar/gui/memos-component.c	Mon Oct 13 10:24:07 2008
@@ -460,12 +460,39 @@
 	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 },

Modified: trunk/calendar/gui/tasks-component.c
==============================================================================
--- trunk/calendar/gui/tasks-component.c	(original)
+++ trunk/calendar/gui/tasks-component.c	Mon Oct 13 10:24:07 2008
@@ -134,7 +134,7 @@
 	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 @@
 	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 },

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon Oct 13 10:24:07 2008
@@ -1738,7 +1738,7 @@
 plugins_base="$plugins_base_always $SA_JUNK_PLUGIN $BF_JUNK_PLUGIN $EXCHANGE_PLUGIN $MONO_PLUGIN " 
 all_plugins_base="$plugins_base_always sa-junk-plugin bogo-junk-plugin exchange-operations mono"
 
-plugins_standard_always="bbdb subject-thread save-calendar select-one-source copy-tool mail-to-task mark-calendar-offline audio-inline mailing-list-actions default-mailer import-ics-attachments prefer-plain mail-notification attachment-reminder face backup-restore email-custom-header templates" 
+plugins_standard_always="bbdb subject-thread save-calendar select-one-source copy-tool mail-to-task audio-inline mailing-list-actions default-mailer import-ics-attachments prefer-plain mail-notification attachment-reminder face backup-restore email-custom-header templates" 
 
 plugins_standard="$plugins_standard_always"
 all_plugins_standard="$plugins_standard"
@@ -2027,7 +2027,6 @@
 plugins/save-attachments/Makefile
 plugins/save-calendar/Makefile
 plugins/select-one-source/Makefile
-plugins/mark-calendar-offline/Makefile
 plugins/prefer-plain/Makefile
 plugins/profiler/Makefile
 plugins/python/Makefile



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]