Mercurial > pidgin
comparison finch/libgnt/gntcombobox.c @ 30243:658e8b9522bc
Make the combobox a bit more friendly.
While the dropdown in the combobox is not shown, and some key is pressed
that triggers an action in the dropdown (e.g. home, end keys etc.), popup
the dropdown.
author | Sadrul Habib Chowdhury <imadil@gmail.com> |
---|---|
date | Mon, 05 Jul 2010 04:44:52 +0000 |
parents | 6943aec8cf61 |
children | e1b511df0d3e |
comparison
equal
deleted
inserted
replaced
30242:cfdd4d3ba550 | 30243:658e8b9522bc |
---|---|
148 | 148 |
149 static gboolean | 149 static gboolean |
150 gnt_combo_box_key_pressed(GntWidget *widget, const char *text) | 150 gnt_combo_box_key_pressed(GntWidget *widget, const char *text) |
151 { | 151 { |
152 GntComboBox *box = GNT_COMBO_BOX(widget); | 152 GntComboBox *box = GNT_COMBO_BOX(widget); |
153 if (GNT_WIDGET_IS_FLAG_SET(box->dropdown->parent, GNT_WIDGET_MAPPED)) | 153 if (GNT_WIDGET_IS_FLAG_SET(box->dropdown->parent, GNT_WIDGET_MAPPED)) { |
154 { | 154 if (text[1] == 0) { |
155 if (text[1] == 0) | 155 switch (text[0]) { |
156 { | |
157 switch (text[0]) | |
158 { | |
159 case '\r': | 156 case '\r': |
160 case '\t': | 157 case '\t': |
161 case '\n': | 158 case '\n': |
162 hide_popup(box, TRUE); | 159 hide_popup(box, TRUE); |
163 return TRUE; | 160 return TRUE; |
164 case 27: | 161 case 27: |
165 hide_popup(box, FALSE); | 162 hide_popup(box, FALSE); |
166 return TRUE; | 163 return TRUE; |
167 } | 164 } |
168 } | 165 } |
169 if (gnt_widget_key_pressed(box->dropdown, text)) | 166 } |
170 return TRUE; | 167 |
168 if (gnt_widget_key_pressed(box->dropdown, text)) { | |
169 if (!GNT_WIDGET_IS_FLAG_SET(box->dropdown->parent, GNT_WIDGET_MAPPED)) | |
170 popup_dropdown(box); | |
171 return TRUE; | |
171 } | 172 } |
172 | 173 |
173 return FALSE; | 174 return FALSE; |
174 } | 175 } |
175 | 176 |