aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-10-29 20:31:45 +0800
committerChris Lahey <clahey@src.gnome.org>2001-10-29 20:31:45 +0800
commit0a52d890e3b75aa2d1fae3da6c206055cd723cc6 (patch)
treedec38a0f777a6838e09a9f9633987550455a7a38 /addressbook
parente3e57f4defa9cb92362a096e5ccb000ffa210be3 (diff)
downloadgsoc2013-evolution-0a52d890e3b75aa2d1fae3da6c206055cd723cc6.tar
gsoc2013-evolution-0a52d890e3b75aa2d1fae3da6c206055cd723cc6.tar.gz
gsoc2013-evolution-0a52d890e3b75aa2d1fae3da6c206055cd723cc6.tar.bz2
gsoc2013-evolution-0a52d890e3b75aa2d1fae3da6c206055cd723cc6.tar.lz
gsoc2013-evolution-0a52d890e3b75aa2d1fae3da6c206055cd723cc6.tar.xz
gsoc2013-evolution-0a52d890e3b75aa2d1fae3da6c206055cd723cc6.tar.zst
gsoc2013-evolution-0a52d890e3b75aa2d1fae3da6c206055cd723cc6.zip
Handle returning dates here. (e_card_simple_get_allow_newlines): New
2001-10-29 Christopher James Lahey <clahey@ximian.com> * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h (e_card_simple_get): Handle returning dates here. (e_card_simple_get_allow_newlines): New function. Returns whether it makes much sense to have newlines in this string. * gui/component/addressbook-config.c, gui/component/addressbook-config.h (addressbook_create_new_source): The first argument here should be const. * gui/component/addressbook-storage.c: Added #include "addressbook-config.h". * gui/widgets/e-minicard-label.c (e_minicard_label_event): On an escape here, cancel editing and remove the focus from the text. * gui/widgets/e-minicard.c (add_field): Set allow_newlines here. (field_activated): Stop editing on the activate signal and remove the focus from the text. Fixes Ximian bug #12286. svn path=/trunk/; revision=14335
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog22
-rw-r--r--addressbook/backend/ebook/e-card-simple.c37
-rw-r--r--addressbook/backend/ebook/e-card-simple.h2
-rw-r--r--addressbook/gui/component/addressbook-config.c2
-rw-r--r--addressbook/gui/component/addressbook-config.h2
-rw-r--r--addressbook/gui/component/addressbook-storage.c5
-rw-r--r--addressbook/gui/widgets/e-minicard-label.c16
-rw-r--r--addressbook/gui/widgets/e-minicard.c12
8 files changed, 92 insertions, 6 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 3c4b184fba..2553bdbb44 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,25 @@
+2001-10-29 Christopher James Lahey <clahey@ximian.com>
+
+ * backend/ebook/e-card-simple.c, backend/ebook/e-card-simple.h
+ (e_card_simple_get): Handle returning dates here.
+ (e_card_simple_get_allow_newlines): New function. Returns whether
+ it makes much sense to have newlines in this string.
+
+ * gui/component/addressbook-config.c,
+ gui/component/addressbook-config.h
+ (addressbook_create_new_source): The first argument here should
+ be const.
+
+ * gui/component/addressbook-storage.c: Added #include
+ "addressbook-config.h".
+
+ * gui/widgets/e-minicard-label.c (e_minicard_label_event): On an
+ escape here, cancel editing and remove the focus from the text.
+
+ * gui/widgets/e-minicard.c (add_field): Set allow_newlines here.
+ (field_activated): Stop editing on the activate signal and remove
+ the focus from the text. Fixes Ximian bug #12286.
+
2001-10-28 JP Rosevear <jpr@ximian.com>
* conduit/address-conduit.h: tidy
diff --git a/addressbook/backend/ebook/e-card-simple.c b/addressbook/backend/ebook/e-card-simple.c
index 9e6100b5f3..1a54ab00e6 100644
--- a/addressbook/backend/ebook/e-card-simple.c
+++ b/addressbook/backend/ebook/e-card-simple.c
@@ -15,6 +15,7 @@
#include <string.h>
#include <gtk/gtkobject.h>
#include <e-util/e-unicode-i18n.h>
+#include <gal/util/e-util.h>
#include <libversit/vcc.h>
#include "e-card-simple.h"
@@ -772,10 +773,19 @@ char *e_card_simple_get (ECardSimple *simple,
return NULL;
case E_CARD_SIMPLE_INTERNAL_TYPE_DATE:
if (simple->card) {
+ char buf[26];
+ struct tm then;
gtk_object_get(GTK_OBJECT(simple->card),
field_data[field].ecard_field, &date,
NULL);
- return NULL; /* FIXME!!!! */
+ then.tm_year = date->year;
+ then.tm_mon = date->month - 1;
+ then.tm_mday = date->day;
+ then.tm_hour = 12;
+ then.tm_min = 0;
+ then.tm_sec = 0;
+ e_strftime_fix_am_pm (buf, 26, _("%x"), &then);
+ return g_strdup (buf);
} else
return NULL;
case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS:
@@ -1096,6 +1106,31 @@ const char *e_card_simple_get_name (ECardSimple *simple,
return U_(field_data[field].name);
}
+gboolean
+e_card_simple_get_allow_newlines (ECardSimple *simple,
+ ECardSimpleField field)
+{
+ ECardSimpleInternalType type = field_data[field].type;
+ switch(type) {
+ case E_CARD_SIMPLE_INTERNAL_TYPE_STRING:
+ case E_CARD_SIMPLE_INTERNAL_TYPE_PHONE:
+ case E_CARD_SIMPLE_INTERNAL_TYPE_EMAIL:
+ case E_CARD_SIMPLE_INTERNAL_TYPE_BOOL:
+ case E_CARD_SIMPLE_INTERNAL_TYPE_DATE:
+ case E_CARD_SIMPLE_INTERNAL_TYPE_SPECIAL:
+ default:
+ switch (field) {
+ case E_CARD_SIMPLE_FIELD_NOTE:
+ return TRUE;
+ default:
+ return FALSE;
+ }
+
+ case E_CARD_SIMPLE_INTERNAL_TYPE_ADDRESS:
+ return TRUE;
+ }
+}
+
const char *e_card_simple_get_short_name (ECardSimple *simple,
ECardSimpleField field)
{
diff --git a/addressbook/backend/ebook/e-card-simple.h b/addressbook/backend/ebook/e-card-simple.h
index 4acc95cab8..1e20085708 100644
--- a/addressbook/backend/ebook/e-card-simple.h
+++ b/addressbook/backend/ebook/e-card-simple.h
@@ -178,6 +178,8 @@ const char *e_card_simple_get_name (ECardSimple
ECardSimpleField field);
const char *e_card_simple_get_short_name (ECardSimple *simple,
ECardSimpleField field);
+gboolean e_card_simple_get_allow_newlines (ECardSimple *simple,
+ ECardSimpleField field);
/* Use these only if building lists of specific types. It should be
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
index d21ec43d14..de65019a97 100644
--- a/addressbook/gui/component/addressbook-config.c
+++ b/addressbook/gui/component/addressbook-config.c
@@ -269,7 +269,7 @@ addressbook_config_source_with_gui (GladeXML *gui, AddressbookSource *source, Gt
}
void
-addressbook_create_new_source (char *new_source, GtkWidget *parent)
+addressbook_create_new_source (const char *new_source, GtkWidget *parent)
{
AddressbookSourceDialog *dialog;
GladeXML *gui;
diff --git a/addressbook/gui/component/addressbook-config.h b/addressbook/gui/component/addressbook-config.h
index 48b797839f..b0adbd7330 100644
--- a/addressbook/gui/component/addressbook-config.h
+++ b/addressbook/gui/component/addressbook-config.h
@@ -26,6 +26,6 @@
#include "addressbook-storage.h"
void addressbook_config (GNOME_Evolution_Shell shell);
-void addressbook_create_new_source (char *new_source, GtkWidget *parent);
+void addressbook_create_new_source (const char *new_source, GtkWidget *parent);
#endif /* __ADDRESSBOOK_CONFIG_H__ */
diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c
index ec0dda84fc..647c21ef52 100644
--- a/addressbook/gui/component/addressbook-storage.c
+++ b/addressbook/gui/component/addressbook-storage.c
@@ -40,6 +40,8 @@
#include <config.h>
#endif
+#include "addressbook-storage.h"
+
#include <sys/types.h>
#include <sys/fcntl.h>
#include <sys/stat.h>
@@ -62,9 +64,8 @@
#include "e-util/e-unicode-i18n.h"
#include "evolution-shell-component.h"
-#include "evolution-storage.h"
-#include "addressbook-storage.h"
+#include "addressbook-config.h"
#define ADDRESSBOOK_SOURCES_XML "addressbook-sources.xml"
diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c
index 54779c4ea6..b59ff46ae3 100644
--- a/addressbook/gui/widgets/e-minicard-label.c
+++ b/addressbook/gui/widgets/e-minicard-label.c
@@ -20,13 +20,16 @@
*/
#include <config.h>
+
+#include "e-minicard-label.h"
+
#include <gtk/gtksignal.h>
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#include <gal/util/e-util.h>
#include <gal/e-text/e-text.h>
#include <gal/widgets/e-canvas.h>
#include <gal/widgets/e-canvas-utils.h>
-#include "e-minicard-label.h"
+#include <gdk/gdkkeysyms.h>
static void e_minicard_label_init (EMinicardLabel *card);
static void e_minicard_label_class_init (EMinicardLabelClass *klass);
@@ -300,6 +303,17 @@ e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event)
switch( event->type )
{
+ case GDK_KEY_PRESS:
+ if (event->key.keyval == GDK_Escape) {
+ GnomeCanvasItem *parent;
+
+ e_text_cancel_editing (E_TEXT (e_minicard_label->field));
+
+ parent = GNOME_CANVAS_ITEM (e_minicard_label)->parent;
+ if (parent)
+ e_canvas_item_grab_focus(parent, FALSE);
+ }
+ break;
case GDK_FOCUS_CHANGE:
{
GdkEventFocus *focus_event = (GdkEventFocus *) event;
diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c
index 96ae2fad9e..8991d8c757 100644
--- a/addressbook/gui/widgets/e-minicard.c
+++ b/addressbook/gui/widgets/e-minicard.c
@@ -709,6 +709,13 @@ field_changed (EText *text, EMinicard *e_minicard)
}
static void
+field_activated (EText *text, EMinicard *e_minicard)
+{
+ e_text_stop_editing (text);
+ e_canvas_item_grab_focus (GNOME_CANVAS_ITEM (e_minicard), FALSE);
+}
+
+static void
add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width)
{
GnomeCanvasItem *new_item;
@@ -745,6 +752,11 @@ add_field (EMinicard *e_minicard, ECardSimpleField field, gdouble left_width)
NULL );
gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
"changed", GTK_SIGNAL_FUNC(field_changed), e_minicard);
+ gtk_signal_connect(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
+ "activate", GTK_SIGNAL_FUNC(field_activated), e_minicard);
+ gtk_object_set(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
+ "allow_newlines", e_card_simple_get_allow_newlines (e_minicard->simple, field),
+ NULL);
gtk_object_set_data(GTK_OBJECT(E_MINICARD_LABEL(new_item)->field),
"EMinicard:field",
GINT_TO_POINTER(field));