diff options
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r-- | addressbook/gui/widgets/e-minicard-label.c | 32 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 27 | ||||
-rw-r--r-- | addressbook/gui/widgets/test-minicard-label.c | 2 | ||||
-rw-r--r-- | addressbook/gui/widgets/test-minicard.c | 2 | ||||
-rw-r--r-- | addressbook/gui/widgets/test-reflow.c | 2 |
5 files changed, 43 insertions, 22 deletions
diff --git a/addressbook/gui/widgets/e-minicard-label.c b/addressbook/gui/widgets/e-minicard-label.c index 43603f2d6d..5b528d6190 100644 --- a/addressbook/gui/widgets/e-minicard-label.c +++ b/addressbook/gui/widgets/e-minicard-label.c @@ -24,6 +24,7 @@ #include "e-minicard-label.h" #include "e-text.h" #include "e-canvas.h" +#include "e-util.h" static void e_minicard_label_init (EMinicardLabel *card); static void e_minicard_label_class_init (EMinicardLabelClass *klass); static void e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); @@ -32,8 +33,8 @@ static gboolean e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event); static void e_minicard_label_realize (GnomeCanvasItem *item); static void e_minicard_label_unrealize (GnomeCanvasItem *item); -static void _update_label( EMinicardLabel *minicard_label ); -static void _resize( GtkObject *object, gpointer data ); +static void update_label( EMinicardLabel *minicard_label ); +static void resize( GtkObject *object, gpointer data ); static GnomeCanvasGroupClass *parent_class = NULL; @@ -148,11 +149,11 @@ e_minicard_label_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) switch (arg_id){ case ARG_WIDTH: e_minicard_label->width = GTK_VALUE_DOUBLE (*arg); - _update_label( e_minicard_label ); + update_label( e_minicard_label ); gnome_canvas_item_request_update (item); break; case ARG_HAS_FOCUS: - if (e_minicard_label->field && GTK_VALUE_BOOL(*arg)) + if (e_minicard_label->field && (GTK_VALUE_ENUM(*arg) != E_FOCUS_NONE)) e_canvas_item_grab_focus(e_minicard_label->field); break; case ARG_FIELD: @@ -186,7 +187,7 @@ e_minicard_label_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) GTK_VALUE_DOUBLE (*arg) = e_minicard_label->height; break; case ARG_HAS_FOCUS: - GTK_VALUE_BOOL (*arg) = e_minicard_label->has_focus; + GTK_VALUE_ENUM (*arg) = e_minicard_label->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; break; case ARG_FIELD: if ( e_minicard_label->field ) { @@ -213,6 +214,11 @@ e_minicard_label_realize (GnomeCanvasItem *item) { EMinicardLabel *e_minicard_label; GnomeCanvasGroup *group; + static GdkFont *font = NULL; + + if ( font == NULL ) { + font = gdk_font_load("lucidasans-10"); + } e_minicard_label = E_MINICARD_LABEL (item); group = GNOME_CANVAS_GROUP( item ); @@ -239,7 +245,7 @@ e_minicard_label_realize (GnomeCanvasItem *item) "clip_height", (double) 1, "clip", TRUE, "use_ellipsis", TRUE, - "font", "lucidasans-10", + "font_gdk", font, "fill_color", "black", NULL ); if ( e_minicard_label->fieldname_text ) @@ -251,7 +257,7 @@ e_minicard_label_realize (GnomeCanvasItem *item) } gtk_signal_connect(GTK_OBJECT(e_minicard_label->fieldname), "resize", - GTK_SIGNAL_FUNC(_resize), + GTK_SIGNAL_FUNC(resize), (gpointer) e_minicard_label); e_minicard_label->field = @@ -264,7 +270,7 @@ e_minicard_label_realize (GnomeCanvasItem *item) "clip_height", (double) 1, "clip", TRUE, "use_ellipsis", TRUE, - "font", "lucidasans-10", + "font_gdk", font, "fill_color", "black", "editable", TRUE, NULL ); @@ -278,10 +284,10 @@ e_minicard_label_realize (GnomeCanvasItem *item) gtk_signal_connect(GTK_OBJECT(e_minicard_label->field), "resize", - GTK_SIGNAL_FUNC(_resize), + GTK_SIGNAL_FUNC(resize), (gpointer) e_minicard_label); - _update_label (e_minicard_label); + update_label (e_minicard_label); if (!item->canvas->aa) { @@ -400,7 +406,7 @@ e_minicard_label_event (GnomeCanvasItem *item, GdkEvent *event) } static void -_update_label( EMinicardLabel *e_minicard_label ) +update_label( EMinicardLabel *e_minicard_label ) { if ( GTK_OBJECT_FLAGS( e_minicard_label ) & GNOME_CANVAS_ITEM_REALIZED ) { @@ -450,7 +456,7 @@ _update_label( EMinicardLabel *e_minicard_label ) static void -_resize( GtkObject *object, gpointer data ) +resize( GtkObject *object, gpointer data ) { - _update_label(E_MINICARD_LABEL(data)); + update_label(E_MINICARD_LABEL(data)); } diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index b667f1ac21..805c4e78ff 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -25,6 +25,7 @@ #include "e-minicard-label.h" #include "e-text.h" #include "e-canvas.h" +#include "e-util.h" static void e_minicard_init (EMinicard *card); static void e_minicard_class_init (EMinicardClass *klass); static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); @@ -105,7 +106,7 @@ e_minicard_class_init (EMinicardClass *klass) GTK_ARG_READWRITE, ARG_WIDTH); gtk_object_add_arg_type ("EMinicard::height", GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_HEIGHT); - gtk_object_add_arg_type ("EMinicard::has_focus", GTK_TYPE_BOOL, + gtk_object_add_arg_type ("EMinicard::has_focus", GTK_TYPE_ENUM, GTK_ARG_READWRITE, ARG_HAS_FOCUS); gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD); @@ -149,10 +150,18 @@ e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) } break; case ARG_HAS_FOCUS: - if (e_minicard->fields) - gnome_canvas_item_set(GNOME_CANVAS_ITEM(e_minicard->fields->data), - "has_focus", GTK_VALUE_BOOL(*arg), - NULL); + if (e_minicard->fields) { + if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_START || + GTK_VALUE_ENUM(*arg) == E_FOCUS_CURRENT) { + gnome_canvas_item_set(GNOME_CANVAS_ITEM(e_minicard->fields->data), + "has_focus", GTK_VALUE_ENUM(*arg), + NULL); + } else if ( GTK_VALUE_ENUM(*arg) == E_FOCUS_END ) { + gnome_canvas_item_set(GNOME_CANVAS_ITEM(g_list_last(e_minicard->fields)->data), + "has_focus", GTK_VALUE_ENUM(*arg), + NULL); + } + } else e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(e_minicard)); break; @@ -179,7 +188,7 @@ e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) GTK_VALUE_DOUBLE (*arg) = e_minicard->height; break; case ARG_HAS_FOCUS: - GTK_VALUE_BOOL (*arg) = e_minicard->has_focus; + GTK_VALUE_ENUM (*arg) = e_minicard->has_focus ? E_FOCUS_CURRENT : E_FOCUS_NONE; break; case ARG_CARD: /* GTK_VALUE_POINTER (*arg) = e_minicard->card; */ @@ -364,11 +373,11 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) GList *list; for (list = e_minicard->fields; list; list = list->next) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (list->data); - gboolean has_focus; + EFocus has_focus; gtk_object_get(GTK_OBJECT(item), "has_focus", &has_focus, NULL); - if (has_focus) { + if (has_focus != E_FOCUS_NONE) { if (event->key.state & GDK_SHIFT_MASK) list = list->prev; else @@ -376,7 +385,7 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) if (list) { item = GNOME_CANVAS_ITEM (list->data); gnome_canvas_item_set(item, - "has_focus", TRUE, + "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START, NULL); return 1; } else { diff --git a/addressbook/gui/widgets/test-minicard-label.c b/addressbook/gui/widgets/test-minicard-label.c index 67c17a0ace..8da34e6f22 100644 --- a/addressbook/gui/widgets/test-minicard-label.c +++ b/addressbook/gui/widgets/test-minicard-label.c @@ -44,6 +44,7 @@ static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpoi NULL ); } +#if 0 static void about_callback( GtkWidget *widget, gpointer data ) { @@ -61,6 +62,7 @@ static void about_callback( GtkWidget *widget, gpointer data ) NULL); gtk_widget_show (about); } +#endif static void button_press_callback( GtkWidget *widget, gpointer data ) { diff --git a/addressbook/gui/widgets/test-minicard.c b/addressbook/gui/widgets/test-minicard.c index 79077c4b2d..1ad066b3fe 100644 --- a/addressbook/gui/widgets/test-minicard.c +++ b/addressbook/gui/widgets/test-minicard.c @@ -43,6 +43,7 @@ static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, gpoi NULL ); } +#if 0 static void about_callback( GtkWidget *widget, gpointer data ) { @@ -60,6 +61,7 @@ static void about_callback( GtkWidget *widget, gpointer data ) NULL); gtk_widget_show (about); } +#endif int main( int argc, char *argv[] ) { diff --git a/addressbook/gui/widgets/test-reflow.c b/addressbook/gui/widgets/test-reflow.c index 4533e0249d..319a3f5626 100644 --- a/addressbook/gui/widgets/test-reflow.c +++ b/addressbook/gui/widgets/test-reflow.c @@ -69,6 +69,7 @@ static void resize(GnomeCanvasItem *item, gpointer data) NULL ); } +#if 0 static void about_callback( GtkWidget *widget, gpointer data ) { @@ -86,6 +87,7 @@ static void about_callback( GtkWidget *widget, gpointer data ) NULL); gtk_widget_show (about); } +#endif int main( int argc, char *argv[] ) { |