[PATCH 1/3] gtk_combo_box_entries and empty text [followup]

Lubomir I. Ivanov neolit123 at gmail.com
Thu Nov 3 13:44:04 PDT 2011


From: "Lubomir I. Ivanov" <neolit123 at gmail.com>

passing -1 to gtk_combo_box_set_active, seems not to work as
the gtk documentation explains; there might
be a bug in the library or some special case that is not explained.

could be related to:
http://mail.gnome.org/archives/gtk-devel-list/2004-March/msg00170.html

passing \n seems to "trick" the cell renderer to clear the entry
completely. a temporary solution.

Signed-off-by: Lubomir I. Ivanov <neolit123 at gmail.com>
---
 info.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/info.c b/info.c
index 75b34bb..8436a13 100644
--- a/info.c
+++ b/info.c
@@ -98,9 +98,9 @@ void flush_dive_info_changes(struct dive *dive)
 static void set_combo_box_entry_text(GtkComboBoxEntry *combo_box, const char *text)
 {
 	GtkEntry *entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(combo_box)));
-	gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0);
+	gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), -1);
 	if (!*text)
-		text = " ";
+		text = "\n";
 	gtk_entry_set_text(entry, text);
 }
 
-- 
1.7.6.msysgit.0



More information about the subsurface mailing list