evolution r36507 - in branches/kill-bonobo: calendar/modules ui



Author: mbarnes
Date: Tue Sep 30 20:33:09 2008
New Revision: 36507
URL: http://svn.gnome.org/viewvc/evolution?rev=36507&view=rev

Log:
More Memos debugging.
Merge the "select-one-source" plugin into the Memos view.


Modified:
   branches/kill-bonobo/calendar/modules/e-memo-shell-sidebar.c
   branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.c
   branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.h
   branches/kill-bonobo/calendar/modules/e-memo-shell-view-private.c
   branches/kill-bonobo/calendar/modules/e-memo-shell-view-private.h
   branches/kill-bonobo/calendar/modules/e-memo-shell-view.c
   branches/kill-bonobo/ui/evolution-memos.ui

Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-sidebar.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-sidebar.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-sidebar.c	Tue Sep 30 20:33:09 2008
@@ -192,8 +192,6 @@
 	shell_view = e_shell_sidebar_get_shell_view (shell_sidebar);
 	shell_window = e_shell_view_get_shell_window (shell_view);
 
-	g_debug ("%s (status = %d)", G_STRFUNC, status);
-
 	switch (status) {
 		case E_CALENDAR_STATUS_OK:
 			g_signal_handlers_disconnect_matched (
@@ -393,6 +391,9 @@
 	priv->selector = g_object_ref (widget);
 	gtk_widget_show (widget);
 
+	/* Restore the selector state from the last session. */
+
+	selector = E_SOURCE_SELECTOR (priv->selector);
 	model = gtk_tree_view_get_model (GTK_TREE_VIEW (widget));
 
 	g_signal_connect_swapped (
@@ -400,33 +401,16 @@
 		G_CALLBACK (memo_shell_sidebar_row_changed_cb),
 		object);
 
-	g_signal_connect_swapped (
-		widget, "selection-changed",
-		G_CALLBACK (memo_shell_sidebar_selection_changed_cb),
-		object);
-
-	g_signal_connect_swapped (
-		widget, "primary-selection-changed",
-		G_CALLBACK (memo_shell_sidebar_primary_selection_changed_cb),
-		object);
-
-	/* Restore the primary selection from the last session. */
-
-	selector = E_SOURCE_SELECTOR (priv->selector);
-	uid = calendar_config_get_primary_memos ();
 	source = NULL;
-
+	uid = calendar_config_get_primary_memos ();
 	if (uid != NULL)
 		source = e_source_list_peek_source_by_uid (source_list, uid);
 	if (source == NULL)
 		source = e_source_list_peek_source_any (source_list);
 	if (source != NULL)
 		e_source_selector_set_primary_selection (selector, source);
-
 	g_free (uid);
 
-	/* Restore the selected sources from last session. */
-
 	list = calendar_config_get_memos_selected ();
 	for (iter = list; iter != NULL; iter = iter->next) {
 		uid = iter->data;
@@ -439,6 +423,18 @@
 		e_source_selector_select_source (selector, source);
 	}
 	g_slist_free (list);
+
+	/* Listen for subsequent changes to the selector. */
+
+	g_signal_connect_swapped (
+		widget, "selection-changed",
+		G_CALLBACK (memo_shell_sidebar_selection_changed_cb),
+		object);
+
+	g_signal_connect_swapped (
+		widget, "primary-selection-changed",
+		G_CALLBACK (memo_shell_sidebar_primary_selection_changed_cb),
+		object);
 }
 
 static void
@@ -615,8 +611,6 @@
 	uid = e_source_peek_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
-	g_debug ("%s (%s): %s", G_STRFUNC, e_source_peek_relative_uri (source), client != NULL ? "Already added" : "Added");
-
 	if (client != NULL)
 		return;
 
@@ -667,8 +661,6 @@
 	uid = e_source_peek_uid (source);
 	client = g_hash_table_lookup (client_table, uid);
 
-	g_debug ("%s (%s): %s", G_STRFUNC, e_source_peek_relative_uri (source), client == NULL ? "Already removed" : "Removed");
-
 	if (client == NULL)
 		return;
 

Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.c	Tue Sep 30 20:33:09 2008
@@ -283,10 +283,62 @@
 }
 
 static void
