[gimp] app: Move 'Recently Closed Docks' logic to GimpDockWindow
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: Move 'Recently Closed Docks' logic to GimpDockWindow
- Date: Sun, 13 Sep 2009 10:02:30 +0000 (UTC)
commit 0d4e8d05263a4589ec843bcc0d785b8b9a56f223
Author: Martin Nordholts <martinn src gnome org>
Date: Sun Sep 13 12:04:50 2009 +0200
app: Move 'Recently Closed Docks' logic to GimpDockWindow
Move 'Recently Closed Docks' logic from GimpDock to
GimpDockWindow. GimpDock is now free of explicit GtkWindow
dependencies.
app/widgets/gimpdock.c | 34 --------------
app/widgets/gimpdockwindow.c | 103 ++++++++++++++++++++++++++++++++---------
2 files changed, 80 insertions(+), 57 deletions(-)
---
diff --git a/app/widgets/gimpdock.c b/app/widgets/gimpdock.c
index 7e33ea4..9cadac8 100644
--- a/app/widgets/gimpdock.c
+++ b/app/widgets/gimpdock.c
@@ -36,10 +36,6 @@
#include "gimpdockbook.h"
#include "gimpdockseparator.h"
-#include "gimpsessioninfo.h" /* FIXME */
-#include "core/gimpcontainer.h" /* FIXME */
-#include "dialogs/dialogs.h" /* FIXME */
-
#include "gimp-intl.h"
@@ -81,9 +77,6 @@ static void gimp_dock_get_property (GObject *object,
static void gimp_dock_destroy (GtkObject *object);
-static gboolean gimp_dock_delete_event (GtkWidget *widget,
- GdkEventAny *event);
-
static void gimp_dock_real_book_added (GimpDock *dock,
GimpDockbook *dockbook);
static void gimp_dock_real_book_removed (GimpDock *dock,
@@ -102,7 +95,6 @@ gimp_dock_class_init (GimpDockClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
dock_signals[BOOK_ADDED] =
g_signal_new ("book-added",
@@ -129,8 +121,6 @@ gimp_dock_class_init (GimpDockClass *klass)
gtk_object_class->destroy = gimp_dock_destroy;
- widget_class->delete_event = gimp_dock_delete_event;
-
klass->setup = NULL;
klass->book_added = gimp_dock_real_book_added;
klass->book_removed = gimp_dock_real_book_removed;
@@ -241,30 +231,6 @@ gimp_dock_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
-static gboolean
-gimp_dock_delete_event (GtkWidget *widget,
- GdkEventAny *event)
-{
- GimpDock *dock = GIMP_DOCK (widget);
-
- if (gimp_dock_get_n_dockables (dock) > 1)
- {
- GimpSessionInfo *info = gimp_session_info_new ();
-
- gimp_object_set_name (GIMP_OBJECT (info),
- gtk_window_get_title (GTK_WINDOW (widget)));
-
- info->widget = widget;
- gimp_session_info_get_info (info);
- info->widget = NULL;
-
- gimp_container_add (global_recent_docks, GIMP_OBJECT (info));
- g_object_unref (info);
- }
-
- return FALSE;
-}
-
static void
gimp_dock_real_book_added (GimpDock *dock,
GimpDockbook *dockbook)
diff --git a/app/widgets/gimpdockwindow.c b/app/widgets/gimpdockwindow.c
index b6e7e2d..888d351 100644
--- a/app/widgets/gimpdockwindow.c
+++ b/app/widgets/gimpdockwindow.c
@@ -27,15 +27,21 @@
#include "widgets-types.h"
+#include "dialogs/dialogs.h" /* FIXME, we are in the widget layer */
+
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpcontext.h"
#include "core/gimpcontainer.h"
+#include "core/gimpcontainer.h"
#include "gimpdialogfactory.h"
+#include "gimpdock.h"
+#include "gimpdockbook.h"
#include "gimpdockwindow.h"
#include "gimpmenufactory.h"
+#include "gimpsessioninfo.h"
#include "gimpuimanager.h"
#include "gimpwidgets-utils.h"
#include "gimpwindow.h"
@@ -69,29 +75,32 @@ struct _GimpDockWindowPrivate
gint ID;
};
-static GObject * gimp_dock_window_constructor (GType type,
- guint n_params,
- GObjectConstructParam *params);
-static void gimp_dock_window_dispose (GObject *object);
-static void gimp_dock_window_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_dock_window_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-static void gimp_dock_window_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
-static void gimp_dock_window_display_changed (GimpDockWindow *dock_window,
- GimpObject *display,
- GimpContext *context);
-static void gimp_dock_window_image_changed (GimpDockWindow *dock_window,
- GimpImage *image,
- GimpContext *context);
-static void gimp_dock_window_image_flush (GimpImage *image,
- gboolean invalidate_preview,
- GimpDockWindow *dock_window);
+static GObject * gimp_dock_window_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params);
+static void gimp_dock_window_dispose (GObject *object);
+static void gimp_dock_window_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_dock_window_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gimp_dock_window_style_set (GtkWidget *widget,
+ GtkStyle *prev_style);
+static gboolean gimp_dock_window_delete_event (GtkWidget *widget,
+ GdkEventAny *event);
+static GimpDock * gimp_dock_window_get_dock (GimpDockWindow *dock_window);
+static void gimp_dock_window_display_changed (GimpDockWindow *dock_window,
+ GimpObject *display,
+ GimpContext *context);
+static void gimp_dock_window_image_changed (GimpDockWindow *dock_window,
+ GimpImage *image,
+ GimpContext *context);
+static void gimp_dock_window_image_flush (GimpImage *image,
+ gboolean invalidate_preview,
+ GimpDockWindow *dock_window);
G_DEFINE_TYPE (GimpDockWindow, gimp_dock_window, GIMP_TYPE_WINDOW)
@@ -110,6 +119,7 @@ gimp_dock_window_class_init (GimpDockWindowClass *klass)
object_class->get_property = gimp_dock_window_get_property;
widget_class->style_set = gimp_dock_window_style_set;
+ widget_class->delete_event = gimp_dock_window_delete_event;
g_object_class_install_property (object_class, PROP_CONTEXT,
g_param_spec_object ("gimp-context", NULL, NULL,
@@ -368,6 +378,53 @@ gimp_dock_window_style_set (GtkWidget *widget,
}
}
+/**
+ * gimp_dock_window_delete_event:
+ * @widget:
+ * @event:
+ *
+ * Makes sure that when dock windows are closed they are added to the
+ * list of recently closed docks so that they are easy to bring back.
+ **/
+static gboolean
+gimp_dock_window_delete_event (GtkWidget *widget,
+ GdkEventAny *event)
+{
+ GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (widget);
+ GimpDock *dock = gimp_dock_window_get_dock (dock_window);
+ GimpSessionInfo *info = NULL;
+
+ /* Don't add docks with just a singe dockable to the list of
+ * recently closed dock since those can be brought back through the
+ * normal Windows->Dockable Dialogs menu
+ */
+ if (gimp_dock_get_n_dockables (dock) < 2)
+ return FALSE;
+
+ info = gimp_session_info_new ();
+
+ gimp_object_set_name (GIMP_OBJECT (info),
+ gtk_window_get_title (GTK_WINDOW (dock_window)));
+
+ info->widget = GTK_WIDGET (dock);
+ gimp_session_info_get_info (info);
+ info->widget = NULL;
+
+ gimp_container_add (global_recent_docks, GIMP_OBJECT (info));
+ g_object_unref (info);
+
+ return FALSE;
+}
+
+static GimpDock *
+gimp_dock_window_get_dock (GimpDockWindow *dock_window)
+{
+ /* Change this to return the GimpDock *inside* the GimpDockWindow
+ * once GimpDock is not a subclass of GimpDockWindow any longer
+ */
+ return GIMP_DOCK (dock_window);
+}
+
static void
gimp_dock_window_display_changed (GimpDockWindow *dock_window,
GimpObject *display,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]