[gimp] Bug 773058 - Enable grid views of dynamics and tool presets



commit b8bb52b7210f781b3d284c17a03415e9cc35c8dc
Author: Michael Natterer <mitch gimp org>
Date:   Mon Oct 17 18:43:22 2016 +0200

    Bug 773058 - Enable grid views of dynamics and tool presets

 app/actions/dialogs-actions.c      |    4 ++--
 app/dialogs/dialogs-constructors.c |   26 ++++++++++++++++++++++++++
 app/dialogs/dialogs-constructors.h |    8 ++++++++
 app/dialogs/dialogs.c              |   14 ++++++--------
 app/widgets/gimpviewablebox.c      |   10 ++++++----
 5 files changed, 48 insertions(+), 14 deletions(-)
---
diff --git a/app/actions/dialogs-actions.c b/app/actions/dialogs-actions.c
index ce88d83..a3717c7 100644
--- a/app/actions/dialogs-actions.c
+++ b/app/actions/dialogs-actions.c
@@ -148,7 +148,7 @@ const GimpStringActionEntry dialogs_dockable_actions[] =
   { "dialogs-dynamics", GIMP_STOCK_DYNAMICS,
     NC_("dialogs-action", "Paint Dynamics"), NULL,
     NC_("dialogs-action", "Open paint dynamics dialog"),
-    "gimp-dynamics-list",
+    "gimp-dynamics-list|gimp-dynamics-grid",
     GIMP_HELP_DYNAMICS_DIALOG },
 
   { "dialogs-dynamics-editor", GIMP_STOCK_DYNAMICS,
@@ -196,7 +196,7 @@ const GimpStringActionEntry dialogs_dockable_actions[] =
   { "dialogs-tool-presets", GIMP_STOCK_TOOL_PRESET,
     NC_("dialogs-action", "Tool presets"), NULL,
     NC_("dialogs-action", "Open tool presets dialog"),
-    "gimp-tool-preset-list",
+    "gimp-tool-preset-list|gimp-tool-preset-grid",
     GIMP_HELP_TOOL_PRESET_DIALOG },
 
   { "dialogs-fonts", "gtk-select-font",
diff --git a/app/dialogs/dialogs-constructors.c b/app/dialogs/dialogs-constructors.c
index dcace4f..7a65928 100644
--- a/app/dialogs/dialogs-constructors.c
+++ b/app/dialogs/dialogs-constructors.c
@@ -544,6 +544,19 @@ dialogs_brush_grid_view_new (GimpDialogFactory *factory,
 }
 
 GtkWidget *
+dialogs_dynamics_grid_view_new (GimpDialogFactory *factory,
+                                GimpContext       *context,
+                                GimpUIManager     *ui_manager,
+                                gint               view_size)
+{
+  return gimp_dynamics_factory_view_new (GIMP_VIEW_TYPE_GRID,
+                                         context->gimp->dynamics_factory,
+                                         context,
+                                         view_size, 1,
+                                         gimp_dialog_factory_get_menu_factory (factory));
+}
+
+GtkWidget *
 dialogs_mypaint_brush_grid_view_new (GimpDialogFactory *factory,
                                      GimpContext       *context,
                                      GimpUIManager     *ui_manager,
@@ -631,6 +644,19 @@ dialogs_buffer_grid_view_new (GimpDialogFactory *factory,
 }
 
 GtkWidget *
+dialogs_tool_preset_grid_view_new (GimpDialogFactory *factory,
+                                   GimpContext       *context,
+                                   GimpUIManager     *ui_manager,
+                                   gint               view_size)
+{
+  return gimp_tool_preset_factory_view_new (GIMP_VIEW_TYPE_GRID,
+                                            context->gimp->tool_preset_factory,
+                                            context,
+                                            view_size, 1,
+                                            gimp_dialog_factory_get_menu_factory (factory));
+}
+
+GtkWidget *
 dialogs_document_grid_view_new (GimpDialogFactory *factory,
                                 GimpContext       *context,
                                 GimpUIManager     *ui_manager,
diff --git a/app/dialogs/dialogs-constructors.h b/app/dialogs/dialogs-constructors.h
index e25b3c0..496725c 100644
--- a/app/dialogs/dialogs-constructors.h
+++ b/app/dialogs/dialogs-constructors.h
@@ -183,6 +183,10 @@ GtkWidget * dialogs_brush_grid_view_new         (GimpDialogFactory *factory,
                                                  GimpContext       *context,
                                                  GimpUIManager     *ui_manager,
                                                  gint               view_size);
+GtkWidget * dialogs_dynamics_grid_view_new      (GimpDialogFactory *factory,
+                                                 GimpContext       *context,
+                                                 GimpUIManager     *ui_manager,
+                                                 gint               view_size);
 GtkWidget * dialogs_mypaint_brush_grid_view_new (GimpDialogFactory *factory,
                                                  GimpContext       *context,
                                                  GimpUIManager     *ui_manager,
@@ -207,6 +211,10 @@ GtkWidget * dialogs_buffer_grid_view_new        (GimpDialogFactory *factory,
                                                  GimpContext       *context,
                                                  GimpUIManager     *ui_manager,
                                                  gint               view_size);
+GtkWidget * dialogs_tool_preset_grid_view_new   (GimpDialogFactory *factory,
+                                                 GimpContext       *context,
+                                                 GimpUIManager     *ui_manager,
+                                                 gint               view_size);
 GtkWidget * dialogs_document_grid_view_new      (GimpDialogFactory *factory,
                                                  GimpContext       *context,
                                                  GimpUIManager     *ui_manager,
diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c
index c4a46b4..62f1ae7 100644
--- a/app/dialogs/dialogs.c
+++ b/app/dialogs/dialogs.c
@@ -327,6 +327,9 @@ static const GimpDialogFactoryEntry entries[] =
   LISTGRID (brush, brush,
             N_("Brushes"), NULL, GIMP_STOCK_BRUSH,
             GIMP_HELP_BRUSH_DIALOG, GIMP_VIEW_SIZE_MEDIUM),
+  LISTGRID (dynamics, dynamics,
+            N_("Paint Dynamics"), NULL, GIMP_STOCK_DYNAMICS,
+            GIMP_HELP_DYNAMICS_DIALOG, GIMP_VIEW_SIZE_MEDIUM),
   LISTGRID (mypaint-brush, mypaint_brush,
             N_("MyPaint Brushes"), NULL, GIMP_STOCK_MYPAINT_BRUSH,
             GIMP_HELP_MYPAINT_BRUSH_DIALOG, GIMP_VIEW_SIZE_LARGE),
@@ -345,6 +348,9 @@ static const GimpDialogFactoryEntry entries[] =
   LISTGRID (buffer, buffer,
             N_("Buffers"), NULL, GIMP_STOCK_BUFFER,
             GIMP_HELP_BUFFER_DIALOG, GIMP_VIEW_SIZE_MEDIUM),
+  LISTGRID (tool-preset, tool_preset,
+            N_("Tool Presets"), NULL, GIMP_STOCK_TOOL_PRESET,
+            GIMP_HELP_TOOL_PRESET_DIALOG, GIMP_VIEW_SIZE_MEDIUM),
   LISTGRID (document, document,
             N_("History"), N_("Document History"), "document-open-recent",
             GIMP_HELP_DOCUMENT_DIALOG, GIMP_VIEW_SIZE_LARGE),
@@ -352,14 +358,6 @@ static const GimpDialogFactoryEntry entries[] =
             N_("Templates"), N_("Image Templates"), GIMP_STOCK_TEMPLATE,
             GIMP_HELP_TEMPLATE_DIALOG, GIMP_VIEW_SIZE_SMALL),
 
-  /* Some things do not have grids, so just list */
-  LIST (dynamics, dynamics,
-        N_("Paint Dynamics"), NULL, GIMP_STOCK_DYNAMICS,
-        GIMP_HELP_DYNAMICS_DIALOG, GIMP_VIEW_SIZE_MEDIUM),
-  LIST (tool-preset, tool_preset,
-        N_("Tool Presets"), NULL, GIMP_STOCK_TOOL_PRESET,
-        GIMP_HELP_TOOL_PRESET_DIALOG, GIMP_VIEW_SIZE_MEDIUM),
-
   /*  image related  */
   DOCKABLE ("gimp-layer-list",
             N_("Layers"), NULL, GIMP_STOCK_LAYERS,
diff --git a/app/widgets/gimpviewablebox.c b/app/widgets/gimpviewablebox.c
index 22c53fb..a294e2f 100644
--- a/app/widgets/gimpviewablebox.c
+++ b/app/widgets/gimpviewablebox.c
@@ -144,6 +144,7 @@ dynamics_box_new (GimpContainer *container,
                   GimpContext   *context,
                   const gchar   *label,
                   gint           spacing,
+                  GimpViewType   view_type,
                   GimpViewSize   view_size,
                   const gchar   *editor_id,
                   const gchar   *editor_tooltip)
@@ -152,8 +153,8 @@ dynamics_box_new (GimpContainer *container,
     container = gimp_data_factory_get_container (context->gimp->dynamics_factory);
 
   return gimp_viewable_box_new (container, context, label, spacing,
-                                GIMP_VIEW_TYPE_LIST, GIMP_VIEW_SIZE_SMALL, view_size,
-                                "gimp-dynamics-list",
+                                view_type, GIMP_VIEW_SIZE_SMALL, view_size,
+                                "gimp-dynamics-list|gimp-dynamics-grid",
                                 GIMP_STOCK_DYNAMICS,
                                 _("Open the dynamics selection dialog"),
                                 editor_id, editor_tooltip);
@@ -170,7 +171,7 @@ gimp_dynamics_box_new (GimpContainer *container,
   g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
 
   return dynamics_box_new (container, context, label, spacing,
-                           GIMP_VIEW_SIZE_SMALL,
+                           GIMP_VIEW_TYPE_LIST, GIMP_VIEW_SIZE_SMALL,
                            NULL, NULL);
 }
 
@@ -197,7 +198,8 @@ gimp_prop_dynamics_box_new (GimpContainer *container,
                 NULL);
 
   return view_props_connect (dynamics_box_new (container, context, label,
-                                               spacing, view_size,
+                                               spacing,
+                                               view_type, view_size,
                                                editor_id, editor_tooltip),
                              context,
                              view_type_prop, view_size_prop);


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