gedit r6509 - branches/new_plugins/gedit
- From: jessevdk svn gnome org
- To: svn-commits-list gnome org
- Subject: gedit r6509 - branches/new_plugins/gedit
- Date: Sun, 7 Sep 2008 22:24:26 +0000 (UTC)
Author: jessevdk
Date: Sun Sep 7 22:24:26 2008
New Revision: 6509
URL: http://svn.gnome.org/viewvc/gedit?rev=6509&view=rev
Log:
Added dispatch signal which can be used to for instance propagate messages
in other message systems (think dbus)
Modified:
branches/new_plugins/gedit/gedit-message-bus.c
branches/new_plugins/gedit/gedit-message-bus.h
Modified: branches/new_plugins/gedit/gedit-message-bus.c
==============================================================================
--- branches/new_plugins/gedit/gedit-message-bus.c (original)
+++ branches/new_plugins/gedit/gedit-message-bus.c Sun Sep 7 22:24:26 2008
@@ -41,6 +41,18 @@
guint next_id;
};
+/* signals */
+enum
+{
+ DISPATCH,
+ LAST_SIGNAL
+};
+
+static guint message_bus_signals[LAST_SIGNAL];
+
+static void gedit_message_bus_dispatch_real (GeditMessageBus *bus,
+ GeditMessage *message);
+
G_DEFINE_TYPE(GeditMessageBus, gedit_message_bus, G_TYPE_OBJECT)
static void
@@ -90,6 +102,19 @@
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = gedit_message_bus_finalize;
+
+ klass->dispatch = gedit_message_bus_dispatch_real;
+
+ message_bus_signals[DISPATCH] =
+ g_signal_new ("dispatch",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GeditMessageBusClass, dispatch),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ GEDIT_TYPE_MESSAGE);
g_type_class_add_private (object_class, sizeof(GeditMessageBusPrivate));
}
@@ -229,22 +254,27 @@
}
static void
-dispatch_message (GeditMessageBus *bus,
- GeditMessage *message)
+gedit_message_bus_dispatch_real (GeditMessageBus *bus,
+ GeditMessage *message)
{
- Message *msg;
const gchar *domain;
const gchar *name;
-
+ Message *msg;
+
domain = gedit_message_get_domain (message);
name = gedit_message_get_name (message);
-
+
msg = lookup_message (bus, domain, name, FALSE);
- if (!msg)
- return;
-
- dispatch_message_real (bus, msg, message);
+ if (msg)
+ dispatch_message_real (bus, msg, message);
+}
+
+static void
+dispatch_message (GeditMessageBus *bus,
+ GeditMessage *message)
+{
+ g_signal_emit (bus, message_bus_signals[DISPATCH], 0, message);
}
static gboolean
@@ -541,6 +571,7 @@
GeditMessage *message;
va_start (var_args, name);
+
message = create_message (domain, name, var_args);
gedit_message_bus_send_message (bus, message);
Modified: branches/new_plugins/gedit/gedit-message-bus.h
==============================================================================
--- branches/new_plugins/gedit/gedit-message-bus.h (original)
+++ branches/new_plugins/gedit/gedit-message-bus.h Sun Sep 7 22:24:26 2008
@@ -26,6 +26,9 @@
struct _GeditMessageBusClass {
GObjectClass parent_class;
+
+ void (*dispatch) (GeditMessageBus *bus,
+ GeditMessage *message);
};
typedef void (* GeditMessageCallback) (GeditMessageBus *bus,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]