diff options
author | Devashish Sharma <dsharma@src.gnome.org> | 2006-01-23 19:32:11 +0800 |
---|---|---|
committer | Devashish Sharma <dsharma@src.gnome.org> | 2006-01-23 19:32:11 +0800 |
commit | dd5f09119558ec41adf7f519e5ca0aa347f83e4c (patch) | |
tree | 27492f0d83f675f94a9dd2d3a1c4ab21ca4ae1cd /plugins | |
parent | 7b6cb9acabb2395294ce70e12df6ec4ac5416b67 (diff) | |
download | gsoc2013-evolution-dd5f09119558ec41adf7f519e5ca0aa347f83e4c.tar gsoc2013-evolution-dd5f09119558ec41adf7f519e5ca0aa347f83e4c.tar.gz gsoc2013-evolution-dd5f09119558ec41adf7f519e5ca0aa347f83e4c.tar.bz2 gsoc2013-evolution-dd5f09119558ec41adf7f519e5ca0aa347f83e4c.tar.lz gsoc2013-evolution-dd5f09119558ec41adf7f519e5ca0aa347f83e4c.tar.xz gsoc2013-evolution-dd5f09119558ec41adf7f519e5ca0aa347f83e4c.tar.zst gsoc2013-evolution-dd5f09119558ec41adf7f519e5ca0aa347f83e4c.zip |
Added an option to select a different addressbook for gaim buddies. Earlier it used the same addressbook as that used by Automatic Contacts.
svn path=/trunk/; revision=31277
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/bbdb/ChangeLog | 8 | ||||
-rw-r--r-- | plugins/bbdb/bbdb.c | 56 | ||||
-rw-r--r-- | plugins/bbdb/bbdb.h | 7 | ||||
-rw-r--r-- | plugins/bbdb/gaimbuddies.c | 6 |
4 files changed, 61 insertions, 16 deletions
diff --git a/plugins/bbdb/ChangeLog b/plugins/bbdb/ChangeLog index b06b3a2e7f..69452e06dd 100644 --- a/plugins/bbdb/ChangeLog +++ b/plugins/bbdb/ChangeLog @@ -1,3 +1,11 @@ +2006-01-23 Devashish Sharma <sdevashish@novell.com> + + * bbdb.c : + * gaimbuddies.c : + Added provision for having the gaimbuddies synced to a separate + addressbook. Earlier it used the same addressbook as used for + Automatic Contacts. + 2006-01-19 Andre Klapper <a9016009@gmx.de> * org-gnome-evolution-bbdb.eplug.xml: diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c index 0021d81f21..4eea3fb3fb 100644 --- a/plugins/bbdb/bbdb.c +++ b/plugins/bbdb/bbdb.c @@ -61,6 +61,7 @@ struct bbdb_stuff { ESourceList *source_list; GtkWidget *option_menu; + GtkWidget *gaim_option_menu; GtkWidget *check; GtkWidget *check_gaim; }; @@ -71,7 +72,7 @@ static void bbdb_do_it (EBook *book, const char *name, const char *email); static void add_email_to_contact (EContact *contact, const char *email); static void enable_toggled_cb (GtkWidget *widget, gpointer data); static void source_changed_cb (GtkWidget *widget, ESource *source, gpointer data); -static GtkWidget *create_addressbook_option_menu (struct bbdb_stuff *stuff); +static GtkWidget *create_addressbook_option_menu (struct bbdb_stuff *stuff, int type); static void cleanup_cb (GObject *o, gpointer data); int @@ -110,7 +111,7 @@ bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target) int i; /* Open the addressbook */ - book = bbdb_open_addressbook (); + book = bbdb_open_addressbook (AUTOMATIC_CONTACTS_ADDRESSBOOK); if (book == NULL) return; @@ -246,7 +247,7 @@ bbdb_do_it (EBook *book, const char *name, const char *email) } EBook * -bbdb_open_addressbook (void) +bbdb_open_addressbook (int type) { GConfClient *gconf; char *uri; @@ -267,7 +268,10 @@ bbdb_open_addressbook (void) } /* Open the appropriate addresbook. */ - uri = gconf_client_get_string (gconf, GCONF_KEY_WHICH_ADDRESSBOOK, NULL); + if (type == GAIM_ADDRESSBOOK) + uri = gconf_client_get_string (gconf, GCONF_KEY_WHICH_ADDRESSBOOK_GAIM, NULL); + else + uri = gconf_client_get_string (gconf, GCONF_KEY_WHICH_ADDRESSBOOK, NULL); g_object_unref (G_OBJECT (gconf)); if (uri == NULL) book = e_book_new_system_addressbook (&error); @@ -341,6 +345,8 @@ enable_gaim_toggled_cb (GtkWidget *widget, gpointer data) /* Save the new setting to gconf */ gconf_client_set_bool (stuff->target->gconf, GCONF_KEY_ENABLE_GAIM, active, NULL); + + gtk_widget_set_sensitive (stuff->gaim_option_menu, active); } static void @@ -357,8 +363,15 @@ source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) gconf_client_set_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK, e_source_get_uri (source), NULL); } +static void +gaim_source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) +{ + struct bbdb_stuff *stuff = (struct bbdb_stuff *) data; + gconf_client_set_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK_GAIM, e_source_get_uri (source), NULL); +} + static GtkWidget * -create_addressbook_option_menu (struct bbdb_stuff *stuff) +create_addressbook_option_menu (struct bbdb_stuff *stuff, int type) { GtkWidget *menu; ESourceList *source_list; @@ -370,7 +383,10 @@ create_addressbook_option_menu (struct bbdb_stuff *stuff) source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/addressbook/sources"); menu = e_source_option_menu_new (source_list); - selected_source_uri = gconf_client_get_string (gconf, GCONF_KEY_WHICH_ADDRESSBOOK, NULL); + if (type == GAIM_ADDRESSBOOK) + selected_source_uri = gconf_client_get_string (gconf, GCONF_KEY_WHICH_ADDRESSBOOK_GAIM, NULL); + else + selected_source_uri = gconf_client_get_string (gconf, GCONF_KEY_WHICH_ADDRESSBOOK, NULL); if (selected_source_uri != NULL) { selected_source = e_source_new_with_absolute_uri ("", selected_source_uri); e_source_option_menu_select (E_SOURCE_OPTION_MENU (menu), selected_source); @@ -397,7 +413,10 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) GtkWidget *inner_vbox; GtkWidget *check; GtkWidget *option; + GtkWidget *gaim_option; GtkWidget *check_gaim; + GtkWidget *label; + GtkWidget *gaim_label; GtkWidget *button; /* A structure to pass some stuff around */ @@ -419,7 +438,7 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) gtk_label_set_markup (GTK_LABEL (frame_label), _("<span weight=\"bold\">Automatic Contacts</span>")); GTK_MISC (frame_label)->xalign = 0.0; gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0); - + /* Indent/padding */ hbox = gtk_hbox_new (FALSE, 12); gtk_box_pack_start (GTK_BOX (frame), hbox, FALSE, TRUE, 0); @@ -434,9 +453,12 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) g_signal_connect (GTK_TOGGLE_BUTTON (check), "toggled", G_CALLBACK (enable_toggled_cb), stuff); gtk_box_pack_start (GTK_BOX (inner_vbox), check, FALSE, FALSE, 0); stuff->check = check; - - /* Source selection open menu */ - option = create_addressbook_option_menu (stuff); + + label = gtk_label_new ("Select Address book for Automatic Contacts"); + gtk_box_pack_start (GTK_BOX (inner_vbox), label, FALSE, FALSE, 0); + + /* Source selection option menu */ + option = create_addressbook_option_menu (stuff, AUTOMATIC_CONTACTS_ADDRESSBOOK); g_signal_connect (option, "source_selected", G_CALLBACK (source_changed_cb), stuff); gtk_widget_set_sensitive (option, gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE, NULL)); gtk_box_pack_start (GTK_BOX (inner_vbox), option, FALSE, FALSE, 0); @@ -458,13 +480,23 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) gtk_box_pack_start (GTK_BOX (hbox), padding_label, FALSE, FALSE, 0); inner_vbox = gtk_vbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (hbox), inner_vbox, FALSE, FALSE, 0); - + /* Enable Gaim Checkbox */ - check_gaim = gtk_check_button_new_with_mnemonic (_("Periodically synchronize contact information and images from my _instant messenger")); + check_gaim = gtk_check_button_new_with_mnemonic (_("Periodically synchronize contact information and images from gaim buddy list")); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_gaim), gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE_GAIM, NULL)); g_signal_connect (GTK_TOGGLE_BUTTON (check_gaim), "toggled", G_CALLBACK (enable_gaim_toggled_cb), stuff); gtk_box_pack_start (GTK_BOX (inner_vbox), check_gaim, FALSE, FALSE, 0); stuff->check_gaim = check_gaim; + + gaim_label = gtk_label_new ("Select Address book for Gaim buddy list"); + gtk_box_pack_start (GTK_BOX (inner_vbox), gaim_label, FALSE, FALSE, 0); + + /* Gaim Source Selection Option Menu */ + gaim_option = create_addressbook_option_menu (stuff, GAIM_ADDRESSBOOK); + g_signal_connect (gaim_option, "source_selected", G_CALLBACK (gaim_source_changed_cb), stuff); + gtk_widget_set_sensitive (gaim_option, gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE_GAIM, NULL)); + gtk_box_pack_start (GTK_BOX (inner_vbox), gaim_option, FALSE, FALSE, 0); + stuff->gaim_option_menu = gaim_option; /* Synchronize now button. */ button = gtk_button_new_with_mnemonic (_("Synchronize with _buddy list now")); diff --git a/plugins/bbdb/bbdb.h b/plugins/bbdb/bbdb.h index 5fe9e39bdd..d1318b7d03 100644 --- a/plugins/bbdb/bbdb.h +++ b/plugins/bbdb/bbdb.h @@ -5,13 +5,18 @@ #define GCONF_KEY_ENABLE "/apps/evolution/autocontacts/enable_autocontacts" #define GCONF_KEY_ENABLE_GAIM "/apps/evolution/autocontacts/auto_sync_gaim" #define GCONF_KEY_WHICH_ADDRESSBOOK "/apps/evolution/autocontacts/addressbook_source" +#define GCONF_KEY_WHICH_ADDRESSBOOK_GAIM "/apps/evolution/autocontacts/gaim_addressbook_source" #define GCONF_KEY_GAIM_LAST_SYNC "/apps/evolution/autocontacts/gaim_last_sync_time" +#define GAIM_ADDRESSBOOK 1 +#define AUTOMATIC_CONTACTS_ADDRESSBOOK 0 + + /* How often to poll the buddy list for changes (every two minutes) */ #define BBDB_BLIST_CHECK_INTERVAL (2 * 60 * 1000) /* bbdb.c */ -EBook *bbdb_open_addressbook (void); +EBook *bbdb_open_addressbook (int type); gboolean bbdb_check_gaim_enabled (void); /* gaimbuddies.c */ diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c index 54364bfd59..d4d104bbf1 100644 --- a/plugins/bbdb/gaimbuddies.c +++ b/plugins/bbdb/gaimbuddies.c @@ -61,7 +61,7 @@ typedef struct { } GaimBuddy; /* Defined in bbdb.c */ -EBook *bbdb_open_addressbook (void); +EBook *bbdb_open_addressbook (int type); /* Forward declarations for this file. */ void bbdb_sync_buddy_list (void); @@ -125,7 +125,7 @@ bbdb_sync_buddy_list (void) return; /* Open the addressbook */ - book = bbdb_open_addressbook (); + book = bbdb_open_addressbook (GAIM_ADDRESSBOOK); if (book == NULL) { free_buddy_list (blist); return; @@ -141,7 +141,7 @@ bbdb_sync_buddy_list (void) EContact *c; if (b->alias == NULL || strlen (b->alias) == 0) - continue; + b->alias = b->account_name; /* Look for an exact match full name == buddy alias */ query = e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, b->alias); |