[evolution] Bug 601785 - Menu glitches in memo and task view
- From: Matthew Barnes <mbarnes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [evolution] Bug 601785 - Menu glitches in memo and task view
- Date: Fri, 13 Nov 2009 21:12:55 +0000 (UTC)
commit 3d4b38c997b20ddc706aa72b9c858b2548438e31
Author: Matthew Barnes <mbarnes redhat com>
Date: Fri Nov 13 16:11:47 2009 -0500
Bug 601785 - Menu glitches in memo and task view
modules/calendar/e-memo-shell-content.c | 6 ++++++
modules/calendar/e-memo-shell-content.h | 3 ++-
modules/calendar/e-memo-shell-view-private.c | 5 +++++
modules/calendar/e-memo-shell-view.c | 5 ++++-
modules/calendar/e-task-shell-content.c | 6 ++++++
modules/calendar/e-task-shell-content.h | 3 ++-
modules/calendar/e-task-shell-view-private.c | 5 +++++
modules/calendar/e-task-shell-view.c | 5 ++++-
8 files changed, 34 insertions(+), 4 deletions(-)
---
diff --git a/modules/calendar/e-memo-shell-content.c b/modules/calendar/e-memo-shell-content.c
index b877efc..c90b1de 100644
--- a/modules/calendar/e-memo-shell-content.c
+++ b/modules/calendar/e-memo-shell-content.c
@@ -24,6 +24,7 @@
#include <glib/gi18n.h>
#include "e-util/e-binding.h"
+#include "e-util/e-selection.h"
#include "e-util/gconf-bridge.h"
#include "shell/e-shell-utils.h"
#include "widgets/menus/gal-view-etable.h"
@@ -530,6 +531,7 @@ memo_shell_content_check_state (EShellContent *shell_content)
EMemoTable *memo_table;
ETable *table;
GSList *list, *iter;
+ GtkClipboard *clipboard;
gboolean editable = TRUE;
gboolean has_url = FALSE;
gint n_selected;
@@ -556,6 +558,8 @@ memo_shell_content_check_state (EShellContent *shell_content)
}
g_slist_free (list);
+ clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+
if (n_selected == 1)
state |= E_MEMO_SHELL_CONTENT_SELECTION_SINGLE;
if (n_selected > 1)
@@ -564,6 +568,8 @@ memo_shell_content_check_state (EShellContent *shell_content)
state |= E_MEMO_SHELL_CONTENT_SELECTION_CAN_EDIT;
if (has_url)
state |= E_MEMO_SHELL_CONTENT_SELECTION_HAS_URL;
+ if (e_clipboard_wait_is_calendar_available (clipboard))
+ state |= E_MEMO_SHELL_CONTENT_CLIPBOARD_HAS_CALENDAR;
return state;
}
diff --git a/modules/calendar/e-memo-shell-content.h b/modules/calendar/e-memo-shell-content.h
index ae2710e..20c7db4 100644
--- a/modules/calendar/e-memo-shell-content.h
+++ b/modules/calendar/e-memo-shell-content.h
@@ -59,7 +59,8 @@ enum {
E_MEMO_SHELL_CONTENT_SELECTION_SINGLE = 1 << 0,
E_MEMO_SHELL_CONTENT_SELECTION_MULTIPLE = 1 << 1,
E_MEMO_SHELL_CONTENT_SELECTION_CAN_EDIT = 1 << 2,
- E_MEMO_SHELL_CONTENT_SELECTION_HAS_URL = 1 << 3
+ E_MEMO_SHELL_CONTENT_SELECTION_HAS_URL = 1 << 3,
+ E_MEMO_SHELL_CONTENT_CLIPBOARD_HAS_CALENDAR = 1 << 4
};
struct _EMemoShellContent {
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index b0a6ee6..9ae26c7 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -244,6 +244,11 @@ e_memo_shell_view_private_constructed (EMemoShellView *memo_shell_view)
memo_shell_view);
g_signal_connect_swapped (
+ table, "selection-change",
+ G_CALLBACK (e_shell_view_update_actions),
+ memo_shell_view);
+
+ g_signal_connect_swapped (
memo_shell_sidebar, "client-added",
G_CALLBACK (memo_shell_view_selector_client_added_cb),
memo_shell_view);
diff --git a/modules/calendar/e-memo-shell-view.c b/modules/calendar/e-memo-shell-view.c
index a391d6b..7a5b681 100644
--- a/modules/calendar/e-memo-shell-view.c
+++ b/modules/calendar/e-memo-shell-view.c
@@ -171,6 +171,7 @@ memo_shell_view_update_actions (EShellView *shell_view)
gboolean selection_has_url;
gboolean single_memo_selected;
gboolean sources_are_editable;
+ gboolean clipboard_has_calendar;
priv = E_MEMO_SHELL_VIEW_GET_PRIVATE (shell_view);
@@ -187,6 +188,8 @@ memo_shell_view_update_actions (EShellView *shell_view)
(state & E_MEMO_SHELL_CONTENT_SELECTION_CAN_EDIT);
selection_has_url =
(state & E_MEMO_SHELL_CONTENT_SELECTION_HAS_URL);
+ clipboard_has_calendar =
+ (state & E_MEMO_SHELL_CONTENT_CLIPBOARD_HAS_CALENDAR);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
state = e_shell_sidebar_check_state (shell_sidebar);
@@ -208,7 +211,7 @@ memo_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_CLIPBOARD_PASTE);
- sensitive = sources_are_editable;
+ sensitive = sources_are_editable && clipboard_has_calendar;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (MEMO_DELETE);
diff --git a/modules/calendar/e-task-shell-content.c b/modules/calendar/e-task-shell-content.c
index 9dfdd91..2ad4b28 100644
--- a/modules/calendar/e-task-shell-content.c
+++ b/modules/calendar/e-task-shell-content.c
@@ -24,6 +24,7 @@
#include <glib/gi18n.h>
#include "e-util/e-binding.h"
+#include "e-util/e-selection.h"
#include "e-util/gconf-bridge.h"
#include "shell/e-shell-utils.h"
#include "widgets/menus/gal-view-etable.h"
@@ -528,6 +529,7 @@ task_shell_content_check_state (EShellContent *shell_content)
ECalendarTable *task_table;
ETable *table;
GSList *list, *iter;
+ GtkClipboard *clipboard;
gboolean assignable = TRUE;
gboolean editable = TRUE;
gboolean has_url = FALSE;
@@ -573,6 +575,8 @@ task_shell_content_check_state (EShellContent *shell_content)
}
g_slist_free (list);
+ clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+
if (n_selected == 1)
state |= E_TASK_SHELL_CONTENT_SELECTION_SINGLE;
if (n_selected > 1)
@@ -587,6 +591,8 @@ task_shell_content_check_state (EShellContent *shell_content)
state |= E_TASK_SHELL_CONTENT_SELECTION_HAS_INCOMPLETE;
if (has_url)
state |= E_TASK_SHELL_CONTENT_SELECTION_HAS_URL;
+ if (e_clipboard_wait_is_calendar_available (clipboard))
+ state |= E_TASK_SHELL_CONTENT_CLIPBOARD_HAS_CALENDAR;
return state;
}
diff --git a/modules/calendar/e-task-shell-content.h b/modules/calendar/e-task-shell-content.h
index f5d4fc9..e5bdecd 100644
--- a/modules/calendar/e-task-shell-content.h
+++ b/modules/calendar/e-task-shell-content.h
@@ -63,7 +63,8 @@ enum {
E_TASK_SHELL_CONTENT_SELECTION_CAN_EDIT = 1 << 3,
E_TASK_SHELL_CONTENT_SELECTION_HAS_COMPLETE = 1 << 4,
E_TASK_SHELL_CONTENT_SELECTION_HAS_INCOMPLETE = 1 << 5,
- E_TASK_SHELL_CONTENT_SELECTION_HAS_URL = 1 << 6
+ E_TASK_SHELL_CONTENT_SELECTION_HAS_URL = 1 << 6,
+ E_TASK_SHELL_CONTENT_CLIPBOARD_HAS_CALENDAR = 1 << 7
};
struct _ETaskShellContent {
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 74dd295..80a6872 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -298,6 +298,11 @@ e_task_shell_view_private_constructed (ETaskShellView *task_shell_view)
task_shell_view);
g_signal_connect_swapped (
+ table, "selection-change",
+ G_CALLBACK (e_shell_view_update_actions),
+ task_shell_view);
+
+ g_signal_connect_swapped (
task_shell_sidebar, "client-added",
G_CALLBACK (task_shell_view_selector_client_added_cb),
task_shell_view);
diff --git a/modules/calendar/e-task-shell-view.c b/modules/calendar/e-task-shell-view.c
index 72d6c1d..a55d120 100644
--- a/modules/calendar/e-task-shell-view.c
+++ b/modules/calendar/e-task-shell-view.c
@@ -286,6 +286,7 @@ task_shell_view_update_actions (EShellView *shell_view)
gboolean some_tasks_complete;
gboolean some_tasks_incomplete;
gboolean sources_are_editable;
+ gboolean clipboard_has_calendar;
priv = E_TASK_SHELL_VIEW_GET_PRIVATE (shell_view);
@@ -308,6 +309,8 @@ task_shell_view_update_actions (EShellView *shell_view)
(state & E_TASK_SHELL_CONTENT_SELECTION_HAS_INCOMPLETE);
selection_has_url =
(state & E_TASK_SHELL_CONTENT_SELECTION_HAS_URL);
+ clipboard_has_calendar =
+ (state & E_TASK_SHELL_CONTENT_CLIPBOARD_HAS_CALENDAR);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
state = e_shell_sidebar_check_state (shell_sidebar);
@@ -335,7 +338,7 @@ task_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (TASK_CLIPBOARD_PASTE);
- sensitive = sources_are_editable;
+ sensitive = sources_are_editable && clipboard_has_calendar;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (TASK_DELETE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]