diff options
author | Harry Lu <harry.lu@sun.com> | 2005-01-19 17:06:52 +0800 |
---|---|---|
committer | Harry Lu <haip@src.gnome.org> | 2005-01-19 17:06:52 +0800 |
commit | 03834b258039f35962327530bc1e892b2d3ee8ec (patch) | |
tree | 9e641c0675ed0b79f635535e46e5e5d3fa7f217a /widgets/misc/e-combo-cell-editable.c | |
parent | a3af35f7b66f27331c9f20d80d12a1173760313c (diff) | |
download | gsoc2013-evolution-03834b258039f35962327530bc1e892b2d3ee8ec.tar.gz gsoc2013-evolution-03834b258039f35962327530bc1e892b2d3ee8ec.tar.zst gsoc2013-evolution-03834b258039f35962327530bc1e892b2d3ee8ec.zip |
Fix for 46359, enable "Alt+Down Arrow" to show the popup for
2005-01-19 Harry Lu <harry.lu@sun.com>
Fix for 46359, enable "Alt+Down Arrow" to show the popup for
e-combo-cell-editable.c.
* e-combo-cell-editable.c: (show_popup): rewrite it to a more
generic function.
(button_clicked_cb): call the new show_popup function.
(entry_key_press_event_cb): show popup if "Alt+Down Arrow".
(ecce_grab_focus): new function.
(ecce_class_init): add grab_focus handler so that the entry
can get focus.
svn path=/trunk/; revision=28446
Diffstat (limited to 'widgets/misc/e-combo-cell-editable.c')
-rw-r--r-- | widgets/misc/e-combo-cell-editable.c | 41 |
1 files changed, 29 insertions, 12 deletions
diff --git a/widgets/misc/e-combo-cell-editable.c b/widgets/misc/e-combo-cell-editable.c index f8de7c9ebc..5a39974f17 100644 --- a/widgets/misc/e-combo-cell-editable.c +++ b/widgets/misc/e-combo-cell-editable.c @@ -225,9 +225,11 @@ position_popup (EComboCellEditable *ecce, gint x, gint y, gint offset) } static void -show_popup (EComboCellEditable *ecce, gint x, gint y, gint offset) +show_popup (EComboCellEditable *ecce) { gint row; + GtkAllocation alloc; + gint x, y; if (!ecce->priv->list) return; @@ -236,7 +238,11 @@ show_popup (EComboCellEditable *ecce, gint x, gint y, gint offset) row = lookup_row (ecce->priv->list, e_combo_cell_editable_get_text (ecce)); set_cursor (ecce->priv->tree_view, row); - position_popup (ecce, x, y, offset); + gtk_editable_select_region (GTK_EDITABLE (ecce->priv->entry), 0, 0); + gdk_window_get_origin (GTK_WIDGET (ecce)->window, &x, &y); + alloc = GTK_WIDGET (ecce)->allocation; + + position_popup (ecce, x, y + alloc.height, alloc.height); gtk_grab_add (GTK_WIDGET (ecce->priv->popup)); gtk_widget_grab_focus (GTK_WIDGET (ecce->priv->tree_view)); @@ -246,21 +252,12 @@ show_popup (EComboCellEditable *ecce, gint x, gint y, gint offset) static void button_clicked_cb (GtkButton *btn, EComboCellEditable *ecce) { - GtkAllocation alloc; - gint x, y; - if (ecce->priv->popup) { kill_popup (ecce); return; } - - gtk_editable_select_region (GTK_EDITABLE (ecce->priv->entry), 0, 0); - - gdk_window_get_origin (GTK_WIDGET (ecce)->window, &x, &y); - - alloc = GTK_WIDGET (ecce)->allocation; - show_popup (ecce, x, y + alloc.height, alloc.height); + show_popup (ecce); } static void @@ -280,6 +277,14 @@ entry_key_press_event_cb (GtkEntry *entry, GdkEventKey *key_event, EComboCellEdi return TRUE; } + if (key_event->state & GDK_MOD1_MASK + && key_event->keyval == GDK_Down) { + if (!ecce->priv->popup) + show_popup (ecce); + + return TRUE; + } + return FALSE; } @@ -336,10 +341,22 @@ ecce_init (EComboCellEditable *ecce) } static void +ecce_grab_focus (GtkWidget *widget) +{ + EComboCellEditable *ecce = E_COMBO_CELL_EDITABLE (widget); + + gtk_widget_grab_focus (GTK_WIDGET (ecce->priv->entry)); +} + +static void ecce_class_init (GObjectClass *klass) { + GtkWidgetClass *widget_class = (GtkWidgetClass *)klass; + klass->finalize = ecce_finalize; + widget_class->grab_focus = ecce_grab_focus; + parent_class = GTK_EVENT_BOX_CLASS (g_type_class_peek_parent (klass)); } |