aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c36
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.h18
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c14
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c34
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.h5
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c36
-rw-r--r--addressbook/gui/widgets/e-minicard-view.h7
7 files changed, 143 insertions, 7 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 35c8dda745..c40c21f3bb 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -32,6 +32,13 @@ enum {
ARG_EDITABLE,
};
+enum {
+ STATUS_MESSAGE,
+ LAST_SIGNAL
+};
+
+static guint e_addressbook_model_signals [LAST_SIGNAL] = {0, };
+
static void
remove_book_view(EAddressbookModel *model)
{
@@ -44,10 +51,14 @@ remove_book_view(EAddressbookModel *model)
if (model->book_view && model->modify_card_id)
gtk_signal_disconnect(GTK_OBJECT (model->book_view),
model->modify_card_id);
+ if (model->book_view && model->status_message_id)
+ gtk_signal_disconnect(GTK_OBJECT (model->book_view),
+ model->status_message_id);
model->create_card_id = 0;
model->remove_card_id = 0;
model->modify_card_id = 0;
+ model->status_message_id = 0;
if (model->book_view)
gtk_object_unref(GTK_OBJECT(model->book_view));
@@ -236,6 +247,16 @@ modify_card(EBookView *book_view,
}
static void
+status_message (EBookView *book_view,
+ char* status,
+ EAddressbookModel *model)
+{
+ gtk_signal_emit (GTK_OBJECT (model),
+ e_addressbook_model_signals [STATUS_MESSAGE],
+ status);
+}
+
+static void
e_addressbook_model_class_init (GtkObjectClass *object_class)
{
ETableModelClass *model_class = (ETableModelClass *) object_class;
@@ -252,6 +273,16 @@ e_addressbook_model_class_init (GtkObjectClass *object_class)
GTK_ARG_READWRITE, ARG_QUERY);
gtk_object_add_arg_type ("EAddressbookModel::editable", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_EDITABLE);
+
+ e_addressbook_model_signals [STATUS_MESSAGE] =
+ gtk_signal_new ("status_message",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EAddressbookModelClass, status_message),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+
+ gtk_object_class_add_signals (object_class, e_addressbook_model_signals, LAST_SIGNAL);
model_class->column_count = addressbook_col_count;
model_class->row_count = addressbook_row_count;
@@ -277,6 +308,7 @@ e_addressbook_model_init (GtkObject *object)
model->create_card_id = 0;
model->remove_card_id = 0;
model->modify_card_id = 0;
+ model->status_message_id = 0;
model->data = NULL;
model->data_count = 0;
model->editable = TRUE;
@@ -304,6 +336,10 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe
"card_changed",
GTK_SIGNAL_FUNC(modify_card),
model);
+ model->status_message_id = gtk_signal_connect(GTK_OBJECT(model->book_view),
+ "status_message",
+ GTK_SIGNAL_FUNC(status_message),
+ model);
for ( i = 0; i < model->data_count; i++ ) {
gtk_object_unref(GTK_OBJECT(model->data[i]));
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
index 860fb641ac..79a606b314 100644
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ b/addressbook/gui/widgets/e-addressbook-model.h
@@ -20,7 +20,10 @@
3 Phone
*/
-typedef struct {
+typedef struct _EAddressbookModel EAddressbookModel;
+typedef struct _EAddressbookModelClass EAddressbookModelClass;
+
+struct _EAddressbookModel {
ETableModel parent;
/* item specific fields */
@@ -33,16 +36,21 @@ typedef struct {
ECardSimple **data;
int data_count;
- int create_card_id, remove_card_id, modify_card_id;
+ int create_card_id, remove_card_id, modify_card_id, status_message_id;
guint editable : 1;
guint first_get_view : 1;
-} EAddressbookModel;
+};
-typedef struct {
+struct _EAddressbookModelClass {
ETableModelClass parent_class;
-} EAddressbookModelClass;
+
+ /*
+ * Signals
+ */
+ void (*status_message) (EAddressbookModel *model, const gchar *message);
+};
GtkType e_addressbook_model_get_type (void);
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 816c83ca36..416b1e71e6 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -152,8 +152,9 @@ e_addressbook_view_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
switch (arg_id){
case ARG_BOOK:
- if (eav->book)
+ if (eav->book) {
gtk_object_unref(GTK_OBJECT(eav->book));
+ }
if (GTK_VALUE_OBJECT(*arg)) {
eav->book = E_BOOK(GTK_VALUE_OBJECT(*arg));
gtk_object_ref(GTK_OBJECT(eav->book));
@@ -534,6 +535,12 @@ table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EA
return FALSE;
}
+static void
+status_message (GtkObject *object, const gchar *message, EAddressbookView *eav)
+{
+ printf ("status = %s\n", message);
+}
+
#define SPEC "<?xml version=\"1.0\"?> \
<ETableSpecification click-to-add=\"true\" draw-grid=\"true\" _click-to-add-message=\"* Click here to add a contact *\"> \
<ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
@@ -641,6 +648,11 @@ change_view_type (EAddressbookView *view, EAddressbookViewType view_type)
view->view_type = view_type;
+ gtk_signal_connect (view->object,
+ "status_message",
+ GTK_SIGNAL_FUNC (status_message),
+ view);
+
gtk_object_set(view->object,
"query", view->query,
"book", view->book,
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index c6809bf1d0..fbbcd6cf00 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -42,6 +42,14 @@ enum {
ARG_QUERY
};
+enum {
+ STATUS_MESSAGE,
+ LAST_SIGNAL
+};
+
+static guint e_minicard_view_widget_signals [LAST_SIGNAL] = {0, };
+
+
GtkType
e_minicard_view_widget_get_type (void)
{
@@ -85,6 +93,16 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
gtk_object_add_arg_type ("EMinicardViewWidget::query", GTK_TYPE_STRING,
GTK_ARG_READWRITE, ARG_QUERY);
+ e_minicard_view_widget_signals [STATUS_MESSAGE] =
+ gtk_signal_new ("status_message",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EMinicardViewWidgetClass, status_message),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+
+ gtk_object_class_add_signals (object_class, e_minicard_view_widget_signals, LAST_SIGNAL);
+
object_class->set_arg = e_minicard_view_widget_set_arg;
object_class->get_arg = e_minicard_view_widget_get_arg;
object_class->destroy = e_minicard_view_widget_destroy;
@@ -176,6 +194,16 @@ e_minicard_view_widget_destroy (GtkObject *object)
}
static void
+status_message (EMinicardView *mini_view,
+ char* status,
+ EMinicardViewWidget *view)
+{
+ gtk_signal_emit (GTK_OBJECT (view),
+ e_minicard_view_widget_signals [STATUS_MESSAGE],
+ status);
+}
+
+static void
e_minicard_view_widget_realize (GtkWidget *widget)
{
EMinicardViewWidget *view = E_MINICARD_VIEW_WIDGET(widget);
@@ -196,6 +224,12 @@ e_minicard_view_widget_realize (GtkWidget *widget)
"height", (double) 100,
"minimum_width", (double) 100,
NULL );
+
+ gtk_signal_connect(GTK_OBJECT(view->emv),
+ "status_message",
+ GTK_SIGNAL_FUNC(status_message),
+ view);
+
gtk_object_set(GTK_OBJECT(view->emv),
"book", view->book,
"query", view->query,
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.h b/addressbook/gui/widgets/e-minicard-view-widget.h
index cf20c9a4df..0deb920ffa 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.h
+++ b/addressbook/gui/widgets/e-minicard-view-widget.h
@@ -55,6 +55,11 @@ struct _EMinicardViewWidget
struct _EMinicardViewWidgetClass
{
ECanvasClass parent_class;
+
+ /*
+ * Signals
+ */
+ void (*status_message) (EMinicardView *mini_view, const gchar *message);
};
GtkType e_minicard_view_widget_get_type (void);
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 7169e41542..d3f08b71ab 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -44,6 +44,13 @@ enum {
ARG_QUERY
};
+enum {
+ STATUS_MESSAGE,
+ LAST_SIGNAL
+};
+
+static guint e_minicard_view_signals [LAST_SIGNAL] = {0, };
+
GtkType
e_minicard_view_get_type (void)
{
@@ -84,6 +91,16 @@ e_minicard_view_class_init (EMinicardViewClass *klass)
GTK_ARG_READWRITE, ARG_BOOK);
gtk_object_add_arg_type ("EMinicardView::query", GTK_TYPE_STRING,
GTK_ARG_READWRITE, ARG_QUERY);
+
+ e_minicard_view_signals [STATUS_MESSAGE] =
+ gtk_signal_new ("status_message",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EMinicardViewClass, status_message),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+
+ gtk_object_class_add_signals (object_class, e_minicard_view_signals, LAST_SIGNAL);
object_class->set_arg = e_minicard_view_set_arg;
object_class->get_arg = e_minicard_view_get_arg;
@@ -104,6 +121,7 @@ e_minicard_view_init (EMinicardView *view)
view->create_card_id = 0;
view->remove_card_id = 0;
view->modify_card_id = 0;
+ view->status_message_id = 0;
view->canvas_destroy_id = 0;
view->first_get_view = TRUE;
@@ -145,6 +163,16 @@ modify_card(EBookView *book_view, const GList *cards, EMinicardView *view)
}
static void
+status_message (EBookView *book_view,
+ char* status,
+ EMinicardView *view)
+{
+ gtk_signal_emit (GTK_OBJECT (view),
+ e_minicard_view_signals [STATUS_MESSAGE],
+ status);
+}
+
+static void
remove_card(EBookView *book_view, const char *id, EMinicardView *view)
{
e_reflow_sorted_remove_item(E_REFLOW_SORTED(view), id);
@@ -181,6 +209,10 @@ book_view_loaded (EBook *book, EBookStatus status, EBookView *book_view, gpointe
"card_changed",
GTK_SIGNAL_FUNC(modify_card),
view);
+ view->status_message_id = gtk_signal_connect(GTK_OBJECT(view->book_view),
+ "status_message",
+ GTK_SIGNAL_FUNC(status_message),
+ view);
g_list_foreach(E_REFLOW(view)->items, (GFunc) gtk_object_unref, NULL);
g_list_foreach(E_REFLOW(view)->items, (GFunc) gtk_object_destroy, NULL);
@@ -373,10 +405,14 @@ disconnect_signals(EMinicardView *view)
if (view->book_view && view->modify_card_id)
gtk_signal_disconnect(GTK_OBJECT (view->book_view),
view->modify_card_id);
+ if (view->book_view && view->status_message_id)
+ gtk_signal_disconnect(GTK_OBJECT (view->book_view),
+ view->status_message_id);
view->create_card_id = 0;
view->remove_card_id = 0;
view->modify_card_id = 0;
+ view->status_message_id = 0;
}
static void
diff --git a/addressbook/gui/widgets/e-minicard-view.h b/addressbook/gui/widgets/e-minicard-view.h
index e4c1be870a..804290d427 100644
--- a/addressbook/gui/widgets/e-minicard-view.h
+++ b/addressbook/gui/widgets/e-minicard-view.h
@@ -72,7 +72,7 @@ struct _EMinicardView
int canvas_destroy_id;
- int create_card_id, remove_card_id, modify_card_id;
+ int create_card_id, remove_card_id, modify_card_id, status_message_id;
guint first_get_view : 1;
};
@@ -80,6 +80,11 @@ struct _EMinicardView
struct _EMinicardViewClass
{
EReflowSortedClass parent_class;
+
+ /*
+ * Signals
+ */
+ void (*status_message) (EMinicardView *mini_view, const gchar *message);
};
GtkType e_minicard_view_get_type (void);