aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-02-14 03:35:38 +0800
committerChris Lahey <clahey@src.gnome.org>2002-02-14 03:35:38 +0800
commitc2bf443756e31fb5d360f81a265a4529ea64ebe4 (patch)
tree83253af071f5c73c4e3355df0e4e7f34df5a197e /addressbook/gui/widgets/e-addressbook-reflow-adapter.c
parent22c314f7226679706f06cbd9d2b7dcc0edaf7279 (diff)
downloadgsoc2013-evolution-c2bf443756e31fb5d360f81a265a4529ea64ebe4.tar
gsoc2013-evolution-c2bf443756e31fb5d360f81a265a4529ea64ebe4.tar.gz
gsoc2013-evolution-c2bf443756e31fb5d360f81a265a4529ea64ebe4.tar.bz2
gsoc2013-evolution-c2bf443756e31fb5d360f81a265a4529ea64ebe4.tar.lz
gsoc2013-evolution-c2bf443756e31fb5d360f81a265a4529ea64ebe4.tar.xz
gsoc2013-evolution-c2bf443756e31fb5d360f81a265a4529ea64ebe4.tar.zst
gsoc2013-evolution-c2bf443756e31fb5d360f81a265a4529ea64ebe4.zip
Finishing commit that failed in the middle:
2002-02-13 Christopher James Lahey <clahey@ximian.com> * backend/ebook/e-book-util.c, backend/ebook/e-book-util.h (e_book_expand_uri, e_book_load_address_book_by_uri, e_book_use_address_book_by_uri): New functions that take a file:// url ending in the directory name and automatically append the addressbook.db and do the appropriate thing. * backend/pas/pas-backend-card-sexp.c, backend/pas/pas-backend-card-sexp.h: Added copyright notice here. * gui/component/addressbook-component.c (destination_folder_handle_drop), gui/component/addressbook.c (set_prop): Use e_book_expand_uri instead of addressbook_expand_uri. * gui/component/addressbook-storage.c: Fixed the fcntl include here. * gui/component/addressbook.c (ContactsCopyToFolder, ContactsMoveToFolder): Added handlers for these two verbs. * gui/component/addressbook.h: Removed addressbook_expand_uri in favor of e_book_expand_uri. * gui/widgets/e-addressbook-reflow-adapter.c (transfer_cards): Added code to handle Move to and Copy to right click menu items. * gui/widgets/e-addressbook-util.c, gui/widgets/e-addressbook-util.h (e_addressbook_transfer_cards): New function to pop up a dialog and transfer a set of cards to the given folder. * gui/widgets/e-addressbook-view.c, gui/widgets/e-addressbook-view.h (display_view): Don't attach to the view if it doesn't exist yet. We have to make this then attach later. (e_addressbook_view_copy_to_folder, e_addressbook_view_move_to_folder): New functions utilizing e_addressbook_transfer_cards. (table_right_click): Add copy_to_folder and move_to_folder to the right click menu for tables here. (e_addressbook_view_discard_menus): Handle menu unmerging here. * gui/widgets/e-minicard-view-widget.h (struct _EMinicardViewWidget): Removed unused field. svn path=/trunk/; revision=15711
Diffstat (limited to 'addressbook/gui/widgets/e-addressbook-reflow-adapter.c')
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
index 51bf381802..ab99206eac 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -95,7 +95,8 @@ text_height (GnomeCanvas *canvas, const gchar *text)
typedef struct {
EAddressbookReflowAdapter *adapter;
- ESelectionModel *selection;
+ ESelectionModel *selection;
+ GtkWidget *widget;
} ModelAndSelection;
static void
@@ -104,6 +105,8 @@ model_and_selection_free (ModelAndSelection *mns)
gtk_object_unref(GTK_OBJECT(mns->adapter));
e_selection_model_right_click_up(mns->selection);
gtk_object_unref(GTK_OBJECT(mns->selection));
+ if (mns->widget)
+ gtk_object_unref(GTK_OBJECT(mns->widget));
g_free(mns);
}
@@ -269,6 +272,37 @@ open_card (GtkWidget *widget, ModelAndSelection *mns)
model_and_selection_free (mns);
}
+static void
+transfer_cards (ModelAndSelection *mns, gboolean delete_from_source)
+{
+ EBook *book;
+ GList *cards;
+ GtkWindow *parent_window;
+
+ book = e_addressbook_model_get_ebook(mns->adapter->priv->model);
+ cards = get_card_list (mns);
+ if (mns->widget)
+ parent_window = GTK_WINDOW (gtk_widget_get_toplevel (mns->widget));
+ else
+ parent_window = NULL;
+
+ e_addressbook_transfer_cards (book, cards, delete_from_source, parent_window);
+
+ model_and_selection_free (mns);
+}
+
+static void
+copy_to_folder (GtkWidget *widget, ModelAndSelection *mns)
+{
+ transfer_cards (mns, FALSE);
+}
+
+static void
+move_to_folder (GtkWidget *widget, ModelAndSelection *mns)
+{
+ transfer_cards (mns, TRUE);
+}
+
#define POPUP_READONLY_MASK 0x01
gint
e_addressbook_reflow_adapter_right_click (EAddressbookReflowAdapter *adapter, GdkEvent *event, ESelectionModel *selection)
@@ -283,6 +317,12 @@ 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
+ E_POPUP_SEPARATOR,
+
+ {N_("Copy to folder..."), NULL, GTK_SIGNAL_FUNC(copy_to_folder), NULL, 0},
+ {N_("Move to folder..."), NULL, GTK_SIGNAL_FUNC(move_to_folder), NULL, POPUP_READONLY_MASK},
+ E_POPUP_SEPARATOR,
+
{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},
@@ -291,8 +331,11 @@ e_addressbook_reflow_adapter_right_click (EAddressbookReflowAdapter *adapter, Gd
mns->adapter = adapter;
mns->selection = selection;
+ mns->widget = gtk_get_event_widget (event);
gtk_object_ref(GTK_OBJECT(mns->adapter));
gtk_object_ref(GTK_OBJECT(mns->selection));
+ if (mns->widget)
+ gtk_object_ref(GTK_OBJECT(mns->widget));
e_popup_menu_run (menu, event, e_addressbook_model_editable(priv->model) ? 0 : POPUP_READONLY_MASK, 0, mns);
return TRUE;
}