aboutsummaryrefslogtreecommitdiffstats
path: root/modules/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-11-12 09:40:24 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-11-12 09:41:46 +0800
commit425d49ebe1a6243d41984a87268353170e728187 (patch)
treec55b13c3702b9aa271e419e8c00c56d785363a47 /modules/calendar
parent623d0541ee69f1dfd37bd6e80d4afe15bba57c13 (diff)
downloadgsoc2013-evolution-425d49ebe1a6243d41984a87268353170e728187.tar.gz
gsoc2013-evolution-425d49ebe1a6243d41984a87268353170e728187.tar.zst
gsoc2013-evolution-425d49ebe1a6243d41984a87268353170e728187.zip
Simplify clipboard handling in calendar.
Diffstat (limited to 'modules/calendar')
-rw-r--r--modules/calendar/e-cal-shell-content.c18
-rw-r--r--modules/calendar/e-cal-shell-view-private.h1
-rw-r--r--modules/calendar/e-cal-shell-view.c7
3 files changed, 16 insertions, 10 deletions
diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c
index d784ce7dc6..e797c0c577 100644
--- a/modules/calendar/e-cal-shell-content.c
+++ b/modules/calendar/e-cal-shell-content.c
@@ -160,51 +160,51 @@ cal_shell_content_get_focus_location (ECalShellContent *cal_shell_content)
task_table = E_CALENDAR_TABLE (cal_shell_content->priv->task_table);
table = e_memo_table_get_table (memo_table);
- if (GTK_WIDGET_HAS_FOCUS (table->table_canvas))
+ if (gtk_widget_is_focus (GTK_WIDGET (table->table_canvas)))
return FOCUS_MEMO_TABLE;
table = e_calendar_table_get_table (task_table);
- if (GTK_WIDGET_HAS_FOCUS (table->table_canvas))
+ if (gtk_widget_is_focus (GTK_WIDGET (table->table_canvas)))
return FOCUS_TASK_TABLE;
if (E_IS_DAY_VIEW (calendar_view)) {
EDayView *day_view = E_DAY_VIEW (calendar_view);
- if (GTK_WIDGET_HAS_FOCUS (day_view->top_canvas))
+ if (gtk_widget_is_focus (day_view->top_canvas))
return FOCUS_CALENDAR;
if (GNOME_CANVAS (day_view->top_canvas)->focused_item != NULL)
return FOCUS_CALENDAR;
- if (GTK_WIDGET_HAS_FOCUS (day_view->main_canvas))
+ if (gtk_widget_is_focus (day_view->main_canvas))
return FOCUS_CALENDAR;
if (GNOME_CANVAS (day_view->main_canvas)->focused_item != NULL)
return FOCUS_CALENDAR;
- if (GTK_WIDGET_HAS_FOCUS (day_view))
+ if (gtk_widget_is_focus (GTK_WIDGET (day_view)))
return FOCUS_CALENDAR;
} else if (E_IS_WEEK_VIEW (calendar_view)) {
EWeekView *week_view = E_WEEK_VIEW (calendar_view);
- if (GTK_WIDGET_HAS_FOCUS (week_view->main_canvas))
+ if (gtk_widget_is_focus (week_view->main_canvas))
return FOCUS_CALENDAR;
if (GNOME_CANVAS (week_view->main_canvas)->focused_item != NULL)
return FOCUS_CALENDAR;
- if (GTK_WIDGET_HAS_FOCUS (week_view))
+ if (gtk_widget_is_focus (GTK_WIDGET (week_view)))
return FOCUS_CALENDAR;
} else if (E_IS_CAL_LIST_VIEW (calendar_view)) {
ECalListView *list_view = E_CAL_LIST_VIEW (calendar_view);
table = e_table_scrolled_get_table (list_view->table_scrolled);
- if (GTK_WIDGET_HAS_FOCUS (table))
+ if (gtk_widget_is_focus (GTK_WIDGET (table)))
return FOCUS_CALENDAR;
- if (GTK_WIDGET_HAS_FOCUS (list_view))
+ if (gtk_widget_is_focus (GTK_WIDGET (list_view)))
return FOCUS_CALENDAR;
}
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index 2ee0cff6a4..7f6413c747 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -44,6 +44,7 @@
#include "calendar/gui/comp-util.h"
#include "calendar/gui/e-cal-list-view.h"
#include "calendar/gui/e-cal-model-tasks.h"
+#include "calendar/gui/e-cal-selection.h"
#include "calendar/gui/e-calendar-view.h"
#include "calendar/gui/e-day-view.h"
#include "calendar/gui/e-week-view.h"
diff --git a/modules/calendar/e-cal-shell-view.c b/modules/calendar/e-cal-shell-view.c
index b696660106..60a2781c71 100644
--- a/modules/calendar/e-cal-shell-view.c
+++ b/modules/calendar/e-cal-shell-view.c
@@ -284,6 +284,7 @@ cal_shell_view_update_actions (EShellView *shell_view)
gboolean sensitive;
gboolean is_meeting = FALSE;
gboolean is_delegatable = FALSE;
+ gboolean clipboard_has_calendar;
gint n_selected;
priv = E_CAL_SHELL_VIEW_GET_PRIVATE (shell_view);
@@ -356,6 +357,10 @@ cal_shell_view_update_actions (EShellView *shell_view)
uri = e_source_peek_relative_uri (source);
user_created_source = (uri != NULL && strcmp (uri, "system") != 0);
+ clipboard_has_calendar =
+ e_clipboard_wait_is_calendar_available (
+ gtk_clipboard_get (GDK_SELECTION_CLIPBOARD));
+
action = ACTION (CALENDAR_COPY);
sensitive = (source != NULL);
gtk_action_set_sensitive (action, sensitive);
@@ -381,7 +386,7 @@ cal_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (EVENT_CLIPBOARD_PASTE);
- sensitive = editable;
+ sensitive = editable && clipboard_has_calendar;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (EVENT_DELEGATE);