+action_memo_list_select_one_cb (GtkAction *action,
+                                EMemoShellView *memo_shell_view)
+{
+	EMemoShellSidebar *memo_shell_sidebar;
+	ESourceSelector *selector;
+	ESource *primary;
+	GSList *list, *iter;
+
+	memo_shell_sidebar = memo_shell_view->priv->memo_shell_sidebar;
+	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
+	primary = e_source_selector_peek_primary_selection (selector);
+	g_return_if_fail (primary != NULL);
+
+	list = e_source_selector_get_selection (selector);
+	for (iter = list; iter != NULL; iter = iter->next) {
+		ESource *source = iter->data;
+
+		if (source == primary)
+			continue;
+
+		e_source_selector_unselect_source (selector, source);
+	}
+	e_source_selector_free_selection (list);
+
+	e_source_selector_select_source (selector, primary);
+}
+
+static void
 action_memo_new_cb (GtkAction *action,
                     EMemoShellView *memo_shell_view)
 {
-	/* FIXME */
+	EMemoShellContent *memo_shell_content;
+	EMemoTable *memo_table;
+	ECalModelComponent *comp_data;
+	ECal *client;
+	ECalComponent *comp;
+	CompEditor *editor;
+	GSList *list;
+
+	memo_shell_content = memo_shell_view->priv->memo_shell_content;
+	memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
+
+	list = e_memo_table_get_selected (memo_table);
+	g_return_if_fail (list != NULL);
+	comp_data = list->data;
+	g_slist_free (list);
+
+	client = comp_data->client;
+	editor = memo_editor_new (client, COMP_EDITOR_NEW_ITEM);
+	comp = cal_comp_memo_new_with_defaults (client);
+	comp_editor_edit_comp (editor, comp);
+
+	gtk_window_present (GTK_WINDOW (editor));
+
+	g_object_unref (comp);
+	g_object_unref (client);
 }
 
 static void
@@ -522,6 +574,13 @@
 	  NULL,  /* XXX Add a tooltip! */
 	  G_CALLBACK (action_memo_list_properties_cb) },
 
