aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@src.gnome.org>2008-10-01 04:33:09 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2008-10-01 04:33:09 +0800
commit20c9b4459541ad43ed0f0197e6468d6064300d77 (patch)
tree390a1d8cc06779c8c789ce19e4307cb64f86447e
parentc261a99bc4765ccb99206ed6105a323698b514c7 (diff)
downloadgsoc2013-evolution-20c9b4459541ad43ed0f0197e6468d6064300d77.tar
gsoc2013-evolution-20c9b4459541ad43ed0f0197e6468d6064300d77.tar.gz
gsoc2013-evolution-20c9b4459541ad43ed0f0197e6468d6064300d77.tar.bz2
gsoc2013-evolution-20c9b4459541ad43ed0f0197e6468d6064300d77.tar.lz
gsoc2013-evolution-20c9b4459541ad43ed0f0197e6468d6064300d77.tar.xz
gsoc2013-evolution-20c9b4459541ad43ed0f0197e6468d6064300d77.tar.zst
gsoc2013-evolution-20c9b4459541ad43ed0f0197e6468d6064300d77.zip
More Memos debugging.
Merge the "select-one-source" plugin into the Memos view. svn path=/branches/kill-bonobo/; revision=36507
-rw-r--r--calendar/modules/e-memo-shell-sidebar.c40
-rw-r--r--calendar/modules/e-memo-shell-view-actions.c61
-rw-r--r--calendar/modules/e-memo-shell-view-actions.h36
-rw-r--r--calendar/modules/e-memo-shell-view-private.c5
-rw-r--r--calendar/modules/e-memo-shell-view-private.h1
-rw-r--r--calendar/modules/e-memo-shell-view.c76
-rw-r--r--ui/evolution-memos.ui1
7 files changed, 172 insertions, 48 deletions
diff --git a/calendar/modules/e-memo-shell-sidebar.c b/calendar/modules/e-memo-shell-sidebar.c
index 5fed456f53..d1ced48648 100644
--- a/calendar/modules/e-memo-shell-sidebar.c
+++ b/calendar/modules/e-memo-shell-sidebar.c
@@ -192,8 +192,6 @@ memo_shell_sidebar_client_opened_cb (EMemoShellSidebar *memo_shell_sidebar,
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 @@ memo_shell_sidebar_constructed (GObject *object)
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 @@ memo_shell_sidebar_constructed (GObject *object)
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 @@ memo_shell_sidebar_constructed (GObject *object)
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 @@ e_memo_shell_sidebar_add_source (EMemoShellSidebar *memo_shell_sidebar,
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 @@ e_memo_shell_sidebar_remove_source (EMemoShellSidebar *memo_shell_sidebar,
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;
diff --git a/calendar/modules/e-memo-shell-view-actions.c b/calendar/modules/e-memo-shell-view-actions.c
index 7c63447cc2..09c6ed6f02 100644
--- a/calendar/modules/e-memo-shell-view-actions.c
+++ b/calendar/modules/e-memo-shell-view-actions.c
@@ -283,10 +283,62 @@ action_memo_list_properties_cb (GtkAction *action,
}
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 @@ static GtkActionEntry memo_entries[] = {
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"),
diff --git a/calendar/modules/e-memo-shell-view-actions.h b/calendar/modules/e-memo-shell-view-actions.h
index abaf9a9c2a..a1e6a76058 100644
--- a/calendar/modules/e-memo-shell-view-actions.h
+++ b/calendar/modules/e-memo-shell-view-actions.h
@@ -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) \
diff --git a/calendar/modules/e-memo-shell-view-private.c b/calendar/modules/e-memo-shell-view-private.c
index 0a95c998ec..9fa67bbb30 100644
--- a/calendar/modules/e-memo-shell-view-private.c
+++ b/calendar/modules/e-memo-shell-view-private.c
@@ -420,7 +420,7 @@ e_memo_shell_view_open_memo (EMemoShellView *memo_shell_view,
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 @@ e_memo_shell_view_set_status_message (EMemoShellView *memo_shell_view,
} 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;
}
diff --git a/calendar/modules/e-memo-shell-view-private.h b/calendar/modules/e-memo-shell-view-private.h
index b3e6404f26..02697ba074 100644
--- a/calendar/modules/e-memo-shell-view-private.h
+++ b/calendar/modules/e-memo-shell-view-private.h
@@ -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"
diff --git a/calendar/modules/e-memo-shell-view.c b/calendar/modules/e-memo-shell-view.c
index 806389a96f..cd8c866bee 100644
--- a/calendar/modules/e-memo-shell-view.c
+++ b/calendar/modules/e-memo-shell-view.c
@@ -77,14 +77,19 @@ memo_shell_view_update_actions (EShellView *shell_view)
{
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_view_update_actions (EShellView *shell_view)
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;
- action = ACTION (MEMO_OPEN);
- sensitive = (n_selected == 1);
- gtk_action_set_sensitive (action, sensitive);
+ 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);
+
+ 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
diff --git a/ui/evolution-memos.ui b/ui/evolution-memos.ui
index acfba5097f..17a83aa673 100644
--- a/ui/evolution-memos.ui
+++ b/ui/evolution-memos.ui
@@ -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>