diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-10-26 21:24:50 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-10-26 21:24:50 +0800 |
commit | d609a3a09c88b9fc96f300b3637fb1b14f282142 (patch) | |
tree | 5cdb7ab0a22cc8da2a464183f0863a173cdd5fb8 | |
parent | 2ea215ff874c94e37b6bbb51757f156c8a8fb629 (diff) | |
download | gsoc2013-evolution-d609a3a09c88b9fc96f300b3637fb1b14f282142.tar gsoc2013-evolution-d609a3a09c88b9fc96f300b3637fb1b14f282142.tar.gz gsoc2013-evolution-d609a3a09c88b9fc96f300b3637fb1b14f282142.tar.bz2 gsoc2013-evolution-d609a3a09c88b9fc96f300b3637fb1b14f282142.tar.lz gsoc2013-evolution-d609a3a09c88b9fc96f300b3637fb1b14f282142.tar.xz gsoc2013-evolution-d609a3a09c88b9fc96f300b3637fb1b14f282142.tar.zst gsoc2013-evolution-d609a3a09c88b9fc96f300b3637fb1b14f282142.zip |
Added has_cursor argument. Setting the argument to TRUE if the minicard
2001-10-26 Christopher James Lahey <clahey@ximian.com>
* gui/widgets/e-minicard.c, gui/widgets/e-minicard.h
(set_has_cursor): Added has_cursor argument. Setting the argument
to TRUE if the minicard doesn't have focus will grab the focus.
Fixes Ximian bug #3024.
svn path=/trunk/; revision=14137
-rw-r--r-- | addressbook/ChangeLog | 7 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard.c | 57 | ||||
-rw-r--r-- | addressbook/gui/widgets/e-minicard.h | 3 |
3 files changed, 51 insertions, 16 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 3850f1d622..bf4001bfcb 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,10 @@ +2001-10-26 Christopher James Lahey <clahey@ximian.com> + + * gui/widgets/e-minicard.c, gui/widgets/e-minicard.h + (set_has_cursor): Added has_cursor argument. Setting the argument + to TRUE if the minicard doesn't have focus will grab the focus. + Fixes Ximian bug #3024. + 2001-10-24 Jon Trowbridge <trow@ximian.com> * gui/component/addressbook-factory.c (main): Initialize diff --git a/addressbook/gui/widgets/e-minicard.c b/addressbook/gui/widgets/e-minicard.c index 754aaf3e9d..9122fd49b0 100644 --- a/addressbook/gui/widgets/e-minicard.c +++ b/addressbook/gui/widgets/e-minicard.c @@ -66,6 +66,8 @@ struct _EMinicardField { GnomeCanvasItem *label; }; +#define d(x) + #define LIST_ICON_FILENAME "contact-is-a-list.png" #define E_MINICARD_FIELD(field) ((EMinicardField *)(field)) @@ -84,6 +86,7 @@ enum { ARG_HEIGHT, ARG_HAS_FOCUS, ARG_SELECTED, + ARG_HAS_CURSOR, ARG_EDITABLE, ARG_CARD }; @@ -140,6 +143,8 @@ e_minicard_class_init (EMinicardClass *klass) GTK_ARG_READWRITE, ARG_HAS_FOCUS); gtk_object_add_arg_type ("EMinicard::selected", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SELECTED); + gtk_object_add_arg_type ("EMinicard::has_cursor", GTK_TYPE_BOOL, + GTK_ARG_READWRITE, ARG_HAS_CURSOR); gtk_object_add_arg_type ("EMinicard::editable", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE); gtk_object_add_arg_type ("EMinicard::card", GTK_TYPE_OBJECT, @@ -180,23 +185,24 @@ static void e_minicard_init (EMinicard *minicard) { /* minicard->card = NULL;*/ - minicard->rect = NULL; - minicard->fields = NULL; - minicard->width = 10; - minicard->height = 10; - minicard->has_focus = FALSE; - minicard->selected = FALSE; - minicard->editable = FALSE; - - minicard->card = NULL; - minicard->simple = e_card_simple_new(NULL); + minicard->rect = NULL; + minicard->fields = NULL; + minicard->width = 10; + minicard->height = 10; + minicard->has_focus = FALSE; + minicard->selected = FALSE; + minicard->editable = FALSE; + minicard->has_cursor = FALSE; + + minicard->card = NULL; + minicard->simple = e_card_simple_new(NULL); minicard->list_icon_pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" LIST_ICON_FILENAME); - minicard->list_icon_size = gdk_pixbuf_get_height (minicard->list_icon_pixbuf); + minicard->list_icon_size = gdk_pixbuf_get_height (minicard->list_icon_pixbuf); - minicard->editor = NULL; + minicard->editor = NULL; - minicard->changed = FALSE; + minicard->changed = FALSE; e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(minicard), e_minicard_reflow); } @@ -229,6 +235,14 @@ set_selected (EMinicard *minicard, gboolean selected) minicard->selected = selected; } +static void +set_has_cursor (EMinicard *minicard, gboolean has_cursor) +{ + if (!minicard->has_focus && has_cursor) + e_canvas_item_grab_focus(GNOME_CANVAS_ITEM (minicard), FALSE); + minicard->has_cursor = has_cursor; +} + static void e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) @@ -262,8 +276,10 @@ e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) NULL); } } - else - e_canvas_item_grab_focus(item, FALSE); + else { + if (!e_minicard->has_focus) + e_canvas_item_grab_focus(item, FALSE); + } break; case ARG_SELECTED: if (e_minicard->selected != GTK_VALUE_BOOL(*arg)) @@ -276,6 +292,11 @@ e_minicard_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) "editable", e_minicard->editable, NULL); break; + case ARG_HAS_CURSOR: + d(g_print("%s: ARG_HAS_CURSOR\n", __FUNCTION__)); + if (e_minicard->has_cursor != GTK_VALUE_BOOL(*arg)) + set_has_cursor (e_minicard, GTK_VALUE_BOOL(*arg)); + break; case ARG_CARD: if (e_minicard->card) gtk_object_unref (GTK_OBJECT(e_minicard->card)); @@ -312,6 +333,9 @@ e_minicard_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) case ARG_SELECTED: GTK_VALUE_BOOL (*arg) = e_minicard->selected; break; + case ARG_HAS_CURSOR: + GTK_VALUE_BOOL (*arg) = e_minicard->has_cursor; + break; case ARG_EDITABLE: GTK_VALUE_BOOL (*arg) = e_minicard->editable; break; @@ -474,7 +498,10 @@ e_minicard_event (GnomeCanvasItem *item, GdkEvent *event) case GDK_FOCUS_CHANGE: { GdkEventFocus *focus_event = (GdkEventFocus *) event; + d(g_print("%s: GDK_FOCUS_CHANGE: %s\n", __FUNCTION__, focus_event->in?"in":"out")); if (focus_event->in) { + /* Chris: When EMinicard gets the cursor, if it doesn't have the focus, it should take it. */ + e_minicard->has_focus = TRUE; if (!e_minicard->selected) { e_minicard_selected(e_minicard, event); } diff --git a/addressbook/gui/widgets/e-minicard.h b/addressbook/gui/widgets/e-minicard.h index bd74a24c09..434f7637a1 100644 --- a/addressbook/gui/widgets/e-minicard.h +++ b/addressbook/gui/widgets/e-minicard.h @@ -83,7 +83,8 @@ struct _EMinicard guint changed : 1; guint selected : 1; - + guint has_cursor : 1; + guint has_focus : 1; guint editable : 1; |