aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets/e-addressbook-model.c
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-08-20 01:35:44 +0800
committerChris Lahey <clahey@src.gnome.org>2001-08-20 01:35:44 +0800
commit7aa37d45375de7a08821f7108cd90cdc96273be5 (patch)
treed9849bbdc0ccb0aa28617d984e8d70217b26171e /addressbook/gui/widgets/e-addressbook-model.c
parent81657a54af2413a1b2be6a00f2d46b31e035df5a (diff)
downloadgsoc2013-evolution-7aa37d45375de7a08821f7108cd90cdc96273be5.tar
gsoc2013-evolution-7aa37d45375de7a08821f7108cd90cdc96273be5.tar.gz
gsoc2013-evolution-7aa37d45375de7a08821f7108cd90cdc96273be5.tar.bz2
gsoc2013-evolution-7aa37d45375de7a08821f7108cd90cdc96273be5.tar.lz
gsoc2013-evolution-7aa37d45375de7a08821f7108cd90cdc96273be5.tar.xz
gsoc2013-evolution-7aa37d45375de7a08821f7108cd90cdc96273be5.tar.zst
gsoc2013-evolution-7aa37d45375de7a08821f7108cd90cdc96273be5.zip
Set the folder bar message here.
2001-08-19 Christopher James Lahey <clahey@ximian.com> * gui/component/addressbook.c (set_folder_bar_label), gui/widgets/e-addressbook-model.c, gui/widgets/e-addressbook-model.h (update_folder_bar_message), gui/widgets/e-addressbook-view.c, gui/widgets/e-addressbook-view.h (folder_bar_message): Set the folder bar message here. * gui/component/select-names/e-select-names-model.c (SEPLEN): Use strlen(SEPARATOR) here so that if the separator changes the length will work properly. svn path=/trunk/; revision=12220
Diffstat (limited to 'addressbook/gui/widgets/e-addressbook-model.c')
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index a44c066d4f..49086da70b 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -35,6 +35,7 @@ enum {
enum {
WRITABLE_STATUS,
STATUS_MESSAGE,
+ FOLDER_BAR_MESSAGE,
CARD_ADDED,
CARD_REMOVED,
CARD_CHANGED,
@@ -108,6 +109,33 @@ addressbook_destroy(GtkObject *object)
}
static void
+update_folder_bar_message (EAddressbookModel *model)
+{
+ int count;
+ char *message;
+
+ count = model->data_count;
+
+ switch (count) {
+ case 0:
+ message = g_strdup (_("No cards"));
+ break;
+ case 1:
+ message = g_strdup (_("1 card"));
+ break;
+ default:
+ message = g_strdup_printf (_("%d cards"), count);
+ break;
+ }
+
+ gtk_signal_emit (GTK_OBJECT (model),
+ e_addressbook_model_signals [FOLDER_BAR_MESSAGE],
+ message);
+
+ g_free (message);
+}
+
+static void
create_card(EBookView *book_view,
const GList *cards,
EAddressbookModel *model)
@@ -122,13 +150,23 @@ create_card(EBookView *book_view,
}
for ( ; cards; cards = cards->next) {
+ char *file_as;
+
model->data[model->data_count++] = cards->data;
gtk_object_ref (cards->data);
+ gtk_object_get (GTK_OBJECT (cards->data),
+ "file_as", &file_as,
+ NULL);
+ g_print ("Received card: %s\n", file_as);
}
+ g_print ("Finished\n");
+
gtk_signal_emit (GTK_OBJECT (model),
e_addressbook_model_signals [CARD_ADDED],
old_count, model->data_count - old_count);
+
+ update_folder_bar_message (model);
}
static void
@@ -147,6 +185,7 @@ remove_card(EBookView *book_view,
gtk_signal_emit (GTK_OBJECT (model),
e_addressbook_model_signals [CARD_REMOVED],
i);
+ update_folder_bar_message (model);
break;
}
}
@@ -238,6 +277,14 @@ e_addressbook_model_class_init (GtkObjectClass *object_class)
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+ e_addressbook_model_signals [FOLDER_BAR_MESSAGE] =
+ gtk_signal_new ("folder_bar_message",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EAddressbookModelClass, folder_bar_message),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+
e_addressbook_model_signals [CARD_ADDED] =
gtk_signal_new ("card_added",
GTK_RUN_LAST,
@@ -376,7 +423,6 @@ e_addressbook_model_get_card(EAddressbookModel *model,
if (model->data && row < model->data_count) {
ECard *card;
card = e_card_duplicate (model->data[row]);
- gtk_object_ref (GTK_OBJECT (card));
return card;
}
return NULL;