]> git.tdb.fi Git - ext/subsurface.git/commitdiff
gtk_combo_box_entries and empty text
authorLubomir I. Ivanov <neolit123@gmail.com>
Thu, 3 Nov 2011 20:44:04 +0000 (22:44 +0200)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sun, 13 Nov 2011 17:10:14 +0000 (15:10 -0200)
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.  This is a temporary solution.

Signed-off-by: Lubomir I. Ivanov <neolit123@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
info.c

diff --git a/info.c b/info.c
index 75b34bb782c85da7fbee0bd8a35e2296b857b75f..8436a1336b9ee84ae9e57fff1d277a03349da803 100644 (file)
--- 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);
 }