gimp r25629 - in trunk: . app/widgets



Author: mitch
Date: Sat May 10 19:11:18 2008
New Revision: 25629
URL: http://svn.gnome.org/viewvc/gimp?rev=25629&view=rev

Log:
2008-05-10  Michael Natterer  <mitch gimp org>

	* app/widgets/gimpdialogfactory.[ch]: add signals "dock-added" and
	"dock-removed".

	(gimp_dialog_factory_add_dialog)
	(gimp_dialog_factory_remove_dialog): emit them when docks get
	added and removed.



Modified:
   trunk/ChangeLog
   trunk/app/widgets/gimpdialogfactory.c
   trunk/app/widgets/gimpdialogfactory.h

Modified: trunk/app/widgets/gimpdialogfactory.c
==============================================================================
--- trunk/app/widgets/gimpdialogfactory.c	(original)
+++ trunk/app/widgets/gimpdialogfactory.c	Sat May 10 19:11:18 2008
@@ -31,6 +31,7 @@
 #include "widgets-types.h"
 
 #include "core/gimpcontext.h"
+#include "core/gimpmarshal.h"
 
 #include "gimpcursor.h"
 #include "gimpdialogfactory.h"
@@ -43,6 +44,14 @@
 #include "gimp-log.h"
 
 
+enum
+{
+  DOCK_ADDED,
+  DOCK_REMOVED,
+  LAST_SIGNAL
+};
+
+
 static void   gimp_dialog_factory_dispose             (GObject           *object);
 static void   gimp_dialog_factory_finalize            (GObject           *object);
 
@@ -91,6 +100,8 @@
 
 #define parent_class gimp_dialog_factory_parent_class
 
+static guint factory_signals[LAST_SIGNAL] = { 0 };
+
 static gboolean dialogs_shown = TRUE;  /* FIXME */
 
 
@@ -103,6 +114,26 @@
   object_class->finalize = gimp_dialog_factory_finalize;
 
   klass->factories = g_hash_table_new (g_str_hash, g_str_equal);
+
+  factory_signals[DOCK_ADDED] =
+    g_signal_new ("dock-added",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GimpDialogFactoryClass, dock_added),
+                  NULL, NULL,
+                  gimp_marshal_VOID__OBJECT,
+                  G_TYPE_NONE, 1,
+                  GIMP_TYPE_DOCK);
+
+  factory_signals[DOCK_REMOVED] =
+    g_signal_new ("dock-removed",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GimpDialogFactoryClass, dock_removed),
+                  NULL, NULL,
+                  gimp_marshal_VOID__OBJECT,
+                  G_TYPE_NONE, 1,
+                  GIMP_TYPE_DOCK);
 }
 
 static void
@@ -872,6 +903,8 @@
 
           factory->session_infos = g_list_append (factory->session_infos, info);
         }
+
+      g_signal_emit (factory, factory_signals[DOCK_ADDED], 0, dialog);
     }
 
   factory->open_dialogs = g_list_prepend (factory->open_dialogs, dialog);
@@ -996,13 +1029,15 @@
                                                   gimp_dialog_factory_dialog_configure,
                                                   factory);
 
-          /*  don't save session info for empty docks  */
           if (GIMP_IS_DOCK (dialog))
             {
+              /*  don't save session info for empty docks  */
               factory->session_infos = g_list_remove (factory->session_infos,
                                                       session_info);
-
               gimp_session_info_free (session_info);
+
+              g_signal_emit (factory, factory_signals[DOCK_REMOVED], 0,
+                             dialog);
             }
 
           break;

Modified: trunk/app/widgets/gimpdialogfactory.h
==============================================================================
--- trunk/app/widgets/gimpdialogfactory.h	(original)
+++ trunk/app/widgets/gimpdialogfactory.h	Sat May 10 19:11:18 2008
@@ -94,6 +94,11 @@
   GimpObjectClass  parent_class;
 
   GHashTable      *factories;
+
+  void (* dock_added)   (GimpDialogFactory *factory,
+                         GimpDock          *dock);
+  void (* dock_removed) (GimpDialogFactory *factory,
+                         GimpDock          *dock);
 };
 
 



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