Author: michael_meeks
Date: Mon Apr 21 18:48:54 2008
New Revision: 46930
URL: http://svn.opensuse.org/viewcvs/yast?rev=46930&view=rev
Log:
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
combo box) - instead of failing. No impl yet.
* src/ygtksteps.c (ygtk_steps_get_step_layout): don't return a
NULL layout_bold layout.
(ygtk_steps_size_request): init w & h to 0 at least in case of
NULL
layout.
Modified:
trunk/gtk/ChangeLog
trunk/gtk/src/YGComboBox.cc
trunk/gtk/src/YGSelectionModel.cc
trunk/gtk/src/YGSelectionModel.h
trunk/gtk/src/ygtksteps.c
Modified: trunk/gtk/ChangeLog
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/ChangeLog?rev=46930&r1=46929&r2=46930&view=diff
==============================================================================
--- trunk/gtk/ChangeLog (original)
+++ trunk/gtk/ChangeLog Mon Apr 21 18:48:54 2008
@@ -1,3 +1,15 @@
+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
+ combo box) - instead of failing. No impl yet.
+
+ * src/ygtksteps.c (ygtk_steps_get_step_layout): don't return a
+ NULL layout_bold layout.
+ (ygtk_steps_size_request): init w & h to 0 at least in case of NULL
+ layout.
+
2008-04-16 Michael Meeks
* src/YGUI.cc, src/YGPackageSelector.cc: fix a few format warnings.
Modified: trunk/gtk/src/YGComboBox.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGComboBox.cc?rev=46930&r1=46929&r2=46930&view=diff
==============================================================================
--- trunk/gtk/src/YGComboBox.cc (original)
+++ trunk/gtk/src/YGComboBox.cc Mon Apr 21 18:48:54 2008
@@ -48,7 +48,7 @@
void unblockEvents()
{ g_signal_handlers_unblock_by_func (getWidget(), (gpointer) selected_changed_cb, this); }
- GtkEntry *getEntry()
+ GtkEntry *getEntry ()
{
if (!GTK_IS_COMBO_BOX_ENTRY (getWidget())) {
y2error ("YGComboBox: trying to edit read-only combo box");
@@ -73,7 +73,12 @@
{
IMPL
blockEvents();
- gtk_entry_set_text (getEntry(), value.c_str());
+
+ GtkTreeIter iter;
+ if (findByText (value, &iter))
+ setFocusItem (&iter);
+ else
+ gtk_entry_set_text (getEntry(), value.c_str());
unblockEvents();
}
Modified: trunk/gtk/src/YGSelectionModel.cc
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionModel.cc?rev=46930&r1=46929&r2=46930&view=diff
==============================================================================
--- trunk/gtk/src/YGSelectionModel.cc (original)
+++ trunk/gtk/src/YGSelectionModel.cc Mon Apr 21 18:48:54 2008
@@ -178,3 +178,34 @@
gtk_list_store_set (getListStore(), iter, col, select, -1);
}
+/*
+extern "C" {
+ struct FindClosure {
+ const string &text;
+ bool found;
+ GtkTreeIter *output;
+ };
+ static gboolean find_text (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
+ {
+ gtk_tree_store_get (getTreeStore(), iter, col, label.c_str(), -1);
+ }
+};
+*/
+
+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);
+*/
+}
Modified: trunk/gtk/src/YGSelectionModel.h
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/YGSelectionModel.h?rev=46930&r1=46929&r2=46930&view=diff
==============================================================================
--- trunk/gtk/src/YGSelectionModel.h (original)
+++ trunk/gtk/src/YGSelectionModel.h Mon Apr 21 18:48:54 2008
@@ -38,6 +38,7 @@
YItem *getItem (GtkTreeIter *iter);
bool getIter (YItem *item, GtkTreeIter *iter);
+ bool findByText (const string &text, GtkTreeIter *iter);
void addRow (GtkTreeIter *iter, YItem *item, bool honor_select);
void setCellLabel (GtkTreeIter *iter, int col, const string &label);
Modified: trunk/gtk/src/ygtksteps.c
URL: http://svn.opensuse.org/viewcvs/yast/trunk/gtk/src/ygtksteps.c?rev=46930&r1=46929&r2=46930&view=diff
==============================================================================
--- trunk/gtk/src/ygtksteps.c (original)
+++ trunk/gtk/src/ygtksteps.c Mon Apr 21 18:48:54 2008
@@ -107,7 +107,7 @@
}
}
- if (steps->current_step == step_nb)
+ if (steps->current_step == step_nb && step->layout_bold != NULL)
return step->layout_bold;
return step->layout;
}
@@ -149,7 +149,7 @@
if (!step->is_heading)
layout = step->layout_bold;
- int w, h;
+ int w = 0, h = 0;
pango_layout_get_pixel_size (layout, &w, &h);
w += PANGO_PIXELS (pango_layout_get_indent (layout));
h += PANGO_PIXELS (pango_layout_get_spacing (layout)) * 2;
--
To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org
For additional commands, e-mail: yast-commit+help@opensuse.org