gimp r25547 - in trunk: . app/display
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r25547 - in trunk: . app/display
- Date: Mon, 28 Apr 2008 22:50:18 +0100 (BST)
Author: neo
Date: Mon Apr 28 21:50:18 2008
New Revision: 25547
URL: http://svn.gnome.org/viewvc/gimp?rev=25547&view=rev
Log:
2008-04-28 Sven Neumann <sven gimp org>
* app/display/gimpscalecombobox.c: keep the current scale value,
beep and reset the entry when the user input cannot be parsed.
Also changed the input parser to interpret a single number as a
percentage.
Modified:
trunk/ChangeLog
trunk/app/display/gimpscalecombobox.c
trunk/app/display/gimpscalecombobox.h
Modified: trunk/app/display/gimpscalecombobox.c
==============================================================================
--- trunk/app/display/gimpscalecombobox.c (original)
+++ trunk/app/display/gimpscalecombobox.c Mon Apr 28 21:50:18 2008
@@ -94,6 +94,7 @@
GtkTreeIter iter;
gint i;
+ combo_box->scale = 1.0;
combo_box->last_path = NULL;
store = gtk_list_store_new (NUM_COLUMNS,
@@ -108,8 +109,11 @@
entry = gtk_bin_get_child (GTK_BIN (combo_box));
- gtk_entry_set_alignment (GTK_ENTRY (entry), 1.0);
- gtk_entry_set_width_chars (GTK_ENTRY (entry), 7);
+ g_object_set (entry,
+ "xalign", 1.0,
+ "width-chars", 7,
+ "truncate-multiline", TRUE,
+ NULL);
layout = GTK_CELL_LAYOUT (combo_box);
@@ -215,6 +219,8 @@
-1);
if (scale > 0.0)
{
+ combo_box->scale = scale;
+
if (combo_box->last_path)
gtk_tree_path_free (combo_box->last_path);
@@ -243,7 +249,7 @@
while (g_unichar_isspace (g_utf8_get_char (text)))
text = g_utf8_next_char (text);
- if (*text == '%')
+ if (*text == '\0' || *text == '%')
{
*scale = left_number / 100.0;
return TRUE;
@@ -287,6 +293,12 @@
{
gimp_scale_combo_box_set_scale (combo_box, scale);
}
+ else
+ {
+ gtk_widget_error_bell (GTK_WIDGET (combo_box));
+
+ gimp_scale_combo_box_set_scale (combo_box, combo_box->scale);
+ }
}
static void
@@ -396,6 +408,7 @@
gboolean persistent;
g_return_if_fail (GIMP_IS_SCALE_COMBO_BOX (combo_box));
+ g_return_if_fail (scale > 0.0);
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
store = GTK_LIST_STORE (model);
@@ -453,18 +466,7 @@
gdouble
gimp_scale_combo_box_get_scale (GimpScaleComboBox *combo_box)
{
- GtkTreeIter iter;
- gdouble scale = 1.0;
-
- g_return_val_if_fail (GIMP_IS_SCALE_COMBO_BOX (combo_box), FALSE);
-
- if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter))
- {
- gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)),
- &iter,
- SCALE, &scale,
- -1);
- }
+ g_return_val_if_fail (GIMP_IS_SCALE_COMBO_BOX (combo_box), 1.0);
- return scale;
+ return combo_box->scale;
}
Modified: trunk/app/display/gimpscalecombobox.h
==============================================================================
--- trunk/app/display/gimpscalecombobox.h (original)
+++ trunk/app/display/gimpscalecombobox.h Mon Apr 28 21:50:18 2008
@@ -44,6 +44,7 @@
{
GtkComboBoxEntry parent_instance;
+ gdouble scale;
GtkTreePath *last_path;
GList *mru;
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]