# HG changeset patch # User Paul Aurich # Date 1276641769 0 # Node ID d78a3f06b7a037f7e5fab38386642289b2a6501f # Parent 92a5d4b38f21443f42171fac01e640e01381ba80# Parent 6943aec8cf6130d0cb23975991974d1553a5f6a9 merge of '2e4b491ee89464d56b79db045bcef7f63fda6b97' and 'fc7c355ab0d2fb25d82bfd4e3847128276915e28' diff -r 92a5d4b38f21 -r d78a3f06b7a0 ChangeLog --- a/ChangeLog Tue Jun 15 22:41:37 2010 +0000 +++ b/ChangeLog Tue Jun 15 22:42:49 2010 +0000 @@ -8,8 +8,10 @@ * Re-focus the input area after clicking the attention toolbar button. Finch: - * Rebindable suggest-next-page and suggest-prev-page actions for + * Rebindable 'suggest-next-page' and 'suggest-prev-page' actions for textboxes (GntEntry) to scroll through list of suggestions. + * Rebindable 'dropdown' action for comboboxes (GntComboBox) to show the + dropdown list of options. XMPP: * Allow connecting to servers that only advertise GSSAPI and expect diff -r 92a5d4b38f21 -r d78a3f06b7a0 doc/finch.1.in --- a/doc/finch.1.in Tue Jun 15 22:41:37 2010 +0000 +++ b/doc/finch.1.in Tue Jun 15 22:42:49 2010 +0000 @@ -305,6 +305,13 @@ left = focus-prev .br +[GntComboBox::binding] +.br +down = dropdown +.br +up = dropdown + +.br [GntEntry::binding] .br c-a = cursor-home diff -r 92a5d4b38f21 -r d78a3f06b7a0 finch/libgnt/gntbox.c --- a/finch/libgnt/gntbox.c Tue Jun 15 22:41:37 2010 +0000 +++ b/finch/libgnt/gntbox.c Tue Jun 15 22:42:49 2010 +0000 @@ -422,7 +422,9 @@ gnt_widget_get_size(wid, &w, &h); - if (wid != last && !child && w > 0 && h > 0 && gnt_widget_confirm_size(wid, w - wchange, h - hchange)) { + if (wid != last && !child && w > 0 && h > 0 && + !GNT_WIDGET_IS_FLAG_SET(wid, GNT_WIDGET_INVISIBLE) && + gnt_widget_confirm_size(wid, w - wchange, h - hchange)) { child = wid; break; } diff -r 92a5d4b38f21 -r d78a3f06b7a0 finch/libgnt/gntcombobox.c --- a/finch/libgnt/gntcombobox.c Tue Jun 15 22:41:37 2010 +0000 +++ b/finch/libgnt/gntcombobox.c Tue Jun 15 22:42:49 2010 +0000 @@ -25,6 +25,7 @@ #include "gntcombobox.h" #include "gnttree.h" #include "gntmarshal.h" +#include "gntstyle.h" #include "gntutils.h" #include @@ -168,18 +169,6 @@ if (gnt_widget_key_pressed(box->dropdown, text)) return TRUE; } - else - { - if (text[0] == 27) - { - if (strcmp(text, GNT_KEY_UP) == 0 || - strcmp(text, GNT_KEY_DOWN) == 0) - { - popup_dropdown(box); - return TRUE; - } - } - } return FALSE; } @@ -229,9 +218,20 @@ gnt_widget_set_size(box->dropdown, widget->priv.width - 1, box->dropdown->priv.height); } +static gboolean +dropdown_menu(GntBindable *b, GList *null) +{ + if (GNT_WIDGET_IS_FLAG_SET(GNT_COMBO_BOX(b)->dropdown->parent, GNT_WIDGET_MAPPED)) + return FALSE; + popup_dropdown(GNT_COMBO_BOX(b)); + return TRUE; +} + static void gnt_combo_box_class_init(GntComboBoxClass *klass) { + GntBindableClass *bindable = GNT_BINDABLE_CLASS(klass); + parent_class = GNT_WIDGET_CLASS(klass); parent_class->destroy = gnt_combo_box_destroy; @@ -245,7 +245,7 @@ widget_lost_focus = parent_class->lost_focus; parent_class->lost_focus = gnt_combo_box_lost_focus; - signals[SIG_SELECTION_CHANGED] = + signals[SIG_SELECTION_CHANGED] = g_signal_new("selection-changed", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST, @@ -254,6 +254,12 @@ gnt_closure_marshal_VOID__POINTER_POINTER, G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER); + gnt_bindable_class_register_action(bindable, "dropdown", dropdown_menu, + GNT_KEY_DOWN, NULL); + gnt_bindable_register_binding(bindable, "dropdown", GNT_KEY_UP, NULL); + + gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable); + GNTDEBUG; } @@ -272,7 +278,7 @@ GNT_WIDGET_SET_FLAGS(box, GNT_WIDGET_NO_SHADOW | GNT_WIDGET_NO_BORDER | GNT_WIDGET_TRANSIENT); gnt_box_set_pad(GNT_BOX(box), 0); gnt_box_add_widget(GNT_BOX(box), combo->dropdown); - + widget->priv.minw = 4; widget->priv.minh = 3; GNTDEBUG;