gimp r27297 - in trunk: . app/core app/file app/gui



Author: neo
Date: Fri Oct 17 12:03:08 2008
New Revision: 27297
URL: http://svn.gnome.org/viewvc/gimp?rev=27297&view=rev

Log:
2008-10-17  Sven Neumann  <sven sven>

	* app/core/gimp.[ch]: added signal Gimp::image-opened to 
announce
	that an image has been loaded and a display was created for it.

	* app/file/file-open.c (file_open_with_proc_and_display): call
	gimp_opened() to emit the new signal.

	* app/gui/dbus-service.xml
	* app/gui/gimpdbusservice.[ch]: propagate the 'opened' signal to
	listeners of the "org.gimp.GIMP.UI" DBus service.

	* app/gui/gui-unique.c: formatting.



Modified:
   trunk/ChangeLog
   trunk/app/core/gimp.c
   trunk/app/core/gimp.h
   trunk/app/file/file-open.c
   trunk/app/gui/dbus-service.xml
   trunk/app/gui/gimpdbusservice.c
   trunk/app/gui/gimpdbusservice.h
   trunk/app/gui/gui-unique.c

Modified: trunk/app/core/gimp.c
==============================================================================
--- trunk/app/core/gimp.c	(original)
+++ trunk/app/core/gimp.c	Fri Oct 17 12:03:08 2008
@@ -84,6 +84,7 @@
   RESTORE,
   EXIT,
   BUFFER_CHANGED,
+  IMAGE_OPENED,
   LAST_SIGNAL
 };
 
@@ -161,6 +162,15 @@
                   gimp_marshal_VOID__VOID,
                   G_TYPE_NONE, 0);
 
+  gimp_signals[IMAGE_OPENED] =
+    g_signal_new ("image-opened",
+                  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (GimpClass, image_opened),
+                  NULL, NULL,
+                  gimp_marshal_VOID__STRING,
+                  G_TYPE_NONE, 1, G_TYPE_STRING);
+
   object_class->dispose          = gimp_dispose;
   object_class->finalize         = gimp_finalize;
 
@@ -1072,6 +1082,16 @@
   g_free (message);
 }
 
+void
+gimp_image_opened (Gimp        *gimp,
+		   const gchar *uri)
+{
+  g_return_if_fail (GIMP_IS_GIMP (gimp));
+  g_return_if_fail (uri != NULL);
+
+  g_signal_emit (gimp, gimp_signals[IMAGE_OPENED], 0, uri);
+}
+
 gboolean
 gimp_use_gegl (Gimp *gimp)
 {

Modified: trunk/app/core/gimp.h
==============================================================================
--- trunk/app/core/gimp.h	(original)
+++ trunk/app/core/gimp.h	Fri Oct 17 12:03:08 2008
@@ -129,6 +129,10 @@
                                gboolean            force);
 
   void     (* buffer_changed) (Gimp               *gimp);
+
+  /*  emitted if an image is loaded and opened with a display  */
+  void     (* image_opened)   (Gimp               *gimp,
+			       const gchar        *uri);
 };
 
 
@@ -188,6 +192,9 @@
                                           const gchar         *format,
                                           va_list              args);
 
+void           gimp_image_opened         (Gimp                *gimp,
+					  const gchar         *uri);
+
 gboolean       gimp_use_gegl             (Gimp                *gimp);
 
 

Modified: trunk/app/file/file-open.c
==============================================================================
--- trunk/app/file/file-open.c	(original)
+++ trunk/app/file/file-open.c	Fri Oct 17 12:03:08 2008
@@ -366,6 +366,9 @@
 
       /*  the display owns the image now  */
       g_object_unref (image);
+
+      /*  announce that we opened this image  */
+      gimp_image_opened (image->gimp, uri);
     }
 
   return image;

Modified: trunk/app/gui/dbus-service.xml
==============================================================================
--- trunk/app/gui/dbus-service.xml	(original)
+++ trunk/app/gui/dbus-service.xml	Fri Oct 17 12:03:08 2008
@@ -3,17 +3,26 @@
 <node name="/org/gimp/GIMP/UI">
 
   <interface name="org.gimp.GIMP.UI">
