Author: michael_meeks
Date: Mon Apr 21 19:05:47 2008
New Revision: 46931
URL: http://svn.opensuse.org/viewcvs/yast?rev=46931&view=rev
Log:
2008-04-21 Michael Meeks
* src/YGSelectionModel.cc (findByText): implemented.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGSelectionModel.cc
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=46931&r1=46930&r2=46931&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Mon Apr 21 19:05:47 2008
@@ -1,5 +1,9 @@
2008-04-21 Michael Meeks
+ * src/YGSelectionModel.cc (findByText): implemented.
+
+2008-04-21 Michael Meeks
+
* src/YGSelectionModel.cc (findByText),
* src/YGComboBox.cc (setText): stub switching to an existing
entry if a setText for an existing item comes in (on a non-editable
Modified: trunk/gtk/src/YGSelectionModel.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionModel.cc?rev=46931&r1=46930&r2=46931&view=diff
==============================================================================
--- trunk/gtk/src/YGSelectionModel.cc (original)
+++ trunk/gtk/src/YGSelectionModel.cc Mon Apr 21 19:05:47 2008
@@ -178,34 +178,37 @@
gtk_list_store_set (getListStore(), iter, col, select, -1);
}
-/*
extern "C" {
struct FindClosure {
const string &text;
bool found;
GtkTreeIter *output;
+ FindClosure(const string &_text, GtkTreeIter *_output) :
+ text (_text),
+ found (false),
+ output (_output) {}
};
- static gboolean find_text (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
+ static gboolean find_text (GtkTreeModel *model, GtkTreePath *path,
+ GtkTreeIter *iter, gpointer data)
{
- gtk_tree_store_get (getTreeStore(), iter, col, label.c_str(), -1);
+ FindClosure *cl = (FindClosure *)data;
+
+ gchar *label;
+ gtk_tree_model_get (model, iter, YGSelectionModel::LABEL_COLUMN, &label, -1);
+
+ if (cl->text == label) {
+ *(cl->output) = *iter;
+ cl->found = true;
+ }
+ g_free (label);
+
+ return cl->found;
}
};
-*/
bool YGSelectionModel::findByText (const string &text, GtkTreeIter *iter)
{
- g_return_val_if_fail (!isTree, false);
-
- return false;
-/*
- FindClosure cl;
- cl.text = text;
- cl.found = false;
- cl.output = iter;
- gtk_tree_model_foreach (getModel(), find_text,
- GtkTreeModelForeachFunc func,
- gpointer user_data);
-
- gtk_list_store_set (getListStore(), iter, col, label.c_str(), -1);
-*/
+ FindClosure cl (text, iter);
+ gtk_tree_model_foreach (getModel(), find_text, (gpointer) &cl);
+ return cl.found;
}
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org