[gimp] libgimpwidgets: bring back unit format strings in GimpSizeEntry
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpwidgets: bring back unit format strings in GimpSizeEntry
- Date: Fri, 5 Nov 2010 15:32:14 +0000 (UTC)
commit 4a4994f4dbed64784058cb437705d4a5ba22c196
Author: Michael Natterer <mitch gimp org>
Date: Fri Nov 5 16:30:23 2010 +0100
libgimpwidgets: bring back unit format strings in GimpSizeEntry
Use the user-provided format string as long-format and try to create a
short-format by replacing "%s" and "%p" by "%a" for the popup. Works
nicely for all cases I've seen so far.
libgimpwidgets/gimpsizeentry.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/libgimpwidgets/gimpsizeentry.c b/libgimpwidgets/gimpsizeentry.c
index fe207d6..04dc333 100644
--- a/libgimpwidgets/gimpsizeentry.c
+++ b/libgimpwidgets/gimpsizeentry.c
@@ -379,6 +379,27 @@ gimp_size_entry_new (gint number_of_fields,
gimp_unit_store_set_has_pixels (store, gse->menu_show_pixels);
gimp_unit_store_set_has_percent (store, gse->menu_show_percent);
+ if (unit_format)
+ {
+ gchar *short_format = g_strdup (unit_format);
+ gchar *p;
+
+ p = strstr (short_format, "%s");
+ if (p)
+ strcpy (p, "%a");
+
+ p = strstr (short_format, "%p");
+ if (p)
+ strcpy (p, "%a");
+
+ g_object_set (store,
+ "short-format", short_format,
+ "long-format", unit_format,
+ NULL);
+
+ g_free (short_format);
+ }
+
gse->unitmenu = gimp_unit_combo_box_new_with_model (store);
g_object_unref (store);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]