aboutsummaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-11-12 12:52:08 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-11-12 23:44:52 +0800
commitc12e485e47f5ac99f0ddd7f7e90b9ab28b077c3d (patch)
tree4cbdb439735c9a1406e9294a152996e7c10cf49c /modules
parent7a2a0d05a9ba46c1d6c6f43f1a2d00c0ad93479a (diff)
downloadgsoc2013-evolution-c12e485e47f5ac99f0ddd7f7e90b9ab28b077c3d.tar
gsoc2013-evolution-c12e485e47f5ac99f0ddd7f7e90b9ab28b077c3d.tar.gz
gsoc2013-evolution-c12e485e47f5ac99f0ddd7f7e90b9ab28b077c3d.tar.bz2
gsoc2013-evolution-c12e485e47f5ac99f0ddd7f7e90b9ab28b077c3d.tar.lz
gsoc2013-evolution-c12e485e47f5ac99f0ddd7f7e90b9ab28b077c3d.tar.xz
gsoc2013-evolution-c12e485e47f5ac99f0ddd7f7e90b9ab28b077c3d.tar.zst
gsoc2013-evolution-c12e485e47f5ac99f0ddd7f7e90b9ab28b077c3d.zip
Simplify clipboard handling in addressbook.
Diffstat (limited to 'modules')
-rw-r--r--modules/addressbook/e-book-shell-content.c6
-rw-r--r--modules/addressbook/e-book-shell-content.h3
-rw-r--r--modules/addressbook/e-book-shell-view.c5
-rw-r--r--modules/calendar/e-cal-shell-view-private.h2
4 files changed, 13 insertions, 3 deletions
diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c
index 898bd2df39..4eccc971df 100644
--- a/modules/addressbook/e-book-shell-content.c
+++ b/modules/addressbook/e-book-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 "widgets/misc/e-paned.h"
@@ -258,6 +259,7 @@ book_shell_content_check_state (EShellContent *shell_content)
ESelectionModel *selection_model;
EAddressbookModel *model;
EAddressbookView *view;
+ GtkClipboard *clipboard;
guint32 state = 0;
gint n_contacts;
gint n_selected;
@@ -272,6 +274,8 @@ book_shell_content_check_state (EShellContent *shell_content)
n_selected = (selection_model != NULL) ?
e_selection_model_selected_count (selection_model) : 0;
+ clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
+
/* FIXME Finish the rest of the flags. */
if (n_selected == 1)
state |= E_BOOK_SHELL_CONTENT_SELECTION_SINGLE;
@@ -283,6 +287,8 @@ book_shell_content_check_state (EShellContent *shell_content)
state |= E_BOOK_SHELL_CONTENT_SOURCE_IS_EDITABLE;
if (n_contacts == 0)
state |= E_BOOK_SHELL_CONTENT_SOURCE_IS_EMPTY;
+ if (e_clipboard_wait_is_directory_available (clipboard))
+ state |= E_BOOK_SHELL_CONTENT_CLIPBOARD_HAS_DIRECTORY;
return state;
}
diff --git a/modules/addressbook/e-book-shell-content.h b/modules/addressbook/e-book-shell-content.h
index da78c01274..31f8c35838 100644
--- a/modules/addressbook/e-book-shell-content.h
+++ b/modules/addressbook/e-book-shell-content.h
@@ -64,7 +64,8 @@ enum {
E_BOOK_SHELL_CONTENT_SELECTION_HAS_MAILTO_URI = 1 << 5,
E_BOOK_SHELL_CONTENT_SOURCE_IS_BUSY = 1 << 6,
E_BOOK_SHELL_CONTENT_SOURCE_IS_EDITABLE = 1 << 7,
- E_BOOK_SHELL_CONTENT_SOURCE_IS_EMPTY = 1 << 8
+ E_BOOK_SHELL_CONTENT_SOURCE_IS_EMPTY = 1 << 8,
+ E_BOOK_SHELL_CONTENT_CLIPBOARD_HAS_DIRECTORY = 1 << 9
};
struct _EBookShellContent {
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index 8ea97caddc..88a503b024 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -246,6 +246,7 @@ book_shell_view_update_actions (EShellView *shell_view)
gboolean source_is_busy;
gboolean source_is_editable;
gboolean source_is_empty;
+ gboolean clipboard_has_directory;
priv = E_BOOK_SHELL_VIEW_GET_PRIVATE (shell_view);
@@ -268,6 +269,8 @@ book_shell_view_update_actions (EShellView *shell_view)
(state & E_BOOK_SHELL_CONTENT_SOURCE_IS_EDITABLE);
source_is_empty =
(state & E_BOOK_SHELL_CONTENT_SOURCE_IS_EMPTY);
+ clipboard_has_directory =
+ (state & E_BOOK_SHELL_CONTENT_CLIPBOARD_HAS_DIRECTORY);
shell_sidebar = e_shell_view_get_shell_sidebar (shell_view);
state = e_shell_sidebar_check_state (shell_sidebar);
@@ -301,7 +304,7 @@ book_shell_view_update_actions (EShellView *shell_view)
gtk_action_set_sensitive (action, sensitive);
action = ACTION (CONTACT_CLIPBOARD_PASTE);
- sensitive = source_is_editable;
+ sensitive = source_is_editable && clipboard_has_directory;
gtk_action_set_sensitive (action, sensitive);
action = ACTION (CONTACT_COPY);
diff --git a/modules/calendar/e-cal-shell-view-private.h b/modules/calendar/e-cal-shell-view-private.h
index 7f6413c747..1f447bc162 100644
--- a/modules/calendar/e-cal-shell-view-private.h
+++ b/modules/calendar/e-cal-shell-view-private.h
@@ -32,6 +32,7 @@
#include <libedataserver/e-sexp.h>
#include "e-util/e-binding.h"
+#include "e-util/e-selection.h"
#include "e-util/e-dialog-utils.h"
#include "e-util/e-file-utils.h"
#include "e-util/e-error.h"
@@ -44,7 +45,6 @@
#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"