aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-05-23 17:19:07 +0800
committerChris Toshok <toshok@src.gnome.org>2001-05-23 17:19:07 +0800
commitbe19c59c2e0f254538f72ba136d7524d8619045a (patch)
tree56a41f4e6ecd2e115e74e93e9e83873ff589261e /addressbook/gui
parentc5ed45567edc05e791930e16bf56e5b02e247f1a (diff)
downloadgsoc2013-evolution-be19c59c2e0f254538f72ba136d7524d8619045a.tar
gsoc2013-evolution-be19c59c2e0f254538f72ba136d7524d8619045a.tar.gz
gsoc2013-evolution-be19c59c2e0f254538f72ba136d7524d8619045a.tar.bz2
gsoc2013-evolution-be19c59c2e0f254538f72ba136d7524d8619045a.tar.lz
gsoc2013-evolution-be19c59c2e0f254538f72ba136d7524d8619045a.tar.xz
gsoc2013-evolution-be19c59c2e0f254538f72ba136d7524d8619045a.tar.zst
gsoc2013-evolution-be19c59c2e0f254538f72ba136d7524d8619045a.zip
add sequence_complete_id to EAddressbookModel and stop_state_changed to
2001-05-23 Chris Toshok <toshok@ximian.com> * gui/widgets/e-addressbook-model.h: add sequence_complete_id to EAddressbookModel and stop_state_changed to EAddressbookModelClass. also, add prototype for e_addressbook_model_can_stop. * gui/widgets/e-addressbook-model.c (remove_book_view): disconnect from "sequence_complete", and set search_in_progress to FALSE. (sequence_complete): set search_in_progress to FALSE and emit "stop_state_changed." (e_addressbook_model_class_init): create the "stop_state_changed" signal. (e_addressbook_model_init): init stuff. (book_view_loaded): connect to "sequence_complete" signal. (book_view_loaded): set search_in_progress to TRUE and emit "stop_state_changed" (e_addressbook_model_stop): set search_in_progress to false, emit "stop_state_changed", and set our status to "Search Interrupted." (e_addressbook_model_can_stop): return search_in_progress. * gui/widgets/e-addressbook-view.c (e_addressbook_view_init): connect to the stop_state_changed signal on EAddressbookModel. (stop_state_changed): new function. (e_addressbook_view_can_stop): call e_addressbook_model_can_stop. * gui/component/addressbook.c (update_command_state): use e_addressbook_view_can_stop to set the sensitivity of the stop button. svn path=/trunk/; revision=9940
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/addressbook.c3
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c45
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.h20
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c14
4 files changed, 71 insertions, 11 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index ac531d1f33..281549c462 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -663,7 +663,8 @@ set_status_message (EAddressbookView *eav, const char *message, AddressbookView
else {
printf ("setting message %s\n", message);
GNOME_Evolution_ShellView_setMessage (shell_view_interface,
- message, 0 /* XXX */, &ev);
+ message,
+ e_addressbook_view_can_stop (view->view), &ev);
}
CORBA_exception_free (&ev);
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index fbc67d6ed6..db87e6fbaf 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -39,6 +39,7 @@ enum {
CARD_REMOVED,
CARD_CHANGED,
MODEL_CHANGED,
+ STOP_STATE_CHANGED,
LAST_SIGNAL
};
@@ -61,11 +62,17 @@ remove_book_view(EAddressbookModel *model)
if (model->book_view && model->status_message_id)
gtk_signal_disconnect(GTK_OBJECT (model->book_view),
model->status_message_id);
+ if (model->book_view && model->sequence_complete_id)
+ gtk_signal_disconnect(GTK_OBJECT (model->book_view),
+ model->sequence_complete_id);
model->create_card_id = 0;
model->remove_card_id = 0;
model->modify_card_id = 0;
model->status_message_id = 0;
+ model->sequence_complete_id = 0;
+
+ model->search_in_progress = FALSE;
if (model->book_view)
gtk_object_unref(GTK_OBJECT(model->book_view));
@@ -174,6 +181,15 @@ status_message (EBookView *book_view,
}
static void
+sequence_complete (EBookView *book_view,
+ EAddressbookModel *model)
+{
+ model->search_in_progress = FALSE;
+ gtk_signal_emit (GTK_OBJECT (model),
+ e_addressbook_model_signals [STOP_STATE_CHANGED]);
+}
+
+static void
writable_status (EBook *book,
gboolean writable,
EAddressbookModel *model)
@@ -249,6 +265,14 @@ e_addressbook_model_class_init (GtkObjectClass *object_class)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ e_addressbook_model_signals [STOP_STATE_CHANGED] =
+ gtk_signal_new ("stop_state_changed",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EAddressbookModelClass, stop_state_changed),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
gtk_object_class_add_signals (object_class, e_addressbook_model_signals, LAST_SIGNAL);
}
@@ -265,9 +289,11 @@ e_addressbook_model_init (GtkObject *object)
model->modify_card_id = 0;
model->status_message_id = 0;
model->writable_status_id = 0;
+ model->sequence_complete_id = 0;
model->data = NULL;
model->data_count = 0;
model->allocated_count = 0;
+ model->search_in_progress = FALSE;
model->editable = FALSE;
model->first_get_view = TRUE;
}
@@ -297,6 +323,10 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe
"status_message",
GTK_SIGNAL_FUNC(status_message),
model);
+ model->sequence_complete_id = gtk_signal_connect(GTK_OBJECT(model->book_view),
+ "sequence_complete",
+ GTK_SIGNAL_FUNC(sequence_complete),
+ model);
for ( i = 0; i < model->data_count; i++ ) {
gtk_object_unref(GTK_OBJECT(model->data[i]));
@@ -306,8 +336,11 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe
model->data = NULL;
model->data_count = 0;
model->allocated_count = 0;
+ model->search_in_progress = TRUE;
gtk_signal_emit (GTK_OBJECT (model),
e_addressbook_model_signals [MODEL_CHANGED]);
+ gtk_signal_emit (GTK_OBJECT (model),
+ e_addressbook_model_signals [STOP_STATE_CHANGED]);
}
static gboolean
@@ -443,6 +476,18 @@ e_addressbook_model_new (void)
void e_addressbook_model_stop (EAddressbookModel *model)
{
remove_book_view(model);
+ model->search_in_progress = FALSE;
+ gtk_signal_emit (GTK_OBJECT (model),
+ e_addressbook_model_signals [STOP_STATE_CHANGED]);
+ gtk_signal_emit (GTK_OBJECT (model),
+ e_addressbook_model_signals [STATUS_MESSAGE],
+ "Search Interrupted.");
+}
+
+gboolean
+e_addressbook_model_can_stop (EAddressbookModel *model)
+{
+ return model->search_in_progress;
}
int
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
index 5443e2dbfb..d6d605efe5 100644
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ b/addressbook/gui/widgets/e-addressbook-model.h
@@ -29,8 +29,9 @@ struct _EAddressbookModel {
int data_count;
int allocated_count;
- int create_card_id, remove_card_id, modify_card_id, status_message_id, writable_status_id;
+ int create_card_id, remove_card_id, modify_card_id, status_message_id, writable_status_id, sequence_complete_id;
+ guint search_in_progress : 1;
guint editable : 1;
guint first_get_view : 1;
};
@@ -42,12 +43,13 @@ struct _EAddressbookModelClass {
/*
* Signals
*/
- void (*writable_status) (EAddressbookModel *model, gboolean writable);
- void (*status_message) (EAddressbookModel *model, const gchar *message);
- void (*card_added) (EAddressbookModel *model, gint index, gint count);
- void (*card_removed) (EAddressbookModel *model, gint index);
- void (*card_changed) (EAddressbookModel *model, gint index);
- void (*model_changed) (EAddressbookModel *model);
+ void (*writable_status) (EAddressbookModel *model, gboolean writable);
+ void (*status_message) (EAddressbookModel *model, const gchar *message);
+ void (*card_added) (EAddressbookModel *model, gint index, gint count);
+ void (*card_removed) (EAddressbookModel *model, gint index);
+ void (*card_changed) (EAddressbookModel *model, gint index);
+ void (*model_changed) (EAddressbookModel *model);
+ void (*stop_state_changed) (EAddressbookModel *model);
};
@@ -59,8 +61,8 @@ ECard *e_addressbook_model_get_card (EAddressbookModel *model,
int row);
EBook *e_addressbook_model_get_ebook (EAddressbookModel *model);
-void e_addressbook_model_stop (EAddressbookModel *model);
-
+void e_addressbook_model_stop (EAddressbookModel *model);
+gboolean e_addressbook_model_can_stop (EAddressbookModel *model);
int e_addressbook_model_card_count (EAddressbookModel *model);
ECard *e_addressbook_model_card_at (EAddressbookModel *model, int index);
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 2cc1acd7e4..55443000a0 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -62,6 +62,7 @@ static void e_addressbook_view_destroy (GtkObject *object);
static void change_view_type (EAddressbookView *view, EAddressbookViewType view_type);
static void status_message (GtkObject *object, const gchar *status, EAddressbookView *eav);
+static void stop_state_changed (GtkObject *object, EAddressbookView *eav);
static void writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav);
static void command_state_change (EAddressbookView *eav);
@@ -168,6 +169,11 @@ e_addressbook_view_init (EAddressbookView *eav)
eav);
gtk_signal_connect (GTK_OBJECT(eav->model),
+ "stop_state_changed",
+ GTK_SIGNAL_FUNC (stop_state_changed),
+ eav);
+
+ gtk_signal_connect (GTK_OBJECT(eav->model),
"writable_status",
GTK_SIGNAL_FUNC (writable_status),
eav);
@@ -681,6 +687,12 @@ status_message (GtkObject *object, const gchar *status, EAddressbookView *eav)
}
static void
+stop_state_changed (GtkObject *object, EAddressbookView *eav)
+{
+ command_state_change (eav);
+}
+
+static void
writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav)
{
command_state_change (eav);
@@ -1097,6 +1109,6 @@ e_addressbook_view_can_delete (EAddressbookView *view)
gboolean
e_addressbook_view_can_stop (EAddressbookView *view)
{
- return FALSE;
+ return e_addressbook_model_can_stop (view->model);
}