[gimp] app: Make GimpDockWindow implement GimpDockContainer
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Make GimpDockWindow implement GimpDockContainer
- Date: Mon, 9 May 2011 18:02:40 +0000 (UTC)
commit 4b9243fc605798a177b1ff713722c0f91b5171bc
Author: Martin Nordholts <martinn src gnome org>
Date: Mon May 9 18:03:18 2011 +0200
app: Make GimpDockWindow implement GimpDockContainer
Make GimpDockWindow implement the GimpDockContainer interface. The
plan is to make GimpImageWindow also implement the GimpDockContainer
interface when we start to session manage docks in single-window mode.
app/gui/gimpuiconfigurer.c | 15 ++++++----
app/tests/test-ui.c | 9 ++++--
app/widgets/gimpdockwindow.c | 57 +++++++++++++++++++++++++++-------------
app/widgets/gimpdockwindow.h | 1 -
app/widgets/gimpsessioninfo.c | 9 ++++--
5 files changed, 59 insertions(+), 32 deletions(-)
---
diff --git a/app/gui/gimpuiconfigurer.c b/app/gui/gimpuiconfigurer.c
index 0b988de..2aad4d1 100644
--- a/app/gui/gimpuiconfigurer.c
+++ b/app/gui/gimpuiconfigurer.c
@@ -30,6 +30,7 @@
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpdock.h"
#include "widgets/gimpdockcolumns.h"
+#include "widgets/gimpdockcontainer.h"
#include "widgets/gimpdockwindow.h"
#include "widgets/gimptoolbox.h"
@@ -164,16 +165,18 @@ gimp_ui_configurer_move_docks_to_columns (GimpUIConfigurer *ui_configurer,
for (dialog_iter = dialogs; dialog_iter; dialog_iter = dialog_iter->next)
{
- GimpDockWindow *dock_window = NULL;
- GList *docks = NULL;
- GList *dock_iter = NULL;
+ GimpDockWindow *dock_window = NULL;
+ GimpDockContainer *dock_container = NULL;
+ GList *docks = NULL;
+ GList *dock_iter = NULL;
if (!GIMP_IS_DOCK_WINDOW (dialog_iter->data))
continue;
- dock_window = GIMP_DOCK_WINDOW (dialog_iter->data);
+ dock_window = GIMP_DOCK_WINDOW (dialog_iter->data);
+ dock_container = GIMP_DOCK_CONTAINER (dock_window);
- docks = g_list_copy (gimp_dock_window_get_docks (dock_window));
+ docks = g_list_copy (gimp_dock_container_get_docks (dock_container));
for (dock_iter = docks; dock_iter; dock_iter = dock_iter->next)
{
GimpDock *dock = GIMP_DOCK (dock_iter->data);
@@ -200,7 +203,7 @@ gimp_ui_configurer_move_docks_to_columns (GimpUIConfigurer *ui_configurer,
* destroyed
*/
if (GTK_IS_WIDGET (dock_window) &&
- g_list_length (gimp_dock_window_get_docks (dock_window)) == 0)
+ g_list_length (gimp_dock_container_get_docks (dock_container)) == 0)
{
gimp_dialog_factory_remove_dialog (gimp_dialog_factory_get_singleton (),
GTK_WIDGET (dock_window));
diff --git a/app/tests/test-ui.c b/app/tests/test-ui.c
index 7a2c908..60ee3a5 100644
--- a/app/tests/test-ui.c
+++ b/app/tests/test-ui.c
@@ -38,6 +38,7 @@
#include "widgets/gimpdock.h"
#include "widgets/gimpdockable.h"
#include "widgets/gimpdockbook.h"
+#include "widgets/gimpdockcontainer.h"
#include "widgets/gimpdocked.h"
#include "widgets/gimpdockwindow.h"
#include "widgets/gimphelp-ids.h"
@@ -734,15 +735,17 @@ gimp_ui_not_toolbox_window (GObject *object)
static gboolean
gimp_ui_multicolumn_not_toolbox_window (GObject *object)
{
- GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (object);
+ GimpDockWindow *dock_window;
+ GimpDockContainer *dock_container;
if (! GIMP_IS_DOCK_WINDOW (object))
return FALSE;
- dock_window = GIMP_DOCK_WINDOW (object);
+ dock_window = GIMP_DOCK_WINDOW (object);
+ dock_container = GIMP_DOCK_CONTAINER (object);
return (! gimp_dock_window_has_toolbox (dock_window) &&
- g_list_length (gimp_dock_window_get_docks (dock_window)) > 1);
+ g_list_length (gimp_dock_container_get_docks (dock_container)) > 1);
}
static gboolean
diff --git a/app/widgets/gimpdockwindow.c b/app/widgets/gimpdockwindow.c
index 4477934..5f161b6 100644
--- a/app/widgets/gimpdockwindow.c
+++ b/app/widgets/gimpdockwindow.c
@@ -48,6 +48,7 @@
#include "gimpdock.h"
#include "gimpdockbook.h"
#include "gimpdockcolumns.h"
+#include "gimpdockcontainer.h"
#include "gimpdockwindow.h"
#include "gimphelp-ids.h"
#include "gimpmenufactory.h"
@@ -108,6 +109,9 @@ struct _GimpDockWindowPrivate
};
+static void gimp_dock_window_dock_container_iface_init
+ (GimpDockContainerInterface
+ *iface);
static void gimp_dock_window_constructed (GObject *object);
static void gimp_dock_window_dispose (GObject *object);
static void gimp_dock_window_finalize (GObject *object);
@@ -124,6 +128,8 @@ static void gimp_dock_window_style_set (GtkWidget *widg
GtkStyle *prev_style);
static gboolean gimp_dock_window_delete_event (GtkWidget *widget,
GdkEventAny *event);
+static GList * gimp_dock_window_get_docks (GimpDockContainer
+ *dock_container);
static gboolean gimp_dock_window_should_add_to_recent (GimpDockWindow *dock_window);
static void gimp_dock_window_display_changed (GimpDockWindow *dock_window,
@@ -152,7 +158,9 @@ static void gimp_dock_window_auto_clicked (GtkWidget *widg
GimpDock *dock);
-G_DEFINE_TYPE (GimpDockWindow, gimp_dock_window, GIMP_TYPE_WINDOW)
+G_DEFINE_TYPE_WITH_CODE (GimpDockWindow, gimp_dock_window, GIMP_TYPE_WINDOW,
+ G_IMPLEMENT_INTERFACE (GIMP_TYPE_DOCK_CONTAINER,
+ gimp_dock_window_dock_container_iface_init))
#define parent_class gimp_dock_window_parent_class
@@ -254,6 +262,12 @@ gimp_dock_window_init (GimpDockWindow *dock_window)
}
static void
+gimp_dock_window_dock_container_iface_init (GimpDockContainerInterface *iface)
+{
+ iface->get_docks = gimp_dock_window_get_docks;
+}
+
+static void
gimp_dock_window_constructed (GObject *object)
{
GimpDockWindow *dock_window = GIMP_DOCK_WINDOW (object);
@@ -669,6 +683,25 @@ gimp_dock_window_delete_event (GtkWidget *widget,
}
/**
+ * gimp_dock_window_get_docks:
+ *
+ * Get a list of docks in the dock window.
+ *
+ * Returns:
+ **/
+static GList *
+gimp_dock_window_get_docks (GimpDockContainer *dock_container)
+{
+ GimpDockWindow *dock_window;
+
+ g_return_val_if_fail (GIMP_IS_DOCK_WINDOW (dock_container), NULL);
+
+ dock_window = GIMP_DOCK_WINDOW (dock_container);
+
+ return gimp_dock_columns_get_docks (dock_window->p->dock_columns);
+}
+
+/**
* gimp_dock_window_should_add_to_recent:
* @dock_window:
*
@@ -680,9 +713,11 @@ gimp_dock_window_delete_event (GtkWidget *widget,
static gboolean
gimp_dock_window_should_add_to_recent (GimpDockWindow *dock_window)
{
- GList *docks = gimp_dock_window_get_docks (dock_window);
+ GList *docks;
gboolean should_add = TRUE;
+ docks = gimp_dock_container_get_docks (GIMP_DOCK_CONTAINER (dock_window));
+
if (g_list_length (docks) < 1)
{
should_add = FALSE;
@@ -763,7 +798,7 @@ gimp_dock_window_get_description (GimpDockWindow *dock_window,
GString *complete_desc = g_string_new (NULL);
GList *iter = NULL;
- for (iter = gimp_dock_window_get_docks (dock_window);
+ for (iter = gimp_dock_container_get_docks (GIMP_DOCK_CONTAINER (dock_window));
iter;
iter = g_list_next (iter))
{
@@ -1005,22 +1040,6 @@ gimp_dock_window_get_dialog_factory (GimpDockWindow *dock_window)
return dock_window->p->dialog_factory;
}
-/**
- * gimp_dock_window_get_docks:
- * @dock_window:
- *
- * Get a list of docks in the dock window.
- *
- * Returns:
- **/
-GList *
-gimp_dock_window_get_docks (GimpDockWindow *dock_window)
-{
- g_return_val_if_fail (GIMP_IS_DOCK_WINDOW (dock_window), NULL);
-
- return gimp_dock_columns_get_docks (dock_window->p->dock_columns);
-}
-
gboolean
gimp_dock_window_get_auto_follow_active (GimpDockWindow *dock_window)
{
diff --git a/app/widgets/gimpdockwindow.h b/app/widgets/gimpdockwindow.h
index 29c8411..22a918d 100644
--- a/app/widgets/gimpdockwindow.h
+++ b/app/widgets/gimpdockwindow.h
@@ -70,7 +70,6 @@ void gimp_dock_window_remove_dock (GimpDockWindow *
GimpUIManager * gimp_dock_window_get_ui_manager (GimpDockWindow *dock_window);
GimpContext * gimp_dock_window_get_context (GimpDockWindow *dock);
GimpDialogFactory * gimp_dock_window_get_dialog_factory (GimpDockWindow *dock);
-GList * gimp_dock_window_get_docks (GimpDockWindow *dock_window);
gboolean gimp_dock_window_get_auto_follow_active (GimpDockWindow *menu_dock);
void gimp_dock_window_set_auto_follow_active (GimpDockWindow *menu_dock,
gboolean show);
diff --git a/app/widgets/gimpsessioninfo.c b/app/widgets/gimpsessioninfo.c
index ad9d0c2..6033579 100644
--- a/app/widgets/gimpsessioninfo.c
+++ b/app/widgets/gimpsessioninfo.c
@@ -30,6 +30,8 @@
#include "config/gimpguiconfig.h"
+#include "widgets/gimpdockcontainer.h"
+
#include "core/gimp.h"
#include "core/gimpcontext.h"
@@ -740,11 +742,12 @@ gimp_session_info_get_info (GimpSessionInfo *info)
info->p->aux_info = gimp_session_info_aux_get_list (info->p->widget);
- if (GIMP_IS_DOCK_WINDOW (info->p->widget))
+ if (GIMP_IS_DOCK_CONTAINER (info->p->widget))
{
- GList *iter = NULL;
+ GimpDockContainer *dock_container = GIMP_DOCK_CONTAINER (info->p->widget);
+ GList *iter = NULL;
- for (iter = gimp_dock_window_get_docks (GIMP_DOCK_WINDOW (info->p->widget));
+ for (iter = gimp_dock_container_get_docks (dock_container);
iter;
iter = g_list_next (iter))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]