[evolution-patches] select-names fixin
- From: Dan Winship <danw ximian com>
- To: evolution-patches ximian com
- Subject: [evolution-patches] select-names fixin
- Date: 27 Mar 2003 17:31:46 -0500
This makes the select-names component not depend on having a global
variable named "global_shell_client" (since when it gets
dynamically-loaded into connector, it won't).
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/ChangeLog,v
retrieving revision 1.1356
diff -u -r1.1356 ChangeLog
--- ChangeLog 27 Mar 2003 05:21:16 -0000 1.1356
+++ ChangeLog 27 Mar 2003 22:20:52 -0000
@@ -1,3 +1,24 @@
+2003-03-27 Dan Winship <danw ximian com>
+
+ * gui/component/select-names/e-select-names.c
+ (e_select_names_init): Remove folder-selector button
+ initialization.
+ (e_select_names_new): Initialize folder-selector button here,
+ using the passed-in EvolutionShellClient rather than depending on
+ a global variable.
+
+ * gui/component/select-names/e-select-names-manager.c
+ (e_select_names_manager_activate_dialog): take an
+ EvolutionShellClient and pass it to e_select_names_new().
+
+ * gui/component/select-names/e-select-names-bonobo.c
+ (impl_SelectNames_activate_dialog): get a pointer to the shell
+ from bonobo-activation, create a shell_client, and pass it to
+ e_select_names_manager_activate_dialog.
+
+ * backend/ebook/e-book-util.c (e_book_get_default_book_uri):
+ constify return value
+
2003-03-26 Chris Toshok <toshok ximian com>
[ fixes bug #19178 ]
Index: gui/component/select-names/e-select-names-bonobo.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/select-names/e-select-names-bonobo.c,v
retrieving revision 1.40
diff -u -r1.40 e-select-names-bonobo.c
--- gui/component/select-names/e-select-names-bonobo.c 4 Mar 2003 22:00:57 -0000 1.40
+++ gui/component/select-names/e-select-names-bonobo.c 27 Mar 2003 22:20:52 -0000
@@ -27,13 +27,18 @@
#include "e-select-names-bonobo.h"
#include "e-simple-card-bonobo.h"
+#include <bonobo-activation/bonobo-activation-activate.h>
+
#include <bonobo/bonobo-property-bag.h>
#include <bonobo/bonobo-control.h>
+#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-event-source.h>
#include <gal/util/e-util.h>
#include <gal/e-text/e-entry.h>
+#include "evolution-shell-client.h"
+
#include "Evolution-Addressbook-SelectNames.h"
#include "e-select-names-manager.h"
@@ -359,11 +364,23 @@
{
ESelectNamesBonobo *select_names;
ESelectNamesBonoboPrivate *priv;
+ EvolutionShellClient *shell_client;
+ GNOME_Evolution_Shell shell;
select_names = E_SELECT_NAMES_BONOBO (bonobo_object (servant));
priv = select_names->priv;
- e_select_names_manager_activate_dialog (priv->manager, section_id);
+ shell = bonobo_activation_activate_from_id (
+ "OAFIID:GNOME_Evolution_Shell",
+ Bonobo_ACTIVATION_FLAG_EXISTING_ONLY,
+ NULL, ev);
+ if (BONOBO_EX (ev))
+ return;
+
+ shell_client = evolution_shell_client_new (shell);
+ e_select_names_manager_activate_dialog (priv->manager, shell_client,
+ section_id);
+ g_object_unref (shell_client);
}
Index: gui/component/select-names/e-select-names-manager.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/select-names/e-select-names-manager.c,v
retrieving revision 1.56
diff -u -r1.56 e-select-names-manager.c
--- gui/component/select-names/e-select-names-manager.c 17 Feb 2003 03:16:43 -0000 1.56
+++ gui/component/select-names/e-select-names-manager.c 27 Mar 2003 22:20:52 -0000
@@ -476,9 +476,8 @@
/**
* e_select_names_manager_new:
- * @VCard: a string in vCard format
*
- * Returns: a new #ESelectNamesManager that wraps the @VCard.
+ * Returns: a new #ESelectNamesManager
*/
ESelectNamesManager *
e_select_names_manager_new (void)
@@ -605,6 +604,7 @@
void
e_select_names_manager_activate_dialog (ESelectNamesManager *manager,
+ EvolutionShellClient *shell_client,
const char *id)
{
g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager));
@@ -621,7 +621,7 @@
GList *iter;
- manager->names = E_SELECT_NAMES (e_select_names_new ());
+ manager->names = E_SELECT_NAMES (e_select_names_new (shell_client));
for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
ESelectNamesManagerSection *section = iter->data;
Index: gui/component/select-names/e-select-names-manager.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/select-names/e-select-names-manager.h,v
retrieving revision 1.20
diff -u -r1.20 e-select-names-manager.h
--- gui/component/select-names/e-select-names-manager.h 1 Jan 2003 21:15:18 -0000 1.20
+++ gui/component/select-names/e-select-names-manager.h 27 Mar 2003 22:20:52 -0000
@@ -62,6 +62,7 @@
GtkWidget *e_select_names_manager_create_entry (ESelectNamesManager *manager,
const char *id);
void e_select_names_manager_activate_dialog (ESelectNamesManager *manager,
+ EvolutionShellClient *shell_client,
const char *id);
/* Standard Gtk function */
GType e_select_names_manager_get_type (void);
Index: gui/component/select-names/e-select-names.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/select-names/e-select-names.c,v
retrieving revision 1.116
diff -u -r1.116 e-select-names.c
--- gui/component/select-names/e-select-names.c 27 Mar 2003 04:06:43 -0000 1.116
+++ gui/component/select-names/e-select-names.c 27 Mar 2003 22:20:52 -0000
@@ -48,15 +48,13 @@
#include <e-util/e-categories-master-list-wombat.h>
#include "e-util/e-sexp.h"
-static void e_select_names_init (ESelectNames *card);
+static void e_select_names_init (ESelectNames *names);
static void e_select_names_class_init (ESelectNamesClass *klass);
static void e_select_names_dispose (GObject *object);
static void update_query (GtkWidget *widget, ESelectNames *e_select_names);
static void sync_table_and_models (ESelectNamesModel *triggering_model, ESelectNames *esl);
-extern EvolutionShellClient *global_shell_client;
-
static GtkDialogClass *parent_class = NULL;
#define PARENT_TYPE gtk_dialog_get_type()
@@ -478,12 +476,6 @@
{
GladeXML *gui;
GtkWidget *widget, *button;
- const char *selector_types[] = { "contacts/*", NULL };
- char *filename;
- char *contacts_uri;
- EConfigListener *db;
-
- db = e_book_get_config_database();
gui = glade_xml_new (EVOLUTION_GLADEDIR "/select-names.glade", NULL, NULL);
e_select_names->gui = gui;
@@ -559,25 +551,7 @@
g_signal_connect(button, "clicked",
G_CALLBACK(update_query), e_select_names);
- contacts_uri = e_config_listener_get_string_with_default (db, "/apps/evolution/addressbook/select_names/last_used_uri", NULL, NULL);
- if (!contacts_uri) {
- contacts_uri = e_config_listener_get_string_with_default (db, "/apps/evolution/shell/default_folders/contacts_uri",
- NULL, NULL);
- }
- if (!contacts_uri || !contacts_uri[0]) {
- if (contacts_uri)
- g_free (contacts_uri);
- filename = g_build_filename (g_get_home_dir(), "evolution/local/Contacts", NULL);
- contacts_uri = g_strdup_printf("file://%s", filename);
- g_free (filename);
- }
-
button = glade_xml_get_widget (gui, "folder-selector");
- evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (button),
- global_shell_client,
- _("Find contact in"),
- contacts_uri,
- selector_types);
if (button && EVOLUTION_IS_FOLDER_SELECTOR_BUTTON (button))
g_signal_connect(button, "selected",
G_CALLBACK(folder_selected), e_select_names);
@@ -588,10 +562,6 @@
g_signal_connect (e_table_scrolled_get_table (e_select_names->table), "selection_change",
G_CALLBACK (selection_change), e_select_names);
selection_change (e_table_scrolled_get_table (e_select_names->table), e_select_names);
-
- addressbook_model_set_uri(e_select_names, e_select_names->model, contacts_uri);
-
- g_free (contacts_uri);
}
static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESelectNames *e_select_names)
@@ -656,10 +626,35 @@
}
GtkWidget*
-e_select_names_new (void)
+e_select_names_new (EvolutionShellClient *shell_client)
{
- GtkWidget *widget = g_object_new (E_TYPE_SELECT_NAMES, NULL);
- return widget;
+ ESelectNames *e_select_names;
+ const char *selector_types[] = { "contacts/*", NULL };
+ char *contacts_uri;
+ GtkWidget *button;
+ EConfigListener *db;
+
+ e_select_names = g_object_new (E_TYPE_SELECT_NAMES, NULL);
+
+ db = e_book_get_config_database ();
+ contacts_uri = e_config_listener_get_string_with_default (
+ db, "/apps/evolution/addressbook/select_names/last_used_uri",
+ NULL, NULL);
+ if (!contacts_uri)
+ contacts_uri = g_strdup (e_book_get_default_book_uri ());
+
+ button = glade_xml_get_widget (e_select_names->gui, "folder-selector");
+ evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (button),
+ shell_client,
+ _("Find contact in"),
+ contacts_uri,
+ selector_types);
+
+ addressbook_model_set_uri(e_select_names, e_select_names->model, contacts_uri);
+
+ g_free (contacts_uri);
+
+ return GTK_WIDGET (e_select_names);
}
static void
@@ -707,7 +702,9 @@
}
void
-e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, ESelectNamesModel *source)
+e_select_names_add_section (ESelectNames *e_select_names,
+ const char *name, const char *id,
+ ESelectNamesModel *source)
{
ESelectNamesChild *child;
GtkWidget *button;
@@ -812,19 +809,6 @@
g_hash_table_insert(e_select_names->children, g_strdup(id), child);
sync_table_and_models (child->source, e_select_names);
-}
-
-static void *
-card_copy(const void *value, void *closure)
-{
- g_object_ref((gpointer)value);
- return (void *)value;
-}
-
-static void
-card_free(void *value, void *closure)
-{
- g_object_unref((gpointer)value);
}
void
Index: gui/component/select-names/e-select-names.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/gui/component/select-names/e-select-names.h,v
retrieving revision 1.28
diff -u -r1.28 e-select-names.h
--- gui/component/select-names/e-select-names.h 18 Mar 2003 20:42:41 -0000 1.28
+++ gui/component/select-names/e-select-names.h 27 Mar 2003 22:20:52 -0000
@@ -27,10 +27,10 @@
#include <gal/e-table/e-table.h>
#include <gal/e-table/e-table-scrolled.h>
-#include <addressbook/gui/widgets/e-addressbook-model.h>
+#include "evolution-shell-client.h"
+#include "e-addressbook-model.h"
#include "e-select-names-model.h"
-#include "e-util/e-list.h"
#ifdef __cplusplus
extern "C" {
@@ -85,15 +85,15 @@
};
-GtkWidget *e_select_names_new (void);
+GtkWidget *e_select_names_new (EvolutionShellClient *shell_client);
GType e_select_names_get_type (void);
-void e_select_names_add_section (ESelectNames *e_select_names,
- char *name,
- char *id,
- ESelectNamesModel *source);
-void e_select_names_set_default (ESelectNames *e_select_names,
- const char *id);
+void e_select_names_add_section (ESelectNames *e_select_names,
+ const char *name,
+ const char *id,
+ ESelectNamesModel *source);
+void e_select_names_set_default (ESelectNames *e_select_names,
+ const char *id);
#ifdef __cplusplus
}
Index: backend/ebook/e-book-util.c
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/backend/ebook/e-book-util.c,v
retrieving revision 1.32
diff -u -r1.32 e-book-util.c
--- backend/ebook/e-book-util.c 7 Feb 2003 07:14:28 -0000 1.32
+++ backend/ebook/e-book-util.c 27 Mar 2003 22:20:52 -0000
@@ -265,7 +265,7 @@
void
e_book_load_default_book (EBook *book, EBookCallback open_response, gpointer closure)
{
- char *uri;
+ const char *uri;
DefaultBookClosure *default_book_closure;
g_return_if_fail (book != NULL);
@@ -284,7 +284,7 @@
}
-char*
+const char *
e_book_get_default_book_uri ()
{
if (!default_book_uri)
Index: backend/ebook/e-book-util.h
===================================================================
RCS file: /cvs/gnome/evolution/addressbook/backend/ebook/e-book-util.h,v
retrieving revision 1.12
diff -u -r1.12 e-book-util.h
--- backend/ebook/e-book-util.h 7 Feb 2003 07:14:28 -0000 1.12
+++ backend/ebook/e-book-util.h 27 Mar 2003 22:20:52 -0000
@@ -55,7 +55,7 @@
void e_book_load_default_book (EBook *book,
EBookCallback open_response,
gpointer closure);
-char *e_book_get_default_book_uri (void);
+const char *e_book_get_default_book_uri (void);
/* config database interface. */
EConfigListener *e_book_get_config_database (void);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]