summaryrefslogtreecommitdiffstats
path: root/info.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-08 08:48:13 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-01-08 08:48:13 -0800
commitbf395ebf45626eece9163dd387bce3dbbeb56a68 (patch)
tree4299200dbe328cc85741ba89255e413bc4b77d76 /info.c
parent7a18edddbbbfa82ba44035557618c92e4535a6de (diff)
downloadsubsurface-bf395ebf45626eece9163dd387bce3dbbeb56a68.tar.gz
Avoid pointless calls to dive planner
Stupid Gtk. Seriously. So in order to get a notification if the user selects the drop down for the gas with the mouse I need to connect to the "changed" signal for the combobox. But that also fires whenever the user types something into the GtkEntry. Which means we once again get called for all kinds of silly partial names. Instead we want to handle the manual entry in the "focus-out" callback (the user has hit tab or something else to move away from the GtkEntry - let's assume that this is the text he wants us to use) and only respond to the changed signal on the combobox if the user selected something from the dropdown. The easiest way to do that (I think) is to check the text with the strings stored in the model. If this indeed matches a string stored in the model then most likely this is something the user selected from the dropdown. But more importantly if it isn't in the model, then we KNOW that this is just a partial string that was typed in. And we can ignore that one. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'info.c')
-rw-r--r--info.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/info.c b/info.c
index 21e13e3e3..26b664f3e 100644
--- a/info.c
+++ b/info.c
@@ -312,11 +312,6 @@ static GtkTextView *text_view(GtkWidget *box, const char *label, enum writable w
return GTK_TEXT_VIEW(view);
}
-static enum {
- MATCH_EXACT,
- MATCH_PREPEND,
- MATCH_AFTER
-} found_string_entry;
static GtkTreeIter string_entry_location;
static gboolean match_string_entry(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
@@ -345,7 +340,7 @@ static gboolean match_string_entry(GtkTreeModel *model, GtkTreePath *path, GtkTr
return FALSE;
}
-static int match_list(GtkListStore *list, const char *string)
+int match_list(GtkListStore *list, const char *string)
{
found_string_entry = MATCH_PREPEND;
gtk_tree_model_foreach(GTK_TREE_MODEL(list), match_string_entry, (void *)string);