gimp r26398 - in trunk: . app/gui
- From: neo svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26398 - in trunk: . app/gui
- Date: Wed, 6 Aug 2008 08:15:36 +0000 (UTC)
Author: neo
Date: Wed Aug 6 08:15:36 2008
New Revision: 26398
URL: http://svn.gnome.org/viewvc/gimp?rev=26398&view=rev
Log:
2008-08-06 Sven Neumann <sven gimp org>
* app/gui/gimpdbusservice.c: minor cleanups.
Modified:
trunk/ChangeLog
trunk/app/gui/gimpdbusservice.c
Modified: trunk/app/gui/gimpdbusservice.c
==============================================================================
--- trunk/app/gui/gimpdbusservice.c (original)
+++ trunk/app/gui/gimpdbusservice.c Wed Aug 6 08:15:36 2008
@@ -46,19 +46,21 @@
} OpenData;
-static void gimp_dbus_service_class_init (GimpDBusServiceClass *klass);
-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_queue_open (GimpDBusService *service,
- const gchar *uri,
- gboolean as_new);
-
-static OpenData * gimp_dbus_service_open_data_new (GimpDBusService *service,
- const gchar *uri,
- gboolean as_new);
-static void gimp_dbus_service_open_data_free (OpenData *data);
+static void gimp_dbus_service_class_init (GimpDBusServiceClass *klass);
+
+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 gboolean gimp_dbus_service_queue_open (GimpDBusService *service,
+ const gchar *uri,
+ gboolean as_new);
+
+static gboolean gimp_dbus_service_open_idle (GimpDBusService *service);
+static OpenData * gimp_dbus_service_open_data_new (GimpDBusService *service,
+ const gchar *uri,
+ gboolean as_new);
+static void gimp_dbus_service_open_data_free (OpenData *data);
G_DEFINE_TYPE (GimpDBusService, gimp_dbus_service, G_TYPE_OBJECT)
@@ -141,12 +143,7 @@
g_return_val_if_fail (uri != NULL, FALSE);
g_return_val_if_fail (success != NULL, FALSE);
- gimp_dbus_service_queue_open (service, uri, FALSE);
-
- /* The call always succeeds as it is handled in one way or another.
- * Even presenting an error message is considered success ;-)
- */
- *success = TRUE;
+ *success = gimp_dbus_service_queue_open (service, uri, FALSE);
return TRUE;
}
@@ -161,12 +158,7 @@
g_return_val_if_fail (uri != NULL, FALSE);
g_return_val_if_fail (success != NULL, FALSE);
- gimp_dbus_service_queue_open (service, uri, TRUE);
-
- /* The call always succeeds as it is handled in one way or another.
- * Even presenting an error message is considered success ;-)
- */
- *success = TRUE;
+ *success = gimp_dbus_service_queue_open (service, uri, TRUE);
return TRUE;
}
@@ -186,26 +178,40 @@
return TRUE;
}
-static OpenData *
-gimp_dbus_service_open_data_new (GimpDBusService *service,
- const gchar *uri,
- gboolean as_new)
+/*
+ * Adds a request to open a file to the end of the queue and
+ * starts an idle source if it is not already running.
+ */
+static gboolean
+gimp_dbus_service_queue_open (GimpDBusService *service,
+ const gchar *uri,
+ gboolean as_new)
{
- OpenData *data = g_slice_new (OpenData);
+ g_queue_push_tail (service->queue,
+ gimp_dbus_service_open_data_new (service, uri, as_new));
- data->uri = g_strdup (uri);
- data->as_new = as_new;
+ if (! service->source)
+ {
+ service->source = g_idle_source_new ();
- return data;
-}
+ g_source_set_callback (service->source,
+ (GSourceFunc) gimp_dbus_service_open_idle, service,
+ NULL);
+ g_source_attach (service->source, NULL);
+ g_source_unref (service->source);
+ }
-static void
-gimp_dbus_service_open_data_free (OpenData *data)
-{
- g_free (data->uri);
- g_slice_free (OpenData, data);
+ /* The call always succeeds as it is handled in one way or another.
+ * Even presenting an error message is considered success ;-)
+ */
+ return TRUE;
}
+/*
+ * Idle callback that removes the first request from the queue and
+ * handles it. If there are no more requests, the idle source is
+ * removed.
+ */
static gboolean
gimp_dbus_service_open_idle (GimpDBusService *service)
{
@@ -225,24 +231,25 @@
return FALSE;
}
-static void
-gimp_dbus_service_queue_open (GimpDBusService *service,
- const gchar *uri,
- gboolean as_new)
+static OpenData *
+gimp_dbus_service_open_data_new (GimpDBusService *service,
+ const gchar *uri,
+ gboolean as_new)
{
- g_queue_push_tail (service->queue,
- gimp_dbus_service_open_data_new (service, uri, as_new));
+ OpenData *data = g_slice_new (OpenData);
- if (! service->source)
- {
- service->source = g_idle_source_new ();
+ data->uri = g_strdup (uri);
+ data->as_new = as_new;
- g_source_set_callback (service->source,
- (GSourceFunc) gimp_dbus_service_open_idle, service,
- NULL);
- g_source_attach (service->source, NULL);
- g_source_unref (service->source);
- }
+ return data;
}
+static void
+gimp_dbus_service_open_data_free (OpenData *data)
+{
+ g_free (data->uri);
+ g_slice_free (OpenData, data);
+}
+
+
#endif /* HAVE_DBUS_GLIB */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]