[network-manager-applet/nma-0-9-8] editor: set active combo box item in ce_page_setup_mac_combo()
- From: Jiří Klimeš <jklimes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [network-manager-applet/nma-0-9-8] editor: set active combo box item in ce_page_setup_mac_combo()
- Date: Wed, 27 Mar 2013 08:55:22 +0000 (UTC)
commit 5579738aa3d2386fdb24158e51ea0d5cd7df019e
Author: Jiří Klimeš <jklimes redhat com>
Date: Wed Mar 27 09:53:27 2013 +0100
editor: set active combo box item in ce_page_setup_mac_combo()
Failing to do so makes gtk_combo_box_get_active() keep returning -1, even if
the combo box entry text was set (until the user manually selects an item).
src/connection-editor/ce-page.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index bf2798c..1dbee85 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -162,6 +162,7 @@ ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo,
const char *current_mac, char **mac_list)
{
char **iter, *active_mac = NULL;
+ int i, active_idx = -1;
int current_mac_len;
GtkWidget *entry;
@@ -170,7 +171,7 @@ ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo,
else
current_mac_len = -1;
- for (iter = mac_list; iter && *iter; iter++) {
+ for (iter = mac_list, i = 0; iter && *iter; iter++, i++) {
#if GTK_CHECK_VERSION (2,24,0)
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), *iter);
#else
@@ -178,11 +179,16 @@ ce_page_setup_mac_combo (CEPage *self, GtkComboBox *combo,
#endif
if ( current_mac
&& g_ascii_strncasecmp (*iter, current_mac, current_mac_len) == 0
- && ((*iter)[current_mac_len] == '\0' || (*iter)[current_mac_len] == ' '))
+ && ((*iter)[current_mac_len] == '\0' || (*iter)[current_mac_len] == ' ')) {
active_mac = *iter;
+ active_idx = i;
+ }
}
if (current_mac) {
+ /* set active item */
+ gtk_combo_box_set_active (combo, active_idx);
+
if (!active_mac) {
#if GTK_CHECK_VERSION (2,24,0)
gtk_combo_box_text_prepend_text (GTK_COMBO_BOX_TEXT (combo), current_mac);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]