aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorJon Trowbridge <trow@ximian.com>2001-12-20 13:35:48 +0800
committerJon Trowbridge <trow@src.gnome.org>2001-12-20 13:35:48 +0800
commit4443fe3e24d3a08aa29cac8d164824b36412da68 (patch)
tree5b5a5fed23880b8dc3d5f42d72a4f5c126ff0e15 /addressbook
parent34ea30a0d8b5efe1c03a1c93d4929ba51aa5c716 (diff)
downloadgsoc2013-evolution-4443fe3e24d3a08aa29cac8d164824b36412da68.tar.gz
gsoc2013-evolution-4443fe3e24d3a08aa29cac8d164824b36412da68.tar.zst
gsoc2013-evolution-4443fe3e24d3a08aa29cac8d164824b36412da68.zip
Add cut/copy/paste to right-click menu.
2001-12-19 Jon Trowbridge <trow@ximian.com> * gui/widgets/e-addressbook-reflow-adapter.c (e_addressbook_reflow_adapter_right_click): Add cut/copy/paste to right-click menu. * gui/widgets/e-addressbook-view.c (table_right_click): Add cut/copy/paste to right-click menu. (Fixes bug #14528.) Also, disable some right-click options if our addressbook isn't editable. svn path=/trunk/; revision=15190
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog11
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c26
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c50
3 files changed, 85 insertions, 2 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 370e4c0569..c780d6984d 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,14 @@
+2001-12-19 Jon Trowbridge <trow@ximian.com>
+
+ * gui/widgets/e-addressbook-reflow-adapter.c
+ (e_addressbook_reflow_adapter_right_click): Add cut/copy/paste to
+ right-click menu.
+
+ * gui/widgets/e-addressbook-view.c (table_right_click): Add
+ cut/copy/paste to right-click menu. (Fixes bug #14528.) Also,
+ disable some right-click options if our addressbook isn't
+ editable.
+
2001-12-18 JP Rosevear <jpr@ximian.com>
* conduit/address-conduit.c (check_for_slow_setting): go slow and
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
index 66f21dbc9d..8c4507a5e3 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -5,6 +5,7 @@
#include "e-addressbook-reflow-adapter.h"
#include "e-addressbook-model.h"
+#include "e-addressbook-view.h"
#include "e-addressbook-util.h"
#include <gal/util/e-i18n.h>
@@ -198,6 +199,28 @@ card_changed_cb (EBook* book, EBookStatus status, gpointer user_data)
}
static void
+copy (GtkWidget *widget, ModelAndSelection *mns)
+{
+ EAddressbookView *view = gtk_object_get_data (GTK_OBJECT (mns->adapter), "view");
+ e_addressbook_view_copy (view);
+}
+
+static void
+cut (GtkWidget *widget, ModelAndSelection *mns)
+{
+ EAddressbookView *view = gtk_object_get_data (GTK_OBJECT (mns->adapter), "view");
+ e_addressbook_view_copy (view);
+ e_addressbook_view_delete_selection (view);
+}
+
+static void
+paste (GtkWidget *widget, ModelAndSelection *mns)
+{
+ EAddressbookView *view = gtk_object_get_data (GTK_OBJECT (mns->adapter), "view");
+ e_addressbook_view_paste (view);
+}
+
+static void
delete (GtkWidget *widget, ModelAndSelection *mns)
{
EAddressbookReflowAdapterPrivate *priv = mns->adapter->priv;
@@ -272,6 +295,9 @@ e_addressbook_reflow_adapter_right_click (EAddressbookReflowAdapter *adapter, Gd
#if 0 /* Envelope printing is disabled for Evolution 1.0. */
{N_("Print Envelope"), NULL, GTK_SIGNAL_FUNC(print_envelope), NULL, 0},
#endif
+ {N_("Cut"), NULL, GTK_SIGNAL_FUNC (cut), NULL, POPUP_READONLY_MASK},
+ {N_("Copy"), NULL, GTK_SIGNAL_FUNC (copy), NULL, 0},
+ {N_("Paste"), NULL, GTK_SIGNAL_FUNC (paste), NULL, POPUP_READONLY_MASK},
{N_("Delete"), NULL, GTK_SIGNAL_FUNC(delete), NULL, POPUP_READONLY_MASK},
{NULL, NULL, NULL, 0}};
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index f52dd321e5..f478a1d40c 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -556,6 +556,9 @@ create_minicard_view (EAddressbookView *view)
adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->model));
minicard_view = e_minicard_view_widget_new(adapter);
+ /* A hack */
+ gtk_object_set_data (GTK_OBJECT (adapter), "view", view);
+
gtk_signal_connect(GTK_OBJECT(minicard_view), "selection_change",
GTK_SIGNAL_FUNC(minicard_selection_change), view);
@@ -704,6 +707,43 @@ print_envelope (GtkWidget *widget, CardAndBook *card_and_book)
#endif
static void
+copy (GtkWidget *widget, CardAndBook *card_and_book)
+{
+#if 0
+ card_and_book->view->clipboard_cards = g_list_append (NULL, card_and_book->card);
+ gtk_object_ref (GTK_OBJECT (card_and_book->card));
+ gtk_selection_owner_set (card_and_book->view->invisible, clipboard_atom, GDK_CURRENT_TIME);
+#endif
+
+ e_addressbook_view_copy (card_and_book->view);
+ card_and_book_free (card_and_book);
+}
+
+static void
+paste (GtkWidget *widget, CardAndBook *card_and_book)
+{
+ e_addressbook_view_paste (card_and_book->view);
+ card_and_book_free (card_and_book);
+}
+
+static void
+cut (GtkWidget *widget, CardAndBook *card_and_book)
+{
+#if 0
+ /* copy */
+ card_and_book->view->clipboard_cards = g_list_append (NULL, card_and_book->card);
+ gtk_object_ref (GTK_OBJECT (card_and_book->card));
+ gtk_selection_owner_set (card_and_book->view->invisible, clipboard_atom, GDK_CURRENT_TIME);
+
+ /* delete */
+ e_book_remove_card (card_and_book->book, card_and_book->card, NULL, NULL);
+#endif
+
+ e_addressbook_view_cut (card_and_book->view);
+ card_and_book_free (card_and_book);
+}
+
+static void
delete (GtkWidget *widget, CardAndBook *card_and_book)
{
if (e_contact_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(card_and_book->widget)))) {
@@ -722,6 +762,7 @@ delete (GtkWidget *widget, CardAndBook *card_and_book)
card_and_book_free(card_and_book);
}
+#define POPUP_READONLY_MASK 0x1
static gint
table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EAddressbookView *view)
{
@@ -737,7 +778,10 @@ table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EA
#if 0 /* Envelope printing is disabled for Evolution 1.0. */
{N_("Print Envelope"), NULL, GTK_SIGNAL_FUNC(print_envelope), NULL, 0},
#endif
- {N_("Delete"), NULL, GTK_SIGNAL_FUNC(delete), NULL, 0},
+ {N_("Cut"), NULL, GTK_SIGNAL_FUNC (cut), NULL, POPUP_READONLY_MASK},
+ {N_("Copy"), NULL, GTK_SIGNAL_FUNC (copy), NULL, 0},
+ {N_("Paste"), NULL, GTK_SIGNAL_FUNC (paste), NULL, POPUP_READONLY_MASK},
+ {N_("Delete"), NULL, GTK_SIGNAL_FUNC(delete), NULL, POPUP_READONLY_MASK},
{NULL, NULL, NULL, NULL, 0}
};
@@ -752,7 +796,9 @@ table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EA
gtk_object_ref(GTK_OBJECT(card_and_book->book));
gtk_object_ref(GTK_OBJECT(card_and_book->view));
- e_popup_menu_run (menu, event, 0, 0, card_and_book);
+ e_popup_menu_run (menu, event,
+ e_addressbook_model_editable (model) ? 0 : POPUP_READONLY_MASK,
+ 0, card_and_book);
return TRUE;
} else
return FALSE;