aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component/select-names/e-select-names.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2002-02-14 05:39:05 +0800
committerChris Lahey <clahey@src.gnome.org>2002-02-14 05:39:05 +0800
commit2cacdc5d41cbf020f57ff782efcdd6e4bf999636 (patch)
tree0506872b59d74c15747c720e2de5809ceb803032 /addressbook/gui/component/select-names/e-select-names.c
parent32a1a69f13932b9304a937ca0cb39102d425bc93 (diff)
downloadgsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar
gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar.gz
gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar.bz2
gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar.lz
gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar.xz
gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.tar.zst
gsoc2013-evolution-2cacdc5d41cbf020f57ff782efcdd6e4bf999636.zip
Make sure to only set the query once when creating a new book and not at
2002-02-13 Christopher James Lahey <clahey@ximian.com> * gui/component/select-names/e-select-names.c (set_book): Make sure to only set the query once when creating a new book and not at all on addressbook model creation. This prevents an accidental pair of changes from making the addressbook model load a remote addressbook. * gui/widgets/e-addressbook-model.c (get_view): If this is the first_get_view and the addressbook is remote, empty the view instead of leaving it in the state it used to be in. This only occurs if you set the book after the model has existed for a while. (e_addressbook_model_set_arg): When setting the book, set first_get_view to TRUE. svn path=/trunk/; revision=15715
Diffstat (limited to 'addressbook/gui/component/select-names/e-select-names.c')
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index 095d928a41..9a0d9f6805 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -53,6 +53,7 @@ static void e_select_names_class_init (ESelectNamesClass *klass);
static void e_select_names_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
static void e_select_names_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void e_select_names_destroy (GtkObject *object);
+static void update_query (GtkWidget *button, ESelectNames *e_select_names);
static GnomeDialogClass *parent_class = NULL;
#define PARENT_TYPE gnome_dialog_get_type()
@@ -128,17 +129,29 @@ e_select_names_class_init (ESelectNamesClass *klass)
GtkWidget *e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2);
static void
-set_book(EBook *book, EBookStatus status, EAddressbookModel *model)
+set_book(EBook *book, EBookStatus status, ESelectNames *esn)
+{
+ gtk_object_set(GTK_OBJECT(esn->model),
+ "book", book,
+ NULL);
+ update_query (NULL, esn);
+ gtk_object_unref(GTK_OBJECT(book));
+ gtk_object_unref(GTK_OBJECT(esn));
+}
+
+static void
+set_book_with_model_data(EBook *book, EBookStatus status, EAddressbookModel *model)
{
gtk_object_set(GTK_OBJECT(model),
"book", book,
+ "query", "(contains \"email\" \"\")",
NULL);
gtk_object_unref(GTK_OBJECT(book));
gtk_object_unref(GTK_OBJECT(model));
}
static void
-addressbook_model_set_uri(EAddressbookModel *model, char *uri)
+addressbook_model_set_uri(ESelectNames *e_select_names, EAddressbookModel *model, char *uri)
{
EBook *book;
@@ -151,8 +164,13 @@ addressbook_model_set_uri(EAddressbookModel *model, char *uri)
}
book = e_book_new();
- gtk_object_ref(GTK_OBJECT(model));
- addressbook_load_uri(book, uri, (EBookCallback) set_book, model);
+ if (e_select_names) {
+ gtk_object_ref(GTK_OBJECT(e_select_names));
+ addressbook_load_uri(book, uri, (EBookCallback) set_book, e_select_names);
+ } else {
+ gtk_object_ref(GTK_OBJECT(model));
+ addressbook_load_uri(book, uri, (EBookCallback) set_book_with_model_data, model);
+ }
}
static void *
@@ -288,14 +306,13 @@ e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int n
filename = gnome_util_prepend_user_home("evolution/local/Contacts/addressbook.db");
uri = g_strdup_printf("file://%s", filename);
- addressbook_model_set_uri(model, uri);
+ addressbook_model_set_uri(NULL, model, uri);
g_free(uri);
g_free(filename);
gtk_object_set(GTK_OBJECT(model),
"editable", FALSE,
- "query", "(contains \"email\" \"\")",
NULL);
without = e_table_without_new (adapter,
@@ -339,7 +356,7 @@ e_select_names_option_activated(GtkWidget *widget, ESelectNames *e_select_names)
{
ESelectNamesFolder *e_folder = gtk_object_get_data (GTK_OBJECT (widget), "EsnChoiceFolder");
- addressbook_model_set_uri(e_select_names->model, e_folder->uri);
+ addressbook_model_set_uri(e_select_names, e_select_names->model, e_folder->uri);
}
typedef struct {