aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-05-30 23:27:32 +0800
committerChris Lahey <clahey@src.gnome.org>2000-05-30 23:27:32 +0800
commitcea90a9fdf73a3e1ae7de837e64d6e2c74acfb80 (patch)
treeb6f6f7353295b3f00150218235c54a2c3d37883f /addressbook/gui/widgets
parent336efb38c6245c06f48704a0f0c07693bf58f9ee (diff)
downloadgsoc2013-evolution-cea90a9fdf73a3e1ae7de837e64d6e2c74acfb80.tar
gsoc2013-evolution-cea90a9fdf73a3e1ae7de837e64d6e2c74acfb80.tar.gz
gsoc2013-evolution-cea90a9fdf73a3e1ae7de837e64d6e2c74acfb80.tar.bz2
gsoc2013-evolution-cea90a9fdf73a3e1ae7de837e64d6e2c74acfb80.tar.lz
gsoc2013-evolution-cea90a9fdf73a3e1ae7de837e64d6e2c74acfb80.tar.xz
gsoc2013-evolution-cea90a9fdf73a3e1ae7de837e64d6e2c74acfb80.tar.zst
gsoc2013-evolution-cea90a9fdf73a3e1ae7de837e64d6e2c74acfb80.zip
Made double clicking create a new card. Set the empty message.
2000-05-30 Christopher James Lahey <clahey@helixcode.com> * gui/minicard/e-minicard-view.c: Made double clicking create a new card. Set the empty message. * gui/minicard/e-minicard.c: Made sorting be case insensitive. * gui/minicard/e-reflow-sorted.c, e-reflow.c, e-reflow.h: Added a message for when the reflow is empty. * printing/e-contact-print.c, printing/medbook.ecps: Made the default printout be full page. Made sorting case insensitive. svn path=/trunk/; revision=3281
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c77
-rw-r--r--addressbook/gui/widgets/e-minicard.c2
2 files changed, 78 insertions, 1 deletions
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 566b798987..d3acb1ad54 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -25,11 +25,13 @@
#include <e-util/e-canvas.h>
#include "e-minicard-view.h"
#include "e-minicard.h"
+#include "e-contact-editor.h"
static void e_minicard_view_init (EMinicardView *reflow);
static void e_minicard_view_class_init (EMinicardViewClass *klass);
static void e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
static void e_minicard_view_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void e_minicard_view_destroy (GtkObject *object);
+static gboolean e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event);
static void canvas_destroy (GtkObject *object, EMinicardView *view);
static void disconnect_signals (EMinicardView *view);
@@ -86,6 +88,8 @@ e_minicard_view_class_init (EMinicardViewClass *klass)
object_class->set_arg = e_minicard_view_set_arg;
object_class->get_arg = e_minicard_view_get_arg;
object_class->destroy = e_minicard_view_destroy;
+
+ item_class->event = e_minicard_view_event;
/* GnomeCanvasItem method overrides */
}
@@ -101,6 +105,11 @@ e_minicard_view_init (EMinicardView *view)
view->remove_card_id = 0;
view->modify_card_id = 0;
view->canvas_destroy_id = 0;
+
+ gtk_object_set(GTK_OBJECT(view),
+ "empty_message", _("There are no items to show in this view\n\n"
+ "Double-click here to create a new Contact."),
+ NULL);
E_REFLOW_SORTED(view)->compare_func = (GCompareFunc) e_minicard_compare;
E_REFLOW_SORTED(view)->string_func = (EReflowStringFunc) e_minicard_get_card_id;
@@ -259,6 +268,74 @@ e_minicard_view_destroy (GtkObject *object)
}
static void
+card_added_cb (EBook* book, EBookStatus status, const char *id,
+ gpointer user_data)
+{
+ g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__);
+}
+
+static gboolean
+e_minicard_view_event (GnomeCanvasItem *item, GdkEvent *event)
+{
+ EMinicardView *view;
+
+ view = E_MINICARD_VIEW (item);
+
+ switch( event->type ) {
+ case GDK_2BUTTON_PRESS:
+ {
+ gint result;
+ ECard *card;
+ GtkWidget* contact_editor;
+ EBook *book;
+ GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL);
+
+ card = e_card_new("");
+ contact_editor = e_contact_editor_new(card);
+ gtk_object_sink(GTK_OBJECT(card));
+
+ gtk_window_set_policy(GTK_WINDOW(dlg), FALSE, TRUE, FALSE);
+
+ gtk_object_get(GTK_OBJECT(view), "book", &book, NULL);
+
+
+ g_assert (E_IS_BOOK (book));
+
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox),
+ contact_editor, TRUE, TRUE, 0);
+
+ gtk_widget_show (contact_editor);
+ gtk_widget_show (dlg);
+
+ gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE);
+ result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
+
+
+ /* If the user clicks "okay"...*/
+ if (result == 0) {
+ ECard *card;
+ g_assert (contact_editor);
+ g_assert (GTK_IS_OBJECT (contact_editor));
+ gtk_object_get(GTK_OBJECT(contact_editor),
+ "card", &card,
+ NULL);
+
+ /* Add the card in the contact editor to our ebook */
+ e_book_add_card (
+ book,
+ card,
+ card_added_cb,
+ NULL);
+ }
+ }
+ return FALSE;
+ default:
+ return TRUE;
+ break;
+ }
+}
+
+static void
disconnect_signals(EMinicardView *view)
{
if (view->book_view && view->create_card_id)
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 7831b3152d..834bd3a0b0 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -674,7 +674,7 @@ e_minicard_compare (EMinicard *minicard1, EMinicard *minicard2)
"file_as", &file_as2,
NULL);
if (file_as1 && file_as2)
- return strcmp(file_as1, file_as2);
+ return strcasecmp(file_as1, file_as2);
if (file_as1)
return -1;
if (file_as2)