aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-11-14 05:11:47 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-11-14 05:12:49 +0800
commit3d4b38c997b20ddc706aa72b9c858b2548438e31 (patch)
tree8b2261143e677c64272d751dcd76239fc5e34855 /modules/calendar
parent96be68a972f2985c32f94960ae76dcc0e250f597 (diff)
downloadgsoc2013-evolution-3d4b38c997b20ddc706aa72b9c858b2548438e31.tar
gsoc2013-evolution-3d4b38c997b20ddc706aa72b9c858b2548438e31.tar.gz
gsoc2013-evolution-3d4b38c997b20ddc706aa72b9c858b2548438e31.tar.bz2
gsoc2013-evolution-3d4b38c997b20ddc706aa72b9c858b2548438e31.tar.lz
gsoc2013-evolution-3d4b38c997b20ddc706aa72b9c858b2548438e31.tar.xz
gsoc2013-evolution-3d4b38c997b20ddc706aa72b9c858b2548438e31.tar.zst
gsoc2013-evolution-3d4b38c997b20ddc706aa72b9c858b2548438e31.zip
BugĀ 601785 - Menu glitches in memo and task view
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-memo-shell-content.c6
-rw-r--r--modules/calendar/e-memo-shell-content.h3
-rw-r--r--modules/calendar/e-memo-shell-view-private.c5
-rw-r--r--modules/calendar/e-memo-shell-view.c5
-rw-r--r--modules/calendar/e-task-shell-content.c6
-rw-r--r--modules/calendar/e-task-shell-content.h3
-rw-r--r--modules/calendar/e-task-shell-view-private.c5
-rw-r--r--modules/calendar/e-task-shell-view.c5
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 b877efc546..c90b1def26 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 ae2710e148..20c7db4df1 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 b0a6ee6be1..9ae26c7767 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 a391d6b7a9..7a5b68159d 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 9dfdd91e8e..2ad4b28051 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 f5d4fc9665..e5bdecd8c0 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 74dd295bcb..80a68729b0 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 72d6c1d117..a55d120cb8 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);