+
     <annotation name="org.freedesktop.DBus.GLib.CSymbol"
 		value="gimp_dbus_service" />
+
     <method name="Open">
       <arg type="s" name="uri" direction="in" />
       <arg type="b" name="success" direction="out" />
     </method>
+
     <method name="OpenAsNew">
       <arg type="s" name="uri" direction="in" />
       <arg type="b" name="success" direction="out" />
     </method>
+
     <method name="Activate" />
+
+    <signal name="Opened">
+      <arg type="s" name="uri" />
+    </signal>
+
   </interface>
 
 </node>

Modified: trunk/app/gui/gimpdbusservice.c
==============================================================================
--- trunk/app/gui/gimpdbusservice.c	(original)
+++ trunk/app/gui/gimpdbusservice.c	Fri Oct 17 12:03:08 2008
@@ -39,6 +39,12 @@
 #include "gimpdbusservice-glue.h"
 
 
+enum
+{
+  OPENED,
+  LAST_SIGNAL
+};
+
 typedef struct
 {
   gchar    *uri;
@@ -52,6 +58,10 @@
 static void       gimp_dbus_service_dispose        (GObject          *object);
 static void       gimp_dbus_service_finalize       (GObject          *object);
 
+static void       gimp_dbus_service_gimp_opened    (Gimp             *gimp,
+						    const gchar      *uri,
+						    GimpDBusService  *service);
+
 static gboolean   gimp_dbus_service_queue_open     (GimpDBusService  *service,
                                                     const gchar      *uri,
                                                     gboolean          as_new);
@@ -67,12 +77,23 @@
 
 #define parent_class gimp_dbus_service_parent_class
 
+static guint gimp_dbus_service_signals[LAST_SIGNAL] = { 0 };
+
 
 static void
 gimp_dbus_service_class_init (GimpDBusServiceClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
+  gimp_dbus_service_signals[OPENED] =
+    g_signal_new ("opened",
+		  G_TYPE_FROM_CLASS (klass),
+                  G_SIGNAL_RUN_FIRST,
+                  G_STRUCT_OFFSET (GimpDBusServiceClass, opened),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__STRING,
+                  G_TYPE_NONE, 1, G_TYPE_STRING);
+
   object_class->dispose  = gimp_dbus_service_dispose;
   object_class->finalize = gimp_dbus_service_finalize;
 
@@ -97,6 +118,10 @@
 
   service->gimp = gimp;
 
+  g_signal_connect_object (gimp, "image-opened",
+			   G_CALLBACK (gimp_dbus_service_gimp_opened),
+			   service, 0);
+
   return G_OBJECT (service);
 }
 
@@ -185,6 +210,14 @@
   return TRUE;
 }
 
+static void
+gimp_dbus_service_gimp_opened (Gimp            *gimp,
+			       const gchar     *uri,
+			       GimpDBusService *service)
+{
+  g_signal_emit (service, gimp_dbus_service_signals[OPENED], 0, uri);
+}
+
 /*
  * Adds a request to open a file to the end of the queue and
  * starts an idle source if it is not already running.

Modified: trunk/app/gui/gimpdbusservice.h
==============================================================================
--- trunk/app/gui/gimpdbusservice.h	(original)
+++ trunk/app/gui/gimpdbusservice.h	Fri Oct 17 12:03:08 2008
@@ -53,6 +53,10 @@
 struct _GimpDBusServiceClass
 {
   GObjectClass  parent_class;
+
+  /*  signals  */
+  void (* opened) (GimpDBusService *service,
+		   const gchar     *uri);
 };
 
 

Modified: trunk/app/gui/gui-unique.c
==============================================================================
--- trunk/app/gui/gui-unique.c	(original)
+++ trunk/app/gui/gui-unique.c	Fri Oct 17 12:03:08 2008
@@ -51,8 +51,8 @@
 #ifdef G_OS_WIN32
 #include "file/file-open.h"
 
-static void gui_unique_win32_init  (Gimp *gimp);
-static void gui_unique_win32_exit  (void);
+static void  gui_unique_win32_init (Gimp *gimp);
+static void  gui_unique_win32_exit (void);
 
 static Gimp            *unique_gimp      = NULL;
 static HWND             proxy_window     = NULL;



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