aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--addressbook/ChangeLog12
-rw-r--r--addressbook/gui/component/addressbook.c44
-rw-r--r--addressbook/gui/component/select-names/e-select-names-model.c2
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c48
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.h1
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c61
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.h3
7 files changed, 167 insertions, 4 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index d653db8589..a1d0828376 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,17 @@
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.
+
+2001-08-19 Christopher James Lahey <clahey@ximian.com>
+
* gui/contact-editor/fulladdr.glade: Added full country list.
Fixes Ximian bug #5123.
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index a6f0dfc2a5..5e8b523a5a 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -18,6 +18,7 @@
#include <libgnomeui/gnome-uidefs.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-ui-util.h>
+#include <bonobo/bonobo-exception.h>
#include <gal/util/e-util.h>
#include <gal/widgets/e-unicode.h>
@@ -40,6 +41,8 @@
#include <widgets/misc/e-search-bar.h>
#include <widgets/misc/e-filter-bar.h>
+#define d(x)
+
#define PROPERTY_FOLDER_URI "folder_uri"
#define PROPERTY_FOLDER_URI_IDX 1
@@ -791,6 +794,42 @@ set_status_message (EAddressbookView *eav, const char *message, AddressbookView
CORBA_exception_free (&ev);
}
+static void
+set_folder_bar_label (EAddressbookView *eav, const char *message, AddressbookView *view)
+{
+ CORBA_Environment ev;
+ GNOME_Evolution_ShellView shell_view_interface;
+
+ CORBA_exception_init (&ev);
+
+ shell_view_interface = retrieve_shell_view_interface_from_control (view->control);
+ if (!shell_view_interface) {
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ d(g_message("Updating via ShellView"));
+
+ if (message == NULL || message[0] == 0) {
+ GNOME_Evolution_ShellView_setFolderBarLabel (shell_view_interface,
+ "",
+ &ev);
+ }
+ else {
+ GNOME_Evolution_ShellView_setFolderBarLabel (shell_view_interface,
+ message,
+ &ev);
+ }
+
+ if (BONOBO_EX (&ev))
+ g_warning ("Exception in label update: %s",
+ bonobo_exception_get_text (&ev));
+
+ CORBA_exception_free (&ev);
+}
+
+
+
BonoboControl *
addressbook_factory_new_control (void)
{
@@ -873,6 +912,11 @@ addressbook_factory_new_control (void)
view);
gtk_signal_connect (GTK_OBJECT (view->view),
+ "folder_bar_message",
+ GTK_SIGNAL_FUNC(set_folder_bar_label),
+ view);
+
+ gtk_signal_connect (GTK_OBJECT (view->view),
"command_state_change",
GTK_SIGNAL_FUNC(update_command_state),
view);
diff --git a/addressbook/gui/component/select-names/e-select-names-model.c b/addressbook/gui/component/select-names/e-select-names-model.c
index 9dda927640..6e0482ade3 100644
--- a/addressbook/gui/component/select-names/e-select-names-model.c
+++ b/addressbook/gui/component/select-names/e-select-names-model.c
@@ -21,7 +21,7 @@
#include "addressbook/backend/ebook/e-card-simple.h"
#define SEPARATOR ", "
-#define SEPLEN 2
+#define SEPLEN (strlen(SEPARATOR))
enum {
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;
diff --git a/addressbook/gui/widgets/e-addressbook-model.h b/addressbook/gui/widgets/e-addressbook-model.h
index a0956d7003..3bd66ca46f 100644
--- a/addressbook/gui/widgets/e-addressbook-model.h
+++ b/addressbook/gui/widgets/e-addressbook-model.h
@@ -46,6 +46,7 @@ struct _EAddressbookModelClass {
*/
void (*writable_status) (EAddressbookModel *model, gboolean writable);
void (*status_message) (EAddressbookModel *model, const gchar *message);
+ void (*folder_bar_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);
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index d285fa283a..beb399e38a 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -56,6 +56,7 @@
#include "e-card-merging.h"
#include "e-contact-editor.h"
+#include <gdk/gdkkeysyms.h>
#include <ctype.h>
static void e_addressbook_view_init (EAddressbookView *card);
@@ -63,9 +64,12 @@ static void e_addressbook_view_class_init (EAddressbookViewClass *klass);
static void e_addressbook_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
static void e_addressbook_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void e_addressbook_view_destroy (GtkObject *object);
+static gint e_addressbook_view_key_press_event (GtkWidget *widget,
+ GdkEventKey *event);
static void change_view_type (EAddressbookView *view, EAddressbookViewType view_type);
-static void status_message (GtkObject *object, const gchar *status, EAddressbookView *eav);
+static void status_message (GtkObject *object, const gchar *status, EAddressbookView *eav);
+static void folder_bar_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);
@@ -90,6 +94,7 @@ enum {
enum {
STATUS_MESSAGE,
+ FOLDER_BAR_MESSAGE,
COMMAND_STATE_CHANGE,
LAST_SIGNAL
};
@@ -135,8 +140,10 @@ static void
e_addressbook_view_class_init (EAddressbookViewClass *klass)
{
GtkObjectClass *object_class;
+ GtkWidgetClass *widget_class;
object_class = GTK_OBJECT_CLASS(klass);
+ widget_class = GTK_WIDGET_CLASS(klass);
parent_class = gtk_type_class (gtk_table_get_type ());
@@ -144,6 +151,8 @@ e_addressbook_view_class_init (EAddressbookViewClass *klass)
object_class->get_arg = e_addressbook_view_get_arg;
object_class->destroy = e_addressbook_view_destroy;
+ widget_class->key_press_event = e_addressbook_view_key_press_event;
+
gtk_object_add_arg_type ("EAddressbookView::book", GTK_TYPE_OBJECT,
GTK_ARG_READWRITE, ARG_BOOK);
gtk_object_add_arg_type ("EAddressbookView::query", GTK_TYPE_STRING,
@@ -159,6 +168,14 @@ e_addressbook_view_class_init (EAddressbookViewClass *klass)
gtk_marshal_NONE__POINTER,
GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+ e_addressbook_view_signals [FOLDER_BAR_MESSAGE] =
+ gtk_signal_new ("folder_bar_message",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EAddressbookViewClass, folder_bar_message),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
+
e_addressbook_view_signals [COMMAND_STATE_CHANGE] =
gtk_signal_new ("command_state_change",
GTK_RUN_LAST,
@@ -186,6 +203,11 @@ e_addressbook_view_init (EAddressbookView *eav)
eav);
gtk_signal_connect (GTK_OBJECT(eav->model),
+ "folder_bar_message",
+ GTK_SIGNAL_FUNC (folder_bar_message),
+ eav);
+
+ gtk_signal_connect (GTK_OBJECT(eav->model),
"stop_state_changed",
GTK_SIGNAL_FUNC (stop_state_changed),
eav);
@@ -261,6 +283,29 @@ e_addressbook_view_destroy (GtkObject *object)
GTK_OBJECT_CLASS(parent_class)->destroy(object);
}
+static gint
+e_addressbook_view_key_press_event (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ EAddressbookView *view = E_ADDRESSBOOK_VIEW (widget);
+ guint return_val = 0;
+
+ if (GTK_WIDGET_CLASS (parent_class)->key_press_event) {
+ return_val = GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event);
+ if (return_val != 0)
+ return return_val;
+ }
+
+ if ((event->keyval == GDK_Delete ||
+ event->keyval == GDK_KP_Delete) &&
+ event->state == 0) {
+ e_addressbook_view_delete_selection(view);
+ return_val = TRUE;
+ }
+
+ return return_val;
+}
+
GtkWidget*
e_addressbook_view_new (void)
{
@@ -745,12 +790,26 @@ emit_status_message (EAddressbookView *eav, const gchar *status)
}
static void
+emit_folder_bar_message (EAddressbookView *eav, const gchar *message)
+{
+ gtk_signal_emit (GTK_OBJECT (eav),
+ e_addressbook_view_signals [FOLDER_BAR_MESSAGE],
+ message);
+}
+
+static void
status_message (GtkObject *object, const gchar *status, EAddressbookView *eav)
{
emit_status_message (eav, status);
}
static void
+folder_bar_message (GtkObject *object, const gchar *status, EAddressbookView *eav)
+{
+ emit_folder_bar_message (eav, status);
+}
+
+static void
stop_state_changed (GtkObject *object, EAddressbookView *eav)
{
command_state_change (eav);
diff --git a/addressbook/gui/widgets/e-addressbook-view.h b/addressbook/gui/widgets/e-addressbook-view.h
index 8fc807572a..621f26bb2a 100644
--- a/addressbook/gui/widgets/e-addressbook-view.h
+++ b/addressbook/gui/widgets/e-addressbook-view.h
@@ -90,7 +90,8 @@ struct _EAddressbookViewClass
/*
* Signals
*/
- void (*status_message) (EAddressbookView *view, const gchar *message);
+ void (*status_message) (EAddressbookView *view, const gchar *message);
+ void (*folder_bar_message) (EAddressbookView *view, const gchar *message);
void (*command_state_change) (EAddressbookView *view);
};