[gimp] app: add a GParamFlags parameter to gimp_prop_gui_new()



commit 3ac3dcde485ed701366ad911186108b726295382
Author: Michael Natterer <mitch gimp org>
Date:   Sat Feb 6 01:04:40 2016 +0100

    app: add a GParamFlags parameter to gimp_prop_gui_new()
    
    If non-0 flags are passed, create widgets only if the GParamSpec flags
    have all the passed flags.

 app/tools/gimpoperationtool.c |    2 +-
 app/widgets/gimppropgui.c     |    4 ++++
 app/widgets/gimppropgui.h     |    1 +
 3 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/app/tools/gimpoperationtool.c b/app/tools/gimpoperationtool.c
index 6562e42..8cb3096 100644
--- a/app/tools/gimpoperationtool.c
+++ b/app/tools/gimpoperationtool.c
@@ -732,7 +732,7 @@ gimp_operation_tool_set_operation (GimpOperationTool *tool,
     {
       tool->options_gui =
         gimp_prop_gui_new (G_OBJECT (im_tool->config),
-                           G_TYPE_FROM_INSTANCE (im_tool->config),
+                           G_TYPE_FROM_INSTANCE (im_tool->config), 0,
                            GIMP_CONTEXT (GIMP_TOOL_GET_OPTIONS (tool)),
                            (GimpCreatePickerFunc) gimp_image_map_tool_add_color_picker,
                            tool);
diff --git a/app/widgets/gimppropgui.c b/app/widgets/gimppropgui.c
index d666ed2..cff079f 100644
--- a/app/widgets/gimppropgui.c
+++ b/app/widgets/gimppropgui.c
@@ -339,6 +339,7 @@ gui_new_funcs[] =
 GtkWidget *
 gimp_prop_gui_new (GObject              *config,
                    GType                 owner_type,
+                   GParamFlags           flags,
                    GimpContext          *context,
                    GimpCreatePickerFunc  create_picker_func,
                    gpointer              picker_creator)
@@ -362,6 +363,9 @@ gimp_prop_gui_new (GObject              *config,
       if (! g_type_is_a (pspec->owner_type, owner_type))
         continue;
 
+      if (flags && ((pspec->flags & flags) != flags))
+        continue;
+
       if (HAS_KEY (pspec, "role", "output-extent"))
         continue;
 
diff --git a/app/widgets/gimppropgui.h b/app/widgets/gimppropgui.h
index 4ea35ee..cac588d 100644
--- a/app/widgets/gimppropgui.h
+++ b/app/widgets/gimppropgui.h
@@ -43,6 +43,7 @@ GtkWidget * gimp_prop_widget_new_from_pspec (GObject              *config,
                                              const gchar         **label);
 GtkWidget * gimp_prop_gui_new               (GObject              *config,
                                              GType                 owner_type,
+                                             GParamFlags           flags,
                                              GimpContext          *context,
                                              GimpCreatePickerFunc  create_picker,
                                              gpointer              picker_creator);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]