[gcalctool/gnome-3-0] Correctly choose the first conversion when none/invalid defined (Bug #645663)
- From: Robert Ancell <rancell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcalctool/gnome-3-0] Correctly choose the first conversion when none/invalid defined (Bug #645663)
- Date: Sat, 26 Mar 2011 01:21:34 +0000 (UTC)
commit 3bfea9949e000b4d0e2f073ad911ba3ecb7705f3
Author: Robert Ancell <robert ancell canonical com>
Date: Sat Mar 26 12:21:28 2011 +1100
Correctly choose the first conversion when none/invalid defined (Bug #645663)
NEWS | 2 ++
src/math-converter.c | 12 +++++++++++-
2 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/NEWS b/NEWS
index 3fcd506..1d42780 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ Overview of changes in gcalctool 6.0.0
* Use /org/gnome as location for gsettings keys. This will mean
gcalctool 5.31.x users will have their settings reset to defaults.
+ * Correctly choose the first conversion when none/invalid defined
+ (Bug #645663)
Overview of changes in gcalctool 5.91.93
diff --git a/src/math-converter.c b/src/math-converter.c
index 92c2dc9..4eb2cbc 100644
--- a/src/math-converter.c
+++ b/src/math-converter.c
@@ -224,7 +224,17 @@ math_converter_set_conversion(MathConverter *converter, /*const gchar *category,
ub = unit_manager_get_unit_by_name(unit_manager_get_default(), unit_b);
if (!ua || !ub)
{
- gtk_combo_box_set_active(GTK_COMBO_BOX(converter->priv->from_combo), 0);
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ /* Select the first unit */
+ model = gtk_combo_box_get_model(GTK_COMBO_BOX(converter->priv->from_combo));
+ if (gtk_tree_model_get_iter_first(model, &iter)) {
+ GtkTreeIter child_iter;
+ while (gtk_tree_model_iter_children(model, &child_iter, &iter))
+ iter = child_iter;
+ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(converter->priv->from_combo), &iter);
+ }
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]