diff options
author | Christopher James Lahey <clahey@ximian.com> | 2002-02-14 03:35:38 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2002-02-14 03:35:38 +0800 |
commit | c2bf443756e31fb5d360f81a265a4529ea64ebe4 (patch) | |
tree | 83253af071f5c73c4e3355df0e4e7f34df5a197e /addressbook | |
parent | 22c314f7226679706f06cbd9d2b7dcc0edaf7279 (diff) | |
download | gsoc2013-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')
-rw-r--r-- | addressbook/gui/component/addressbook-component.c | 2 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook-storage.c | 2 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 78 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.h | 3 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-reflow-adapter.c | 45 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-util.c | 161 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-util.h | 4 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.c | 77 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-addressbook-view.h | 71 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard-view-widget.h | 1 |
10 files changed, 357 insertions, 87 deletions
diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index 7b3e78720d..766d655b39 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -489,7 +489,7 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *fol card_list = e_card_load_cards_from_string_with_default_charset (data->bytes._buffer, "ISO-8859-1"); - expanded_uri = addressbook_expand_uri (physical_uri); + expanded_uri = e_book_expand_uri (physical_uri); book = e_book_new (); addressbook_load_uri (book, expanded_uri, diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c index 794876bca8..34edcc046a 100644 --- a/addressbook/gui/component/addressbook-storage.c +++ b/addressbook/gui/component/addressbook-storage.c @@ -44,7 +44,7 @@ #include "addressbook-storage.h" #include <sys/types.h> -#include <sys/fcntl.h> +#include <fcntl.h> #include <sys/stat.h> #include <errno.h> diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index 74aceb9c4e..3e3a854dbe 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -218,6 +218,22 @@ send_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path) } static void +copy_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path) +{ + AddressbookView *view = (AddressbookView *) user_data; + if (view->view) + e_addressbook_view_copy_to_folder (view->view); +} + +static void +move_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path) +{ + AddressbookView *view = (AddressbookView *) user_data; + if (view->view) + e_addressbook_view_move_to_folder (view->view); +} + +static void forget_passwords_cb (BonoboUIComponent *uih, void *user_data, const char *path) { e_passwords_forget_passwords(); @@ -234,7 +250,7 @@ update_command_state (EAddressbookView *eav, AddressbookView *view) addressbook_view_ref (view); uic = bonobo_control_get_ui_component (view->control); - + if (bonobo_ui_component_get_container (uic) != CORBA_OBJECT_NIL) { /* New Contact */ @@ -246,7 +262,7 @@ update_command_state (EAddressbookView *eav, AddressbookView *view) "/commands/ContactNewList", "sensitive", e_addressbook_view_can_create (view->view) ? "1" : "0", NULL); - + bonobo_ui_component_set_prop (uic, "/commands/ContactsSaveAsVCard", "sensitive", @@ -255,25 +271,25 @@ update_command_state (EAddressbookView *eav, AddressbookView *view) "/commands/ContactsView", "sensitive", e_addressbook_view_can_view (view->view) ? "1" : "0", NULL); - + /* Print Contact */ bonobo_ui_component_set_prop (uic, "/commands/ContactsPrint", "sensitive", e_addressbook_view_can_print (view->view) ? "1" : "0", NULL); - + /* Print Contact */ bonobo_ui_component_set_prop (uic, "/commands/ContactsPrintPreview", "sensitive", e_addressbook_view_can_print (view->view) ? "1" : "0", NULL); - + /* Delete Contact */ bonobo_ui_component_set_prop (uic, "/commands/ContactDelete", "sensitive", e_addressbook_view_can_delete (view->view) ? "1" : "0", NULL); - + bonobo_ui_component_set_prop (uic, "/commands/ContactsCut", "sensitive", @@ -290,24 +306,31 @@ update_command_state (EAddressbookView *eav, AddressbookView *view) "/commands/ContactsSelectAll", "sensitive", e_addressbook_view_can_select_all (view->view) ? "1" : "0", NULL); - + bonobo_ui_component_set_prop (uic, "/commands/ContactsSendContactToOther", "sensitive", e_addressbook_view_can_send (view->view) ? "1" : "0", NULL); - + bonobo_ui_component_set_prop (uic, "/commands/ContactsSendMessageToContact", "sensitive", e_addressbook_view_can_send_to (view->view) ? "1" : "0", NULL); - - + + bonobo_ui_component_set_prop (uic, + "/commands/ContactsMoveToFolder", + "sensitive", + e_addressbook_view_can_move_to_folder (view->view) ? "1" : "0", NULL); + bonobo_ui_component_set_prop (uic, + "/commands/ContactsCopyToFolder", + "sensitive", + e_addressbook_view_can_copy_to_folder (view->view) ? "1" : "0", NULL); + /* Stop */ bonobo_ui_component_set_prop (uic, "/commands/ContactStop", "sensitive", e_addressbook_view_can_stop (view->view) ? "1" : "0", NULL); - } addressbook_view_unref (view); @@ -340,6 +363,8 @@ static BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("ContactsSendContactToOther", send_contact_cb), BONOBO_UI_UNSAFE_VERB ("ContactsSendMessageToContact", send_contact_to_cb), + BONOBO_UI_UNSAFE_VERB ("ContactsMoveToFolder", move_contact_to_cb), + BONOBO_UI_UNSAFE_VERB ("ContactsCopyToFolder", copy_contact_to_cb), BONOBO_UI_UNSAFE_VERB ("ContactsForgetPasswords", forget_passwords_cb), BONOBO_UI_VERB_END @@ -430,8 +455,9 @@ addressbook_view_unref (AddressbookView *view) { g_assert (view->refs > 0); --view->refs; - if (view->refs == 0) + if (view->refs == 0) { g_free (view); + } } static ECategoriesMasterList * @@ -579,32 +605,6 @@ get_prop (BonoboPropertyBag *bag, } } -char * -addressbook_expand_uri (const char *uri) -{ - char *new_uri; - - if (!strncmp (uri, "file:", 5)) { - if (strlen (uri + 7) > 3 - && !strcmp (uri + strlen(uri) - 3, ".db")) { - /* it's a .db file */ - new_uri = g_strdup (uri); - } - else { - char *file_name; - /* we assume it's a dir and glom addressbook.db onto the end. */ - file_name = g_concat_dir_and_file(uri + 7, "addressbook.db"); - new_uri = g_strdup_printf("file://%s", file_name); - g_free(file_name); - } - } - else { - new_uri = g_strdup (uri); - } - - return new_uri; -} - typedef struct { char *uri; EBookCallback cb; @@ -804,7 +804,7 @@ set_prop (BonoboPropertyBag *bag, view->uri = g_strdup(BONOBO_ARG_GET_STRING (arg)); - uri_data = addressbook_expand_uri (view->uri); + uri_data = e_book_expand_uri (view->uri); if (! addressbook_load_uri (book, uri_data, book_open_cb, view)) printf ("error calling load_uri!\n"); diff --git a/addressbook/gui/component/addressbook.h b/addressbook/gui/component/addressbook.h index 9a99589578..6fb82b710d 100644 --- a/addressbook/gui/component/addressbook.h +++ b/addressbook/gui/component/addressbook.h @@ -9,9 +9,6 @@ Bonobo_ConfigDatabase addressbook_config_database (CORBA_Environment *ev); -/* expand file:///foo/foo/ to file:///foo/foo/addressbook.db */ -char * addressbook_expand_uri (const char *uri); - /* use this instead of e_book_load_uri everywhere where you want the authentication to be handled for you. */ gboolean addressbook_load_uri (EBook *book, const char *uri, EBookCallback cb, gpointer closure); 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; } diff --git a/addressbook/gui/widgets/e-addressbook-util.c b/addressbook/gui/widgets/e-addressbook-util.c index c53e16a45c..ea01e4ec5b 100644 --- a/addressbook/gui/widgets/e-addressbook-util.c +++ b/addressbook/gui/widgets/e-addressbook-util.c @@ -20,11 +20,13 @@ */ #include <config.h> +#include "e-addressbook-util.h" #include <gnome.h> -#include "e-addressbook-util.h" #include "e-card-merging.h" +#include <shell/evolution-shell-client.h> +#include <addressbook/backend/ebook/e-book-util.h> void e_addressbook_error_dialog (const gchar *msg, EBookStatus status) @@ -222,3 +224,160 @@ e_addressbook_show_multiple_cards (EBook *book, } } } + + + +typedef struct CardCopyProcess_ CardCopyProcess; + +typedef void (*CardCopyDone) (CardCopyProcess *process); + +struct CardCopyProcess_ { + int count; + GList *cards; + EBook *source; + EBook *destination; + CardCopyDone done_cb; +}; + +static void +card_deleted_cb (EBook* book, EBookStatus status, gpointer user_data) +{ + if (status != E_BOOK_STATUS_SUCCESS) { + e_addressbook_error_dialog (_("Error removing card"), status); + } +} + +static void +do_delete (gpointer data, gpointer user_data) +{ + EBook *book = user_data; + ECard *card = data; + + e_book_remove_card(book, card, card_deleted_cb, NULL); +} + +static void +delete_cards (CardCopyProcess *process) +{ + g_list_foreach (process->cards, + do_delete, + process->source); +} + +static void +process_unref (CardCopyProcess *process) +{ + process->count --; + if (process->count == 0) { + if (process->done_cb) { + process->done_cb (process); + } + e_free_object_list(process->cards); + gtk_object_unref (GTK_OBJECT (process->source)); + gtk_object_unref (GTK_OBJECT (process->destination)); + g_free (process); + } +} + +static void +card_added_cb (EBook* book, EBookStatus status, const char *id, gpointer user_data) +{ + CardCopyProcess *process = user_data; + + if (status != E_BOOK_STATUS_SUCCESS) { + e_addressbook_error_dialog (_("Error adding card"), status); + } else { + process_unref (process); + } +} + +static void +do_copy (gpointer data, gpointer user_data) +{ + EBook *book; + ECard *card; + CardCopyProcess *process; + + process = user_data; + card = data; + + book = process->destination; + + process->count ++; + e_book_add_card(book, card, card_added_cb, process); +} + +static void +got_book_cb (EBook *book, gpointer closure) +{ + CardCopyProcess *process; + process = closure; + if (book) { + process->destination = book; + gtk_object_ref (GTK_OBJECT (book)); + g_list_foreach (process->cards, + do_copy, + process); + } + process_unref (process); +} + +void +e_addressbook_transfer_cards (EBook *source, GList *cards /* adopted */, gboolean delete_from_source, GtkWindow *parent_window) +{ + const char *allowed_types[] = { "contacts", NULL }; + extern EvolutionShellClient *global_shell_client; + char *uri, *physical, *path, *desc; + static char *last = NULL; + CardCopyProcess *process; + + if (cards == NULL) + return; + + if (last == NULL) + last = g_strdup (""); + + if (cards->next == NULL) { + if (delete_from_source) + desc = _("Move card to"); + else + desc = _("Copy card to"); + } else { + if (delete_from_source) + desc = _("Move cards to"); + else + desc = _("Copy cards to"); + } + + uri = NULL; + physical = NULL; + evolution_shell_client_user_select_folder (global_shell_client, + parent_window, + desc, last, + allowed_types, &uri, &physical); + if (!uri) + return; + + path = strchr (uri, '/'); + if (path && strcmp (last, path) != 0) { + g_free (last); + last = g_strdup_printf ("evolution:%s", path); + } + g_free (uri); + + process = g_new (CardCopyProcess, 1); + process->count = 1; + process->source = source; + gtk_object_ref (GTK_OBJECT (source)); + process->cards = cards; + process->destination = NULL; + + if (delete_from_source) + process->done_cb = delete_cards; + else + process->done_cb = NULL; + + e_book_use_address_book_by_uri (physical, got_book_cb, process); + + g_free(physical); +} diff --git a/addressbook/gui/widgets/e-addressbook-util.h b/addressbook/gui/widgets/e-addressbook-util.h index 3fa28a542d..f0681cea4d 100644 --- a/addressbook/gui/widgets/e-addressbook-util.h +++ b/addressbook/gui/widgets/e-addressbook-util.h @@ -43,6 +43,10 @@ EContactListEditor *e_addressbook_show_contact_list_editor (EBook *book, void e_addressbook_show_multiple_cards (EBook *book, GList *list, gboolean editable); +void e_addressbook_transfer_cards (EBook *source, + GList *cards, /* adopted */ + gboolean delete_from_source, + GtkWindow *parent_window); #ifdef __cplusplus } diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c index 1ed12066cc..93da4c8c29 100644 --- a/addressbook/gui/widgets/e-addressbook-view.c +++ b/addressbook/gui/widgets/e-addressbook-view.c @@ -468,7 +468,8 @@ display_view(GalViewInstance *instance, gal_view_etable_attach_table (GAL_VIEW_ETABLE(view), e_table_scrolled_get_table(E_TABLE_SCROLLED(address_view->widget))); } else if (GAL_IS_VIEW_MINICARD(view)) { change_view_type (address_view, E_ADDRESSBOOK_VIEW_MINICARD); - gal_view_minicard_attach (GAL_VIEW_MINICARD(view), E_MINICARD_VIEW (E_MINICARD_VIEW_WIDGET (address_view->object)->emv)); + if (address_view->object && E_MINICARD_VIEW_WIDGET (address_view->object)->emv) + gal_view_minicard_attach (GAL_VIEW_MINICARD(view), E_MINICARD_VIEW (E_MINICARD_VIEW_WIDGET (address_view->object)->emv)); } address_view->current_view = view; } @@ -998,6 +999,20 @@ delete (GtkWidget *widget, CardAndBook *card_and_book) card_and_book_free(card_and_book); } +static void +copy_to_folder (GtkWidget *widget, CardAndBook *card_and_book) +{ + e_addressbook_view_copy_to_folder (card_and_book->view); + card_and_book_free (card_and_book); +} + +static void +move_to_folder (GtkWidget *widget, CardAndBook *card_and_book) +{ + e_addressbook_view_move_to_folder (card_and_book->view); + 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) @@ -1014,11 +1029,17 @@ 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 + 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}, {N_("Delete"), NULL, GTK_SIGNAL_FUNC(delete), NULL, POPUP_READONLY_MASK}, - {NULL, NULL, NULL, NULL, 0} + E_POPUP_TERMINATOR }; card_and_book = g_new(CardAndBook, 1); @@ -1303,16 +1324,18 @@ e_addressbook_view_discard_menus (EAddressbookView *view) g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view)); g_return_if_fail (view->view_instance); - if (view->view_instance) { - gtk_object_unref (GTK_OBJECT (view->view_instance)); - view->view_instance = NULL; - } - if (view->view_menus) { + gal_view_menus_unmerge (view->view_menus, NULL); + gtk_object_unref (GTK_OBJECT (view->view_menus)); view->view_menus = NULL; } + if (view->view_instance) { + gtk_object_unref (GTK_OBJECT (view->view_instance)); + view->view_instance = NULL; + } + view->uic = NULL; } @@ -1699,6 +1722,35 @@ e_addressbook_view_stop(EAddressbookView *view) e_addressbook_model_stop (view->model); } +static void +view_transfer_cards (EAddressbookView *view, gboolean delete_from_source) +{ + EBook *book; + GList *cards; + GtkWindow *parent_window; + + gtk_object_get(GTK_OBJECT(view->model), + "book", &book, + NULL); + cards = get_selected_cards (view); + parent_window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view))); + + e_addressbook_transfer_cards (book, cards, delete_from_source, parent_window); +} + +void +e_addressbook_view_copy_to_folder (EAddressbookView *view) +{ + view_transfer_cards (view, FALSE); +} + +void +e_addressbook_view_move_to_folder (EAddressbookView *view) +{ + view_transfer_cards (view, TRUE); +} + + static gboolean e_addressbook_view_selection_nonempty (EAddressbookView *view) { @@ -1783,3 +1835,14 @@ e_addressbook_view_can_stop (EAddressbookView *view) return view ? e_addressbook_model_can_stop (view->model) : FALSE; } +gboolean +e_addressbook_view_can_copy_to_folder (EAddressbookView *view) +{ + return view ? e_addressbook_view_selection_nonempty (view) : FALSE; +} + +gboolean +e_addressbook_view_can_move_to_folder (EAddressbookView *view) +{ + return view ? e_addressbook_view_selection_nonempty (view) && e_addressbook_model_editable (view->model) : FALSE; +} diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h index 98258ab88c..58511845bd 100644 --- a/addressbook/gui/widgets/e-addressbook-view.h +++ b/addressbook/gui/widgets/e-addressbook-view.h @@ -99,39 +99,44 @@ struct _EAddressbookViewClass void (*alphabet_state_change) (EAddressbookView *view, gunichar letter); }; -GtkWidget *e_addressbook_view_new (void); -GtkType e_addressbook_view_get_type (void); - -void e_addressbook_view_setup_menus (EAddressbookView *view, - BonoboUIComponent *uic); -void e_addressbook_view_discard_menus (EAddressbookView *view); - -void e_addressbook_view_save_as (EAddressbookView *view); -void e_addressbook_view_view (EAddressbookView *view); -void e_addressbook_view_send (EAddressbookView *view); -void e_addressbook_view_send_to (EAddressbookView *view); -void e_addressbook_view_print (EAddressbookView *view); -void e_addressbook_view_print_preview (EAddressbookView *view); -void e_addressbook_view_delete_selection (EAddressbookView *view); -void e_addressbook_view_cut (EAddressbookView *view); -void e_addressbook_view_copy (EAddressbookView *view); -void e_addressbook_view_paste (EAddressbookView *view); -void e_addressbook_view_select_all (EAddressbookView *view); -void e_addressbook_view_show_all (EAddressbookView *view); -void e_addressbook_view_stop (EAddressbookView *view); - -gboolean e_addressbook_view_can_create (EAddressbookView *view); -gboolean e_addressbook_view_can_print (EAddressbookView *view); -gboolean e_addressbook_view_can_save_as (EAddressbookView *view); -gboolean e_addressbook_view_can_view (EAddressbookView *view); -gboolean e_addressbook_view_can_send (EAddressbookView *view); -gboolean e_addressbook_view_can_send_to (EAddressbookView *view); -gboolean e_addressbook_view_can_delete (EAddressbookView *view); -gboolean e_addressbook_view_can_cut (EAddressbookView *view); -gboolean e_addressbook_view_can_copy (EAddressbookView *view); -gboolean e_addressbook_view_can_paste (EAddressbookView *view); -gboolean e_addressbook_view_can_select_all (EAddressbookView *view); -gboolean e_addressbook_view_can_stop (EAddressbookView *view); +GtkWidget *e_addressbook_view_new (void); +GtkType e_addressbook_view_get_type (void); + +void e_addressbook_view_setup_menus (EAddressbookView *view, + BonoboUIComponent *uic); + +void e_addressbook_view_discard_menus (EAddressbookView *view); + +void e_addressbook_view_save_as (EAddressbookView *view); +void e_addressbook_view_view (EAddressbookView *view); +void e_addressbook_view_send (EAddressbookView *view); +void e_addressbook_view_send_to (EAddressbookView *view); +void e_addressbook_view_print (EAddressbookView *view); +void e_addressbook_view_print_preview (EAddressbookView *view); +void e_addressbook_view_delete_selection (EAddressbookView *view); +void e_addressbook_view_cut (EAddressbookView *view); +void e_addressbook_view_copy (EAddressbookView *view); +void e_addressbook_view_paste (EAddressbookView *view); +void e_addressbook_view_select_all (EAddressbookView *view); +void e_addressbook_view_show_all (EAddressbookView *view); +void e_addressbook_view_stop (EAddressbookView *view); +void e_addressbook_view_copy_to_folder (EAddressbookView *view); +void e_addressbook_view_move_to_folder (EAddressbookView *view); + +gboolean e_addressbook_view_can_create (EAddressbookView *view); +gboolean e_addressbook_view_can_print (EAddressbookView *view); +gboolean e_addressbook_view_can_save_as (EAddressbookView *view); +gboolean e_addressbook_view_can_view (EAddressbookView *view); +gboolean e_addressbook_view_can_send (EAddressbookView *view); +gboolean e_addressbook_view_can_send_to (EAddressbookView *view); +gboolean e_addressbook_view_can_delete (EAddressbookView *view); +gboolean e_addressbook_view_can_cut (EAddressbookView *view); +gboolean e_addressbook_view_can_copy (EAddressbookView *view); +gboolean e_addressbook_view_can_paste (EAddressbookView *view); +gboolean e_addressbook_view_can_select_all (EAddressbookView *view); +gboolean e_addressbook_view_can_stop (EAddressbookView *view); +gboolean e_addressbook_view_can_copy_to_folder (EAddressbookView *view); +gboolean e_addressbook_view_can_move_to_folder (EAddressbookView *view); #ifdef __cplusplus } diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h index 39fb929bea..4cf3a72d93 100644 --- a/addressbook/gui/widgets/e-minicard-view-widget.h +++ b/addressbook/gui/widgets/e-minicard-view-widget.h @@ -44,7 +44,6 @@ struct _EMinicardViewWidget { ECanvas parent; - GnomeCanvasItem *rect; GnomeCanvasItem *emv; EAddressbookReflowAdapter *adapter; |