[gimp] app: Add a GimpDockContainer interface



commit 2287b6e008e1d5f4cfce5c1f7d5ecc4e305a6891
Author: Martin Nordholts <martinn src gnome org>
Date:   Mon May 9 08:14:23 2011 +0200

    app: Add a GimpDockContainer interface
    
    We now have to classes that contain docks, GimpDockWindow and
    GimpImageWindow (in single-window mode). Introduce a GimpDockContainer
    interface so we can cope with these in an abstract way.

 app/widgets/Makefile.am         |    2 +
 app/widgets/gimpdockcontainer.c |   77 +++++++++++++++++++++++++++++++++++++++
 app/widgets/gimpdockcontainer.h |   46 +++++++++++++++++++++++
 app/widgets/widgets-types.h     |    1 +
 4 files changed, 126 insertions(+), 0 deletions(-)
---
diff --git a/app/widgets/Makefile.am b/app/widgets/Makefile.am
index b575b3b..64bc957 100644
--- a/app/widgets/Makefile.am
+++ b/app/widgets/Makefile.am
@@ -148,6 +148,8 @@ libappwidgets_a_sources = \
 	gimpdockable.h			\
 	gimpdockbook.c			\
 	gimpdockbook.h			\
+	gimpdockcontainer.c		\
+	gimpdockcontainer.h		\
 	gimpdocked.c			\
 	gimpdocked.h			\
 	gimpdockwindow.c		\
diff --git a/app/widgets/gimpdockcontainer.c b/app/widgets/gimpdockcontainer.c
new file mode 100644
index 0000000..3b4c8ce
--- /dev/null
+++ b/app/widgets/gimpdockcontainer.c
@@ -0,0 +1,77 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpdockcontainer.c
+ * Copyright (C) 2011 Martin Nordholts <martinn src gnome org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <gtk/gtk.h>
+
+#include "widgets-types.h"
+
+#include "gimpdockcontainer.h"
+
+
+static void   gimp_dock_container_iface_base_init   (GimpDockContainerInterface *container_iface);
+
+
+GType
+gimp_dock_container_interface_get_type (void)
+{
+  static GType iface_type = 0;
+
+  if (! iface_type)
+    {
+      const GTypeInfo iface_info =
+      {
+        sizeof (GimpDockContainerInterface),
+        (GBaseInitFunc)     gimp_dock_container_iface_base_init,
+        (GBaseFinalizeFunc) NULL,
+      };
+
+      iface_type = g_type_register_static (G_TYPE_INTERFACE,
+                                           "GimpDockContainerInterface",
+                                           &iface_info,
+                                           0);
+
+      g_type_interface_add_prerequisite (iface_type, GTK_TYPE_WIDGET);
+    }
+
+  return iface_type;
+}
+
+static void
+gimp_dock_container_iface_base_init (GimpDockContainerInterface *container_iface)
+{
+  static gboolean initialized = FALSE;
+
+  if (initialized)
+    return;
+
+  initialized = TRUE;
+
+  container_iface->get_docks = NULL;
+}
+
+GList *
+gimp_dock_container_get_docks (GimpDockContainer *container)
+{
+  g_return_val_if_fail (GIMP_IS_DOCK_CONTAINER (container), NULL);
+
+  return GIMP_DOCK_CONTAINER_GET_INTERFACE (container)->get_docks (container);
+}
diff --git a/app/widgets/gimpdockcontainer.h b/app/widgets/gimpdockcontainer.h
new file mode 100644
index 0000000..60c5a74
--- /dev/null
+++ b/app/widgets/gimpdockcontainer.h
@@ -0,0 +1,46 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpdockcontainer.h
+ * Copyright (C) 2011 Martin Nordholts <martinn src gnome org>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GIMP_DOCK_CONTAINER_H__
+#define __GIMP_DOCK_CONTAINER_H__
+
+
+#define GIMP_TYPE_DOCK_CONTAINER               (gimp_dock_container_interface_get_type ())
+#define GIMP_DOCK_CONTAINER(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DOCK_CONTAINER, GimpDockContainer))
+#define GIMP_IS_DOCK_CONTAINER(obj)            (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DOCK_CONTAINER))
+#define GIMP_DOCK_CONTAINER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GIMP_TYPE_DOCK_CONTAINER, GimpDockContainerInterface))
+
+
+typedef struct _GimpDockContainerInterface GimpDockContainerInterface;
+
+struct _GimpDockContainerInterface
+{
+  GTypeInterface base_iface;
+
+  /*  virtual functions  */
+  GList *   (* get_docks)        (GimpDockContainer *container);
+};
+
+
+GType     gimp_dock_container_interface_get_type  (void) G_GNUC_CONST;
+GList   * gimp_dock_container_get_docks           (GimpDockContainer *container);
+
+
+#endif  /*  __GIMP_DOCK_CONTAINER_H__  */
diff --git a/app/widgets/widgets-types.h b/app/widgets/widgets-types.h
index ef4f73e..022c5aa 100644
--- a/app/widgets/widgets-types.h
+++ b/app/widgets/widgets-types.h
@@ -40,6 +40,7 @@ typedef struct _GimpDeviceManager            GimpDeviceManager;
 
 typedef struct _GimpDock                     GimpDock;
 typedef struct _GimpDockColumns              GimpDockColumns;
+typedef struct _GimpDockContainer            GimpDockContainer; /* dummy typedef */
 typedef struct _GimpDockWindow               GimpDockWindow;
 typedef struct _GimpDockable                 GimpDockable;
 typedef struct _GimpDockbook                 GimpDockbook;



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