[gimp] app: Add GimpDockColumns "dock-added" and "dock-removed" signals
- From: Martin Nordholts <martinn src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] app: Add GimpDockColumns "dock-added" and "dock-removed" signals
- Date: Sun, 15 Nov 2009 14:58:24 +0000 (UTC)
commit 12530bfcf1a534b480eb64a89762abe42c29d991
Author: Martin Nordholts <martinn src gnome org>
Date: Fri Nov 13 18:24:20 2009 +0100
app: Add GimpDockColumns "dock-added" and "dock-removed" signals
app/widgets/gimpdockcolumns.c | 63 +++++++++++++++++++++++++++++++++++++++--
app/widgets/gimpdockcolumns.h | 5 +++
2 files changed, 65 insertions(+), 3 deletions(-)
---
diff --git a/app/widgets/gimpdockcolumns.c b/app/widgets/gimpdockcolumns.c
index c85cb11..b41419f 100644
--- a/app/widgets/gimpdockcolumns.c
+++ b/app/widgets/gimpdockcolumns.c
@@ -26,6 +26,7 @@
#include "core/gimp.h"
#include "core/gimpcontext.h"
+#include "core/gimpmarshal.h"
#include "dialogs/dialogs.h"
@@ -39,6 +40,14 @@
#include "gimppanedbox.h"
+enum
+{
+ DOCK_ADDED,
+ DOCK_REMOVED,
+ LAST_SIGNAL
+};
+
+
struct _GimpDockColumnsPrivate
{
GList *docks;
@@ -47,19 +56,48 @@ struct _GimpDockColumnsPrivate
};
-static gboolean gimp_dock_columns_dropped_cb (GimpDockSeparator *separator,
- GtkWidget *source,
- gpointer data);
+static gboolean gimp_dock_columns_dropped_cb (GimpDockSeparator *separator,
+ GtkWidget *source,
+ gpointer data);
+static void gimp_dock_columns_real_dock_added (GimpDockColumns *dock_columns,
+ GimpDock *dock);
+static void gimp_dock_columns_real_dock_removed (GimpDockColumns *dock_columns,
+ GimpDock *dock);
G_DEFINE_TYPE (GimpDockColumns, gimp_dock_columns, GTK_TYPE_HBOX)
#define parent_class gimp_dock_columns_parent_class
+static guint dock_columns_signals[LAST_SIGNAL] = { 0 };
+
static void
gimp_dock_columns_class_init (GimpDockColumnsClass *klass)
{
+ klass->dock_added = gimp_dock_columns_real_dock_added;
+ klass->dock_removed = gimp_dock_columns_real_dock_removed;
+
+ dock_columns_signals[DOCK_ADDED] =
+ g_signal_new ("dock-added",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpDockColumnsClass, dock_added),
+ NULL, NULL,
+ gimp_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GIMP_TYPE_DOCK);
+
+ dock_columns_signals[DOCK_REMOVED] =
+ g_signal_new ("dock-removed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpDockColumnsClass, dock_removed),
+ NULL, NULL,
+ gimp_marshal_VOID__OBJECT,
+ G_TYPE_NONE, 1,
+ GIMP_TYPE_DOCK);
+
g_type_class_add_private (klass, sizeof (GimpDockColumnsPrivate));
}
@@ -117,6 +155,19 @@ gimp_dock_columns_dropped_cb (GimpDockSeparator *separator,
return TRUE;
}
+static void
+gimp_dock_columns_real_dock_added (GimpDockColumns *dock_columns,
+ GimpDock *dock)
+{
+}
+
+static void
+gimp_dock_columns_real_dock_removed (GimpDockColumns *dock_columns,
+ GimpDock *dock)
+{
+}
+
+
/**
* gimp_dock_columns_add_dock:
* @dock_columns:
@@ -137,6 +188,8 @@ gimp_dock_columns_add_dock (GimpDockColumns *dock_columns,
gimp_paned_box_add_widget (GIMP_PANED_BOX (dock_columns->p->paned_hbox),
GTK_WIDGET (dock),
index);
+
+ g_signal_emit (dock_columns, dock_columns_signals[DOCK_ADDED], 0, dock);
}
@@ -149,8 +202,12 @@ gimp_dock_columns_remove_dock (GimpDockColumns *dock_columns,
dock_columns->p->docks = g_list_remove (dock_columns->p->docks, dock);
+ g_object_ref (dock);
gimp_paned_box_remove_widget (GIMP_PANED_BOX (dock_columns->p->paned_hbox),
GTK_WIDGET (dock));
+
+ g_signal_emit (dock_columns, dock_columns_signals[DOCK_REMOVED], 0, dock);
+ g_object_unref (dock);
}
GList *
diff --git a/app/widgets/gimpdockcolumns.h b/app/widgets/gimpdockcolumns.h
index be3f82d..076ebcf 100644
--- a/app/widgets/gimpdockcolumns.h
+++ b/app/widgets/gimpdockcolumns.h
@@ -49,6 +49,11 @@ struct _GimpDockColumns
struct _GimpDockColumnsClass
{
GtkHBoxClass parent_class;
+
+ void (* dock_added) (GimpDockColumns *dock_columns,
+ GimpDock *dock);
+ void (* dock_removed) (GimpDockColumns *dock_columns,
+ GimpDock *dock);
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]