+	{ "memo-list-select-one",
+	  "stock_check-filled",
+	  N_("Show _Only This Memo List"),
+	  NULL,
+	  NULL,  /* XXX Add a tooltip! */
+	  G_CALLBACK (action_memo_list_select_one_cb) },
+
 	{ "memo-new",
 	  "stock_insert-note",
 	  N_("New _Memo"),

Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.h
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.h	(original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-view-actions.h	Tue Sep 30 20:33:09 2008
@@ -32,18 +32,42 @@
 	E_SHELL_WINDOW_ACTION ((window), "memo-clipboard-paste")
 #define E_SHELL_WINDOW_ACTION_MEMO_DELETE(window) \
 	E_SHELL_WINDOW_ACTION ((window), "memo-delete")
-#define E_SHELL_WINDOW_ACTION_MEMO_FILTER_ANY_CATEGORY(window) \
-	E_SHELL_WINDOW_ACTION ((window), "memo-filter-any-category")
-#define E_SHELL_WINDOW_ACTION_MEMO_FILTER_UNMATCHED(window) \
-	E_SHELL_WINDOW_ACTION ((window), "memo-filter-unmatched")
+#define E_SHELL_WINDOW_ACTION_MEMO_FORWARD(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-forward")
+#define E_SHELL_WINDOW_ACTION_MEMO_NEW(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-new")
 #define E_SHELL_WINDOW_ACTION_MEMO_OPEN(window) \
 	E_SHELL_WINDOW_ACTION ((window), "memo-open")
+#define E_SHELL_WINDOW_ACTION_MEMO_OPEN_URL(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-open-url")
 #define E_SHELL_WINDOW_ACTION_MEMO_PREVIEW(window) \
 	E_SHELL_WINDOW_ACTION ((window), "memo-preview")
 #define E_SHELL_WINDOW_ACTION_MEMO_PRINT(window) \
 	E_SHELL_WINDOW_ACTION ((window), "memo-print")
-#define E_SHELL_WINDOW_ACTION_MEMO_PRINT_PREVIEW(window) \
-	E_SHELL_WINDOW_ACTION ((window), "memo-print-preview")
+#define E_SHELL_WINDOW_ACTION_MEMO_SAVE_AS(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-save-as")
+
+/* Memo List Actions */
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_COPY(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-list-copy")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_DELETE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-list-delete")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_NEW(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-list-new")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_PRINT(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-list-print")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_PRINT_PREVIEW(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-list-print-preview")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_PROPERTIES(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-list-properties")
+#define E_SHELL_WINDOW_ACTION_MEMO_LIST_SELECT_ONE(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-list-select-one")
+
+/* Memo Query Actions */
+#define E_SHELL_WINDOW_ACTION_MEMO_FILTER_ANY_CATEGORY(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-filter-any-category")
+#define E_SHELL_WINDOW_ACTION_MEMO_FILTER_UNMATCHED(window) \
+	E_SHELL_WINDOW_ACTION ((window), "memo-filter-unmatched")
 #define E_SHELL_WINDOW_ACTION_MEMO_SEARCH_ANY_FIELD_CONTAINS(window) \
 	E_SHELL_WINDOW_ACTION ((window), "memo-search-any-field-contains")
 #define E_SHELL_WINDOW_ACTION_MEMO_SEARCH_DESCRIPTION_CONTAINS(window) \

Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-view-private.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-view-private.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-view-private.c	Tue Sep 30 20:33:09 2008
@@ -420,7 +420,7 @@
 	uid = icalcomponent_get_uid (comp_data->icalcomp);
 	editor = comp_editor_find_instance (uid);
 
-	if (editor == NULL)
+	if (editor != NULL)
 		goto exit;
 
 	comp = e_cal_component_new ();
@@ -468,9 +468,6 @@
 	} else
 		e_activity_set_primary_text (activity, status_message);
 
-	if (status_message != NULL && *status_message != '\0')
-		g_debug ("Memos: %s", status_message);
-
 	memo_shell_view->priv->activity = activity;
 }
 

Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-view-private.h
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-view-private.h	(original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-view-private.h	Tue Sep 30 20:33:09 2008
@@ -33,6 +33,7 @@
 #include "e-util/e-util.h"
 #include "e-util/gconf-bridge.h"
 
+#include "calendar/gui/comp-util.h"
 #include "calendar/gui/e-calendar-selector.h"
 #include "calendar/gui/e-memo-preview.h"
 #include "calendar/gui/print.h"

Modified: branches/kill-bonobo/calendar/modules/e-memo-shell-view.c
==============================================================================
--- branches/kill-bonobo/calendar/modules/e-memo-shell-view.c	(original)
+++ branches/kill-bonobo/calendar/modules/e-memo-shell-view.c	Tue Sep 30 20:33:09 2008
@@ -77,14 +77,19 @@
 {
 	EMemoShellViewPrivate *priv;
 	EMemoShellContent *memo_shell_content;
+	EMemoShellSidebar *memo_shell_sidebar;
 	EShellWindow *shell_window;
-	ECal *client;
+	ESourceSelector *selector;
 	ETable *table;
-	ECalModel *model;
 	EMemoTable *memo_table;
+	ESource *source;
 	GtkAction *action;
+	GSList *list, *iter;
 	const gchar *label;
-	gboolean read_only = TRUE;
+	const gchar *uri = NULL;
+	gboolean user_created_source;
+	gboolean editable = TRUE;
+	gboolean has_url = FALSE;
 	gboolean sensitive;
 	gint n_selected;
 
@@ -95,36 +100,81 @@
 	memo_shell_content = priv->memo_shell_content;
 	memo_table = e_memo_shell_content_get_memo_table (memo_shell_content);
 
-	model = e_memo_table_get_model (memo_table);
-	client = e_cal_model_get_default_client (model);
+	memo_shell_sidebar = priv->memo_shell_sidebar;
+	selector = e_memo_shell_sidebar_get_selector (memo_shell_sidebar);
 
 	table = e_memo_table_get_table (memo_table);
 	n_selected = e_table_selected_count (table);
 
-	if (client != NULL)
-		e_cal_is_read_only (client, &read_only, NULL);
+	list = e_memo_table_get_selected (memo_table);
+	for (iter = list; iter != NULL; iter = iter->next) {
+		ECalModelComponent *comp_data = iter->data;
+		icalproperty *prop;
+		gboolean read_only;
+
+		e_cal_is_read_only (comp_data->client, &read_only, NULL);
+		editable &= !read_only;
+
+		prop = icalcomponent_get_first_property (
+			comp_data->icalcomp, ICAL_URL_PROPERTY);
+		has_url |= (prop != NULL);
+	}
+	g_slist_free (list);
 
-	action = ACTION (MEMO_OPEN);
-	sensitive = (n_selected == 1);
-	gtk_action_set_sensitive (action, sensitive);
+	source = e_source_selector_peek_primary_selection (selector);
+	if (source != NULL)
+		uri = e_source_peek_relative_uri (source);
+	user_created_source = (uri != NULL && strcmp (uri, "system") != 0);
 
 	action = ACTION (MEMO_CLIPBOARD_COPY);
 	sensitive = (n_selected > 0);
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (MEMO_CLIPBOARD_CUT);
-	sensitive = (n_selected > 0);
+	sensitive = (n_selected > 0) && editable;
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (MEMO_CLIPBOARD_PASTE);
-	sensitive = !read_only;
+	sensitive = editable;
 	gtk_action_set_sensitive (action, sensitive);
 
 	action = ACTION (MEMO_DELETE);
-	sensitive = (n_selected > 0) && !read_only;
+	sensitive = (n_selected > 0) && editable;
 	gtk_action_set_sensitive (action, sensitive);
 	label = ngettext ("Delete Memo", "Delete Memos", n_selected);
 	g_object_set (action, "label", label, NULL);
+
+	action = ACTION (MEMO_FORWARD);
+	sensitive = (n_selected == 1);
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MEMO_LIST_COPY);
+	sensitive = (source != NULL);
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MEMO_LIST_DELETE);
+	sensitive = user_created_source;
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MEMO_LIST_PROPERTIES);
+	sensitive = (source != NULL);
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MEMO_OPEN);
+	sensitive = (n_selected == 1);
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MEMO_OPEN_URL);
+	sensitive = (n_selected == 1) && has_url;
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MEMO_PRINT);
+	sensitive = (n_selected == 1);
+	gtk_action_set_sensitive (action, sensitive);
+
+	action = ACTION (MEMO_SAVE_AS);
+	sensitive = (n_selected == 1);
+	gtk_action_set_sensitive (action, sensitive);
 }
 
 static void

Modified: branches/kill-bonobo/ui/evolution-memos.ui
==============================================================================
--- branches/kill-bonobo/ui/evolution-memos.ui	(original)
+++ branches/kill-bonobo/ui/evolution-memos.ui	Tue Sep 30 20:33:09 2008
@@ -53,6 +53,7 @@
     <menuitem action='memo-list-copy'/>
     <separator/>
     <menuitem action='memo-list-delete'/>
+    <menuitem action='memo-list-select-one'/>
     <separator/>
     <menuitem action='memo-list-properties'/>
   </popup>



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