[gimp] app: always return a widget from gimp_prop_gui_new()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: always return a widget from gimp_prop_gui_new()
- Date: Thu, 5 Jun 2014 21:16:38 +0000 (UTC)
commit 3f18d5b26d89e3fa0356d676e27efc49155c8310
Author: Michael Natterer <mitch gimp org>
Date: Thu Jun 5 23:14:00 2014 +0200
app: always return a widget from gimp_prop_gui_new()
As a fallback, return a label saying "This operation has no editable
properties".
app/widgets/gimppropgui.c | 42 ++++++++++++++++++++++++++----------------
1 files changed, 26 insertions(+), 16 deletions(-)
---
diff --git a/app/widgets/gimppropgui.c b/app/widgets/gimppropgui.c
index 788ba7f..a462e61 100644
--- a/app/widgets/gimppropgui.c
+++ b/app/widgets/gimppropgui.c
@@ -341,7 +341,6 @@ gimp_prop_gui_new (GObject *config,
GtkWidget *gui = NULL;
GParamSpec **param_specs;
guint n_param_specs;
- const gchar *config_type_name;
gint i, j;
g_return_val_if_fail (G_IS_OBJECT (config), NULL);
@@ -367,25 +366,36 @@ gimp_prop_gui_new (GObject *config,
n_param_specs = j;
- config_type_name = G_OBJECT_TYPE_NAME (config);
-
- for (i = 0; i < G_N_ELEMENTS (gui_new_funcs); i++)
+ if (n_param_specs > 0)
{
- if (! gui_new_funcs[i].config_type ||
- ! strcmp (gui_new_funcs[i].config_type, config_type_name))
+ const gchar *config_type_name = G_OBJECT_TYPE_NAME (config);
+
+ for (i = 0; i < G_N_ELEMENTS (gui_new_funcs); i++)
{
- g_printerr ("GUI new func match: %s\n",
- gui_new_funcs[i].config_type ?
- gui_new_funcs[i].config_type : "generic fallback");
-
- gui = gui_new_funcs[i].gui_new_func (config,
- param_specs, n_param_specs,
- context,
- create_picker_func,
- picker_creator);
- break;
+ if (! gui_new_funcs[i].config_type ||
+ ! strcmp (gui_new_funcs[i].config_type, config_type_name))
+ {
+ g_printerr ("GUI new func match: %s\n",
+ gui_new_funcs[i].config_type ?
+ gui_new_funcs[i].config_type : "generic fallback");
+
+ gui = gui_new_funcs[i].gui_new_func (config,
+ param_specs, n_param_specs,
+ context,
+ create_picker_func,
+ picker_creator);
+ break;
+ }
}
}
+ else
+ {
+ gui = gtk_label_new (_("This operation has no editable properties"));
+ gimp_label_set_attributes (GTK_LABEL (gui),
+ PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
+ -1);
+ gtk_misc_set_padding (GTK_MISC (gui), 0, 4);
+ }
g_free (param_specs);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]