aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component
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/component
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/component')
-rw-r--r--addressbook/gui/component/addressbook-component.c2
-rw-r--r--addressbook/gui/component/addressbook-storage.c2
-rw-r--r--addressbook/gui/component/addressbook.c78
-rw-r--r--addressbook/gui/component/addressbook.h3
4 files changed, 41 insertions, 44 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);