aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2007-10-23 02:49:30 +0800
committerMatthew Barnes <mbarnes@src.gnome.org>2007-10-23 02:49:30 +0800
commitb37af8f269484ebd836996c140ea718885954ca3 (patch)
tree8ed883fcc7c60b5200be9438514902accd991cd1 /plugins
parent16af69fb17d52a18b0c308e8ed137f71d2dba1fa (diff)
downloadgsoc2013-evolution-b37af8f269484ebd836996c140ea718885954ca3.tar.gz
gsoc2013-evolution-b37af8f269484ebd836996c140ea718885954ca3.tar.zst
gsoc2013-evolution-b37af8f269484ebd836996c140ea718885954ca3.zip
** Fixes part of bug #417999
2007-10-22 Matthew Barnes <mbarnes@redhat.com> ** Fixes part of bug #417999 * addressbook/gui/contact-editor/contact-editor.glade: * addressbook/gui/contact-editor/e-contact-editor.c: * addressbook/gui/contact-editor/e-contact-quick-add.c: * addressbook/gui/contact-list-editor/contact-list-editor.c: * addressbook/gui/contact-list-editor/contact-list-editor.glade: * calendar/gui/dialogs/event-page.c: * calendar/gui/dialogs/event-page.glade: * calendar/gui/dialogs/memo-page.c: * calendar/gui/dialogs/memo-page.glade: * calendar/gui/dialogs/task-page.c: * calendar/gui/dialogs/task-page.glade: * calendar/gui/e-itip-control.c: * plugins/bbdb/bbdb.c: * plugins/bbdb/gaimbuddies.c: * plugins/itip-formatter/itip-view.c: * widgets/misc/e-pilot-settings.c: Use ESourceComboBox instead of ESourceOptionMenu (deprecated). svn path=/trunk/; revision=34408
Diffstat (limited to 'plugins')
-rw-r--r--plugins/bbdb/ChangeLog8
-rw-r--r--plugins/bbdb/bbdb.c132
-rw-r--r--plugins/bbdb/gaimbuddies.c2
-rw-r--r--plugins/itip-formatter/ChangeLog7
-rw-r--r--plugins/itip-formatter/itip-formatter.c1
-rw-r--r--plugins/itip-formatter/itip-view.c60
6 files changed, 157 insertions, 53 deletions
diff --git a/plugins/bbdb/ChangeLog b/plugins/bbdb/ChangeLog
index bb17fd32c8..78810928ba 100644
--- a/plugins/bbdb/ChangeLog
+++ b/plugins/bbdb/ChangeLog
@@ -1,3 +1,11 @@
+2007-10-22 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #417999
+
+ * bbdb.c:
+ * gaimbuddies.c:
+ Use ESourceComboBox instead of ESourceOptionMenu (deprecated).
+
2007-10-09 Matthew Barnes <mbarnes@redhat.com>
** Fixes part of bug #437579
diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c
index 17eb26f176..a4b363af51 100644
--- a/plugins/bbdb/bbdb.c
+++ b/plugins/bbdb/bbdb.c
@@ -40,7 +40,7 @@
#include <string.h>
#include <libebook/e-book.h>
-#include <libedataserverui/e-source-option-menu.h>
+#include <libedataserverui/e-source-combo-box.h>
#include <e-util/e-config.h>
#include <mail/em-config.h>
@@ -71,10 +71,49 @@ static gboolean bbdb_timeout (gpointer data);
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 void source_changed_cb (ESourceComboBox *source_combo_box, struct bbdb_stuff *stuff);
static GtkWidget *create_addressbook_option_menu (struct bbdb_stuff *stuff, int type);
static void cleanup_cb (GObject *o, gpointer data);
+static ESource *
+find_esource_by_uri (ESourceList *source_list, const gchar *target_uri)
+{
+ GSList *groups;
+
+ /* XXX This would be unnecessary if the plugin had stored
+ * the addressbook's UID instead of the URI in GConf.
+ * Too late to change it now, I suppose. */
+
+ if (source_list == NULL || target_uri == NULL)
+ return NULL;
+
+ groups = e_source_list_peek_groups (source_list);
+
+ while (groups != NULL) {
+ GSList *sources;
+
+ sources = e_source_group_peek_sources (groups->data);
+
+ while (sources != NULL) {
+ gchar *uri;
+ gboolean match;
+
+ uri = e_source_get_uri (sources->data);
+ match = (strcmp (uri, target_uri) == 0);
+ g_free (uri);
+
+ if (match)
+ return sources->data;
+
+ sources = g_slist_next (sources);
+ }
+
+ groups = g_slist_next (groups);
+ }
+
+ return NULL;
+}
+
int
e_plugin_lib_enable (EPluginLib *ep, int enable)
{
@@ -343,8 +382,23 @@ enable_toggled_cb (GtkWidget *widget, gpointer data)
gtk_widget_set_sensitive (stuff->option_menu, active);
if (active && !gconf_client_get_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK, NULL)) {
- selected_source = e_source_option_menu_peek_selected (E_SOURCE_OPTION_MENU (stuff->option_menu));
- gconf_client_set_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK, e_source_get_uri (selected_source), NULL);
+ const gchar *uri = NULL;
+ GError *error = NULL;
+
+ selected_source = e_source_combo_box_get_active (
+ E_SOURCE_COMBO_BOX (stuff->option_menu));
+ if (selected_source != NULL)
+ uri = e_source_get_uri (selected_source);
+
+ gconf_client_set_string (
+ stuff->target->gconf,
+ GCONF_KEY_WHICH_ADDRESSBOOK,
+ uri, &error);
+
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
}
}
@@ -362,7 +416,8 @@ enable_gaim_toggled_cb (GtkWidget *widget, gpointer data)
gtk_widget_set_sensitive (stuff->gaim_option_menu, active);
if (active && !gconf_client_get_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK_GAIM, NULL)) {
- selected_source = e_source_option_menu_peek_selected (E_SOURCE_OPTION_MENU (stuff->gaim_option_menu));
+ selected_source = e_source_combo_box_get_active (
+ E_SOURCE_COMBO_BOX (stuff->gaim_option_menu));
gconf_client_set_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK_GAIM, e_source_get_uri (selected_source), NULL);
}
}
@@ -374,48 +429,77 @@ synchronize_button_clicked_cb (GtkWidget *button)
}
static void
-source_changed_cb (GtkWidget *widget, ESource *source, gpointer data)
+source_changed_cb (ESourceComboBox *source_combo_box,
+ struct bbdb_stuff *stuff)
{
- struct bbdb_stuff *stuff = (struct bbdb_stuff *) data;
-
- gconf_client_set_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK, e_source_get_uri (source), NULL);
+ ESource *source;
+ GError *error = NULL;
+
+ source = e_source_combo_box_get_active (source_combo_box);
+ g_return_if_fail (source != NULL);
+
+ gconf_client_set_string (
+ stuff->target->gconf,
+ GCONF_KEY_WHICH_ADDRESSBOOK,
+ e_source_get_uri (source), &error);
+
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
}
static void
-gaim_source_changed_cb (GtkWidget *widget, ESource *source, gpointer data)
+gaim_source_changed_cb (ESourceComboBox *source_combo_box,
+ struct bbdb_stuff *stuff)
{
- 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);
+ ESource *source;
+ GError *error = NULL;
+
+ source = e_source_combo_box_get_active (source_combo_box);
+ g_return_if_fail (source != NULL);
+
+ gconf_client_set_string (
+ stuff->target->gconf,
+ GCONF_KEY_WHICH_ADDRESSBOOK_GAIM,
+ e_source_get_uri (source), &error);
+
+ if (error != NULL) {
+ g_warning ("%s", error->message);
+ g_error_free (error);
+ }
}
static GtkWidget *
create_addressbook_option_menu (struct bbdb_stuff *stuff, int type)
{
- GtkWidget *menu;
+ GtkWidget *combo_box;
ESourceList *source_list;
- char *selected_source_uri;
ESource *selected_source;
+ char *selected_source_uri;
GConfClient *gconf = stuff->target->gconf;
source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/addressbook/sources");
- menu = e_source_option_menu_new (source_list);
+ combo_box = e_source_combo_box_new (source_list);
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);
- g_free (selected_source_uri);
- }
+ selected_source = find_esource_by_uri (
+ source_list, selected_source_uri);
+ g_free (selected_source_uri);
+
+ if (selected_source != NULL)
+ e_source_combo_box_set_active (
+ E_SOURCE_COMBO_BOX (combo_box), selected_source);
- gtk_widget_show (menu);
+ gtk_widget_show (combo_box);
stuff->source_list = source_list;
- return menu;
+ return combo_box;
}
GtkWidget *
@@ -481,7 +565,7 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
/* 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);
+ g_signal_connect (option, "changed", 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);
stuff->option_menu = option;
@@ -517,7 +601,7 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data)
/* 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);
+ g_signal_connect (gaim_option, "changed", 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;
diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c
index 09a2f1d6c6..6c91b06be4 100644
--- a/plugins/bbdb/gaimbuddies.c
+++ b/plugins/bbdb/gaimbuddies.c
@@ -44,7 +44,7 @@
#include <string.h>
#include <libebook/e-book.h>
-#include <libedataserverui/e-source-option-menu.h>
+#include <libedataserverui/e-source-combo-box.h>
#include <sys/time.h>
#include <sys/stat.h>
diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog
index b453e46dcd..5aed2a1f68 100644
--- a/plugins/itip-formatter/ChangeLog
+++ b/plugins/itip-formatter/ChangeLog
@@ -1,3 +1,10 @@
+2007-10-22 Matthew Barnes <mbarnes@redhat.com>
+
+ ** Fixes part of bug #417999
+
+ * itip-view.c:
+ Use ESourceComboBox instead of ESourceOptionMenu (deprecated).
+
2007-10-04 Milan Crha <mcrha@redhat.com>
** Fix for bug #331578
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 952f45a622..e44740ff6e 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -40,7 +40,6 @@
#include <camel/camel-store.h>
#include <libecal/e-cal.h>
#include <libecal/e-cal-time-util.h>
-#include <libedataserverui/e-source-option-menu.h>
#include <libedataserverui/e-source-selector.h>
#include <gtkhtml/gtkhtml-embedded.h>
#include <mail/em-format-hook.h>
diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c
index acc4f50fb2..f6e2e06855 100644
--- a/plugins/itip-formatter/itip-view.c
+++ b/plugins/itip-formatter/itip-view.c
@@ -35,7 +35,7 @@
#include <camel/camel-mime-message.h>
#include <libedataserver/e-time-utils.h>
#include <libedataserver/e-data-server-util.h>
-#include <libedataserverui/e-source-option-menu.h>
+#include <libedataserverui/e-source-combo-box.h>
#include <libecal/e-cal.h>
#include <libecal/e-cal-time-util.h>
#include <gtkhtml/gtkhtml-embedded.h>
@@ -105,8 +105,8 @@ struct _ItipViewPrivate {
char *description;
GtkWidget *selector_box;
- GtkWidget *esom;
- GtkWidget *esom_header;
+ GtkWidget *escb;
+ GtkWidget *escb_header;
ESourceList *source_list;
GtkWidget *rsvp_box;
@@ -1791,10 +1791,12 @@ itip_view_clear_lower_info_items (ItipView *view)
}
static void
-source_selected_cb (ESourceOptionMenu *esom, ESource *source, gpointer data)
+source_changed_cb (ESourceComboBox *escb, ItipView *view)
{
- ItipView *view = data;
-
+ ESource *source;
+
+ source = e_source_combo_box_get_active (escb);
+
g_signal_emit (view, signals[SOURCE_SELECTED], 0, source);
}
@@ -1811,40 +1813,42 @@ itip_view_set_source_list (ItipView *view, ESourceList *source_list)
if (priv->source_list)
g_object_unref (priv->source_list);
- if (priv->esom)
- gtk_widget_destroy (priv->esom);
+ if (priv->escb)
+ gtk_widget_destroy (priv->escb);
if (!source_list) {
- if (priv->esom_header)
- gtk_widget_destroy (priv->esom_header);
+ if (priv->escb_header)
+ gtk_widget_destroy (priv->escb_header);
priv->source_list = NULL;
- priv->esom = NULL;
- priv->esom_header = NULL;
+ priv->escb = NULL;
+ priv->escb_header = NULL;
return;
}
priv->source_list = g_object_ref (source_list);
- priv->esom = e_source_option_menu_new (source_list);
- gtk_widget_show (priv->esom);
- g_signal_connect (priv->esom, "source_selected", G_CALLBACK (source_selected_cb), view);
+ priv->escb = e_source_combo_box_new (source_list);
+ gtk_widget_show (priv->escb);
+ g_signal_connect (
+ priv->escb, "changed",
+ G_CALLBACK (source_changed_cb), view);
- if (!priv->esom_header) {
+ if (!priv->escb_header) {
if (priv->type == E_CAL_SOURCE_TYPE_EVENT)
- priv->esom_header = gtk_label_new_with_mnemonic (_("_Calendar:"));
+ priv->escb_header = gtk_label_new_with_mnemonic (_("_Calendar:"));
else if (priv->type == E_CAL_SOURCE_TYPE_TODO)
- priv->esom_header = gtk_label_new_with_mnemonic (_("_Tasks :"));
+ priv->escb_header = gtk_label_new_with_mnemonic (_("_Tasks :"));
else if (priv->type == E_CAL_SOURCE_TYPE_JOURNAL)
- priv->esom_header = gtk_label_new_with_mnemonic (_("Memos :"));
+ priv->escb_header = gtk_label_new_with_mnemonic (_("Memos :"));
- gtk_label_set_mnemonic_widget (GTK_LABEL (priv->esom_header), priv->esom);
- gtk_widget_show (priv->esom_header);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (priv->escb_header), priv->escb);
+ gtk_widget_show (priv->escb_header);
}
- gtk_box_pack_start (GTK_BOX (priv->selector_box), priv->esom_header, FALSE, TRUE, 6);
- gtk_box_pack_start (GTK_BOX (priv->selector_box), priv->esom, FALSE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (priv->selector_box), priv->escb_header, FALSE, TRUE, 6);
+ gtk_box_pack_start (GTK_BOX (priv->selector_box), priv->escb, FALSE, TRUE, 0);
}
ESourceList *
@@ -1870,10 +1874,11 @@ itip_view_set_source (ItipView *view, ESource *source)
priv = view->priv;
- if (!priv->esom)
+ if (!priv->escb)
return;
- e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->esom), source);
+ e_source_combo_box_set_active (
+ E_SOURCE_COMBO_BOX (priv->escb), source);
}
ESource *
@@ -1886,10 +1891,11 @@ itip_view_get_source (ItipView *view)
priv = view->priv;
- if (!priv->esom)
+ if (!priv->escb)
return NULL;
- return e_source_option_menu_peek_selected (E_SOURCE_OPTION_MENU (priv->esom));
+ return e_source_combo_box_get_active (
+ E_SOURCE_COMBO_BOX (priv->escb));
}
void