aboutsummaryrefslogtreecommitdiffstats
path: root/modules/addressbook
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2009-12-08 00:31:17 +0800
committerMatthew Barnes <mbarnes@redhat.com>2009-12-26 04:42:17 +0800
commitabc0e4c694fb3d9624e890384880def730769fa0 (patch)
tree8d411f90f4edb0859ffe0b260c85e02e7d273088 /modules/addressbook
parent83dc7625983470bff4ce8b9070fbc23c3370c472 (diff)
downloadgsoc2013-evolution-abc0e4c694fb3d9624e890384880def730769fa0.tar
gsoc2013-evolution-abc0e4c694fb3d9624e890384880def730769fa0.tar.gz
gsoc2013-evolution-abc0e4c694fb3d9624e890384880def730769fa0.tar.bz2
gsoc2013-evolution-abc0e4c694fb3d9624e890384880def730769fa0.tar.lz
gsoc2013-evolution-abc0e4c694fb3d9624e890384880def730769fa0.tar.xz
gsoc2013-evolution-abc0e4c694fb3d9624e890384880def730769fa0.tar.zst
gsoc2013-evolution-abc0e4c694fb3d9624e890384880def730769fa0.zip
Introduce ESelectable and EFocusTracker.
EFocusTracker tracks the input focus within a window and helps keep the sensitivity of "selectable" actions in the main menu up-to-date. Selectable actions include Cut, Copy, Paste, Select All and Delete. EFocusTracker has built-in support for widgets that implement the GtkEditable interface such as GtkEntry and GtkTextView. It also supports custom widgets that implement the ESelectable interface, which is a subset of GtkEditable and can apply to anything that displays selectable content (esp. tree views and ETables). This commit integrates EFocusTracker with EShellWindow, CompEditor, EMsgComposer, and ESignatureManager. It also bumps the GtkHTML requirement to 2.29.5 to utilize the new GtkhtmlEditor:html constructor property.
Diffstat (limited to 'modules/addressbook')
-rw-r--r--modules/addressbook/e-book-shell-content.c31
-rw-r--r--modules/addressbook/e-book-shell-content.h6
-rw-r--r--modules/addressbook/e-book-shell-view-actions.c92
-rw-r--r--modules/addressbook/e-book-shell-view-actions.h8
-rw-r--r--modules/addressbook/e-book-shell-view.c25
5 files changed, 4 insertions, 158 deletions
diff --git a/modules/addressbook/e-book-shell-content.c b/modules/addressbook/e-book-shell-content.c
index 5eb4459b7b..a7a616fc18 100644
--- a/modules/addressbook/e-book-shell-content.c
+++ b/modules/addressbook/e-book-shell-content.c
@@ -284,11 +284,9 @@ book_shell_content_check_state (EShellContent *shell_content)
ESelectionModel *selection_model;
EAddressbookModel *model;
EAddressbookView *view;
- GtkClipboard *clipboard;
gboolean has_email = TRUE;
gboolean is_contact_list = TRUE;
guint32 state = 0;
- gint n_contacts;
gint n_selected;
struct {
@@ -301,8 +299,6 @@ book_shell_content_check_state (EShellContent *shell_content)
model = e_addressbook_view_get_model (view);
selection_model = e_addressbook_view_get_selection_model (view);
- n_contacts = (selection_model != NULL) ?
- e_selection_model_row_count (selection_model) : 0;
n_selected = (selection_model != NULL) ?
e_selection_model_selected_count (selection_model) : 0;
@@ -333,8 +329,6 @@ book_shell_content_check_state (EShellContent *shell_content)
foreach_data.list, foreach_data.list);
}
- clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD);
-
if (n_selected == 1)
state |= E_BOOK_SHELL_CONTENT_SELECTION_SINGLE;
if (n_selected > 1)
@@ -347,10 +341,6 @@ book_shell_content_check_state (EShellContent *shell_content)
state |= E_BOOK_SHELL_CONTENT_SOURCE_IS_BUSY;
if (e_addressbook_model_get_editable (model))
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;
}
@@ -649,24 +639,3 @@ e_book_shell_content_get_searchbar (EBookShellContent *book_shell_content)
return E_SHELL_SEARCHBAR (widget);
}
-
-void
-e_book_shell_content_clipboard_copy (EBookShellContent *book_shell_content)
-{
- EAddressbookView *addressbook_view;
- EWebView *web_view;
-
- g_return_if_fail (E_IS_BOOK_SHELL_CONTENT (book_shell_content));
-
- web_view = E_WEB_VIEW (book_shell_content->priv->preview);
- addressbook_view =
- e_book_shell_content_get_current_view (book_shell_content);
- g_return_if_fail (addressbook_view != NULL);
-
- if (!GTK_WIDGET_HAS_FOCUS (web_view)) {
- e_addressbook_view_copy (addressbook_view);
- return;
- }
-
- e_web_view_clipboard_copy (web_view);
-}
diff --git a/modules/addressbook/e-book-shell-content.h b/modules/addressbook/e-book-shell-content.h
index 62cc7bf80f..6ed5b38a62 100644
--- a/modules/addressbook/e-book-shell-content.h
+++ b/modules/addressbook/e-book-shell-content.h
@@ -62,9 +62,7 @@ enum {
E_BOOK_SHELL_CONTENT_SELECTION_HAS_EMAIL = 1 << 2,
E_BOOK_SHELL_CONTENT_SELECTION_IS_CONTACT_LIST = 1 << 3,
E_BOOK_SHELL_CONTENT_SOURCE_IS_BUSY = 1 << 4,
- E_BOOK_SHELL_CONTENT_SOURCE_IS_EDITABLE = 1 << 5,
- E_BOOK_SHELL_CONTENT_SOURCE_IS_EMPTY = 1 << 6,
- E_BOOK_SHELL_CONTENT_CLIPBOARD_HAS_DIRECTORY = 1 << 7
+ E_BOOK_SHELL_CONTENT_SOURCE_IS_EDITABLE = 1 << 5
};
struct _EBookShellContent {
@@ -108,8 +106,6 @@ void e_book_shell_content_set_preview_visible
EShellSearchbar *
e_book_shell_content_get_searchbar
(EBookShellContent *book_shell_content);
-void e_book_shell_content_clipboard_copy
- (EBookShellContent *book_shell_content);
G_END_DECLS
diff --git a/modules/addressbook/e-book-shell-view-actions.c b/modules/addressbook/e-book-shell-view-actions.c
index 904b777c8b..5cfdbd347d 100644
--- a/modules/addressbook/e-book-shell-view-actions.c
+++ b/modules/addressbook/e-book-shell-view-actions.c
@@ -312,44 +312,6 @@ action_address_book_stop_cb (GtkAction *action,
}
static void
-action_contact_clipboard_copy_cb (GtkAction *action,
- EBookShellView *book_shell_view)
-{
- EBookShellContent *book_shell_content;
-
- book_shell_content = book_shell_view->priv->book_shell_content;
- e_book_shell_content_clipboard_copy (book_shell_content);
-}
-
-static void
-action_contact_clipboard_cut_cb (GtkAction *action,
- EBookShellView *book_shell_view)
-{
- EBookShellContent *book_shell_content;
- EAddressbookView *view;
-
- book_shell_content = book_shell_view->priv->book_shell_content;
- view = e_book_shell_content_get_current_view (book_shell_content);
- g_return_if_fail (view != NULL);
-
- e_addressbook_view_cut (view);
-}
-
-static void
-action_contact_clipboard_paste_cb (GtkAction *action,
- EBookShellView *book_shell_view)
-{
- EBookShellContent *book_shell_content;
- EAddressbookView *view;
-
- book_shell_content = book_shell_view->priv->book_shell_content;
- view = e_book_shell_content_get_current_view (book_shell_content);
- g_return_if_fail (view != NULL);
-
- e_addressbook_view_paste (view);
-}
-
-static void
action_contact_copy_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
@@ -599,20 +561,6 @@ exit:
}
static void
-action_contact_select_all_cb (GtkAction *action,
- EBookShellView *book_shell_view)
-{
- EBookShellContent *book_shell_content;
- EAddressbookView *view;
-
- book_shell_content = book_shell_view->priv->book_shell_content;
- view = e_book_shell_content_get_current_view (book_shell_content);
- g_return_if_fail (view != NULL);
-
- e_addressbook_view_select_all (view);
-}
-
-static void
action_contact_send_message_cb (GtkAction *action,
EBookShellView *book_shell_view)
{
@@ -758,27 +706,6 @@ static GtkActionEntry contact_entries[] = {
N_("Stop loading"),
G_CALLBACK (action_address_book_stop_cb) },
- { "contact-clipboard-copy",
- GTK_STOCK_COPY,
- NULL,
- NULL,
- N_("Copy the selection"),
- G_CALLBACK (action_contact_clipboard_copy_cb) },
-
- { "contact-clipboard-cut",
- GTK_STOCK_CUT,
- NULL,
- NULL,
- N_("Cut the selection"),
- G_CALLBACK (action_contact_clipboard_cut_cb) },
-
- { "contact-clipboard-paste",
- GTK_STOCK_PASTE,
- NULL,
- NULL,
- N_("Paste the clipboard"),
- G_CALLBACK (action_contact_clipboard_paste_cb) },
-
{ "contact-copy",
NULL,
N_("_Copy Contact To..."),
@@ -828,13 +755,6 @@ static GtkActionEntry contact_entries[] = {
N_("View the current contact"),
G_CALLBACK (action_contact_open_cb) },
- { "contact-select-all",
- GTK_STOCK_SELECT_ALL,
- NULL,
- NULL,
- N_("Select all contacts"),
- G_CALLBACK (action_contact_select_all_cb) },
-
{ "contact-send-message",
"mail-message-new",
N_("_Send Message to Contact..."),
@@ -877,18 +797,6 @@ static EPopupActionEntry contact_popup_entries[] = {
N_("_Save as vCard..."),
"address-book-save-as" },
- { "contact-popup-clipboard-copy",
- NULL,
- "contact-clipboard-copy" },
-
- { "contact-popup-clipboard-cut",
- NULL,
- "contact-clipboard-cut" },
-
- { "contact-popup-clipboard-paste",
- NULL,
- "contact-clipboard-paste" },
-
{ "contact-popup-copy",
NULL,
"contact-copy" },
diff --git a/modules/addressbook/e-book-shell-view-actions.h b/modules/addressbook/e-book-shell-view-actions.h
index 98cd8b6689..250ec5fa99 100644
--- a/modules/addressbook/e-book-shell-view-actions.h
+++ b/modules/addressbook/e-book-shell-view-actions.h
@@ -45,12 +45,6 @@
E_SHELL_WINDOW_ACTION ((window), "address-book-stop")
/* Contact Actions */
-#define E_SHELL_WINDOW_ACTION_CONTACT_CLIPBOARD_COPY(window) \
- E_SHELL_WINDOW_ACTION ((window), "contact-clipboard-copy")
-#define E_SHELL_WINDOW_ACTION_CONTACT_CLIPBOARD_CUT(window) \
- E_SHELL_WINDOW_ACTION ((window), "contact-clipboard-cut")
-#define E_SHELL_WINDOW_ACTION_CONTACT_CLIPBOARD_PASTE(window) \
- E_SHELL_WINDOW_ACTION ((window), "contact-clipboard-paste")
#define E_SHELL_WINDOW_ACTION_CONTACT_COPY(window) \
E_SHELL_WINDOW_ACTION ((window), "contact-copy")
#define E_SHELL_WINDOW_ACTION_CONTACT_DELETE(window) \
@@ -71,8 +65,6 @@
E_SHELL_WINDOW_ACTION ((window), "contact-print")
#define E_SHELL_WINDOW_ACTION_CONTACT_SAVE_AS(window) \
E_SHELL_WINDOW_ACTION ((window), "contact-save-as")
-#define E_SHELL_WINDOW_ACTION_CONTACT_SELECT_ALL(window) \
- E_SHELL_WINDOW_ACTION ((window), "contact-select-all")
#define E_SHELL_WINDOW_ACTION_CONTACT_SEND_MESSAGE(window) \
E_SHELL_WINDOW_ACTION ((window), "contact-send-message")
#define E_SHELL_WINDOW_ACTION_CONTACT_VIEW_CLASSIC(window) \
diff --git a/modules/addressbook/e-book-shell-view.c b/modules/addressbook/e-book-shell-view.c
index fa5e5bbe29..9ab9cb743a 100644
--- a/modules/addressbook/e-book-shell-view.c
+++ b/modules/addressbook/e-book-shell-view.c
@@ -268,8 +268,9 @@ book_shell_view_update_actions (EShellView *shell_view)
gboolean selection_has_email;
gboolean source_is_busy;
gboolean source_is_editable;
- gboolean source_is_empty;
- gboolean clipboard_has_directory;
+
+ /* Chain up to parent's update_actions() method. */
+ E_SHELL_VIEW_CLASS (parent_class)->update_actions (shell_view);
priv = E_BOOK_SHELL_VIEW_GET_PRIVATE (shell_view);
@@ -290,10 +291,6 @@ book_shell_view_update_actions (EShellView *shell_view)
(state & E_BOOK_SHELL_CONTENT_SOURCE_IS_BUSY);
source_is_editable =
(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);
@@ -328,18 +325,6 @@ book_shell_view_update_actions (EShellView *shell_view)
sensitive = source_is_busy;
gtk_action_set_sensitive (action, sensitive);
- action = ACTION (CONTACT_CLIPBOARD_COPY);
- sensitive = any_contacts_selected;
- gtk_action_set_sensitive (action, sensitive);
-
- action = ACTION (CONTACT_CLIPBOARD_CUT);
- sensitive = source_is_editable && any_contacts_selected;
- gtk_action_set_sensitive (action, sensitive);
-
- action = ACTION (CONTACT_CLIPBOARD_PASTE);
- sensitive = source_is_editable && clipboard_has_directory;
- gtk_action_set_sensitive (action, sensitive);
-
action = ACTION (CONTACT_COPY);
sensitive = any_contacts_selected;
gtk_action_set_sensitive (action, sensitive);
@@ -381,10 +366,6 @@ book_shell_view_update_actions (EShellView *shell_view)
sensitive = any_contacts_selected;
gtk_action_set_sensitive (action, sensitive);
- action = ACTION (CONTACT_SELECT_ALL);
- sensitive = !(source_is_empty);
- gtk_action_set_sensitive (action, sensitive);
-
action = ACTION (CONTACT_SEND_MESSAGE);
sensitive = any_contacts_selected && selection_has_email;
gtk_action_set_sensitive (action, sensitive);