mirror of https://github.com/GNOME/gimp.git
added signal Gimp::image-opened to announce that an image has been loaded
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. svn path=/trunk/; revision=27297
This commit is contained in:
parent
ea6008a7e8
commit
8f425553a7
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
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.
|
||||
|
||||
2008-10-16 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/widgets/gimpviewrenderervectors.c
|
||||
|
|
|
@ -84,6 +84,7 @@ enum
|
|||
RESTORE,
|
||||
EXIT,
|
||||
BUFFER_CHANGED,
|
||||
IMAGE_OPENED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
|
@ -161,6 +162,15 @@ gimp_class_init (GimpClass *klass)
|
|||
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 @@ gimp_message_valist (Gimp *gimp,
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -129,6 +129,10 @@ struct _GimpClass
|
|||
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 @@ void gimp_message_valist (Gimp *gimp,
|
|||
const gchar *format,
|
||||
va_list args);
|
||||
|
||||
void gimp_image_opened (Gimp *gimp,
|
||||
const gchar *uri);
|
||||
|
||||
gboolean gimp_use_gegl (Gimp *gimp);
|
||||
|
||||
|
||||
|
|
|
@ -366,6 +366,9 @@ file_open_with_proc_and_display (Gimp *gimp,
|
|||
|
||||
/* the display owns the image now */
|
||||
g_object_unref (image);
|
||||
|
||||
/* announce that we opened this image */
|
||||
gimp_image_opened (image->gimp, uri);
|
||||
}
|
||||
|
||||
return image;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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_init (GimpDBusService *service);
|
|||
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 @@ G_DEFINE_TYPE (GimpDBusService, gimp_dbus_service, G_TYPE_OBJECT)
|
|||
|
||||
#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 @@ gimp_dbus_service_new (Gimp *gimp)
|
|||
|
||||
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 @@ gimp_dbus_service_activate (GimpDBusService *service,
|
|||
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.
|
||||
|
|
|
@ -53,6 +53,10 @@ struct _GimpDBusService
|
|||
struct _GimpDBusServiceClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (* opened) (GimpDBusService *service,
|
||||
const gchar *uri);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -51,8 +51,8 @@ static DBusGConnection *dbus_connection = NULL;
|
|||
#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;
|
||||
|
|
Loading…
Reference in New Issue