[evince/wip/app: 4/19] daemon: Reduce indentation
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/wip/app: 4/19] daemon: Reduce indentation
- Date: Fri, 29 Jun 2012 10:08:18 +0000 (UTC)
commit 0695429614648f0f63ff735bc090fd74097cf668
Author: Christian Persch <chpe gnome org>
Date: Mon Jun 11 22:02:08 2012 +0200
daemon: Reduce indentation
shell/ev-daemon.c | 204 ++++++++++++++++++++++++++--------------------------
1 files changed, 102 insertions(+), 102 deletions(-)
---
diff --git a/shell/ev-daemon.c b/shell/ev-daemon.c
index 06792ec..c4ba6d6 100644
--- a/shell/ev-daemon.c
+++ b/shell/ev-daemon.c
@@ -217,48 +217,48 @@ handle_register_document_cb (EvDaemon *object,
const gchar *uri,
gpointer user_data)
{
- GDBusConnection *connection;
- const char *sender;
- EvDoc *doc;
-
- doc = ev_daemon_find_doc (uri);
- if (doc != NULL) {
- LOG ("RegisterDocument found owner '%s' for URI '%s'\n", doc->dbus_name, uri);
- ev_daemon_complete_register_document (object, invocation, doc->dbus_name);
- return TRUE;
- }
-
- ev_daemon_stop_killtimer ();
-
- sender = g_dbus_method_invocation_get_sender (invocation);
- connection = g_dbus_method_invocation_get_connection (invocation);
-
- doc = g_new (EvDoc, 1);
- doc->dbus_name = g_strdup (sender);
- doc->uri = g_strdup (uri);
-
- doc->loaded_id = g_dbus_connection_signal_subscribe (connection,
- doc->dbus_name,
- EV_DBUS_WINDOW_INTERFACE_NAME,
- "DocumentLoaded",
- NULL,
- NULL,
- 0,
- (GDBusSignalCallback) document_loaded_cb,
- doc,
- NULL);
- doc->watch_id = g_bus_watch_name_on_connection (connection,
- sender,
- G_BUS_NAME_WATCHER_FLAGS_NONE,
- name_appeared_cb,
- name_vanished_cb,
- user_data, NULL);
-
- LOG ("RegisterDocument registered owner '%s' for URI '%s'\n", doc->dbus_name, uri);
- ev_daemon_docs = g_list_prepend (ev_daemon_docs, doc);
-
- ev_daemon_complete_register_document (object, invocation, "");
+ GDBusConnection *connection;
+ const char *sender;
+ EvDoc *doc;
+
+ doc = ev_daemon_find_doc (uri);
+ if (doc != NULL) {
+ LOG ("RegisterDocument found owner '%s' for URI '%s'\n", doc->dbus_name, uri);
+ ev_daemon_complete_register_document (object, invocation, doc->dbus_name);
return TRUE;
+ }
+
+ ev_daemon_stop_killtimer ();
+
+ sender = g_dbus_method_invocation_get_sender (invocation);
+ connection = g_dbus_method_invocation_get_connection (invocation);
+
+ doc = g_new (EvDoc, 1);
+ doc->dbus_name = g_strdup (sender);
+ doc->uri = g_strdup (uri);
+
+ doc->loaded_id = g_dbus_connection_signal_subscribe (connection,
+ doc->dbus_name,
+ EV_DBUS_WINDOW_INTERFACE_NAME,
+ "DocumentLoaded",
+ NULL,
+ NULL,
+ 0,
+ (GDBusSignalCallback) document_loaded_cb,
+ doc,
+ NULL);
+ doc->watch_id = g_bus_watch_name_on_connection (connection,
+ sender,
+ G_BUS_NAME_WATCHER_FLAGS_NONE,
+ name_appeared_cb,
+ name_vanished_cb,
+ user_data, NULL);
+
+ LOG ("RegisterDocument registered owner '%s' for URI '%s'\n", doc->dbus_name, uri);
+ ev_daemon_docs = g_list_prepend (ev_daemon_docs, doc);
+
+ ev_daemon_complete_register_document (object, invocation, "");
+ return TRUE;
}
static gboolean
@@ -267,39 +267,39 @@ handle_unregister_document_cb (EvDaemon *object,
const gchar *uri,
gpointer user_data)
{
- EvDoc *doc;
- const char *sender;
-
- LOG ("UnregisterDocument URI '%s'\n", uri);
-
- doc = ev_daemon_find_doc (uri);
- if (doc == NULL) {
- LOG ("UnregisterDocument URI was not registered!\n");
- g_dbus_method_invocation_return_error_literal (invocation,
- G_DBUS_ERROR,
- G_DBUS_ERROR_INVALID_ARGS,
- "URI not registered");
- return TRUE;
- }
+ EvDoc *doc;
+ const char *sender;
+
+ LOG ("UnregisterDocument URI '%s'\n", uri);
+
+ doc = ev_daemon_find_doc (uri);
+ if (doc == NULL) {
+ LOG ("UnregisterDocument URI was not registered!\n");
+ g_dbus_method_invocation_return_error_literal (invocation,
+ G_DBUS_ERROR,
+ G_DBUS_ERROR_INVALID_ARGS,
+ "URI not registered");
+ return TRUE;
+ }
- sender = g_dbus_method_invocation_get_sender (invocation);
- if (strcmp (doc->dbus_name, sender) != 0) {
- LOG ("UnregisterDocument called by non-owner (owner '%s' sender '%s')\n",
- doc->dbus_name, sender);
+ sender = g_dbus_method_invocation_get_sender (invocation);
+ if (strcmp (doc->dbus_name, sender) != 0) {
+ LOG ("UnregisterDocument called by non-owner (owner '%s' sender '%s')\n",
+ doc->dbus_name, sender);
- g_dbus_method_invocation_return_error_literal (invocation,
- G_DBUS_ERROR,
- G_DBUS_ERROR_BAD_ADDRESS,
- "Only owner can call this method");
- return TRUE;
- }
+ g_dbus_method_invocation_return_error_literal (invocation,
+ G_DBUS_ERROR,
+ G_DBUS_ERROR_BAD_ADDRESS,
+ "Only owner can call this method");
+ return TRUE;
+ }
- ev_daemon_docs = g_list_remove (ev_daemon_docs, doc);
- ev_doc_free (doc);
- ev_daemon_maybe_start_killtimer (user_data);
+ ev_daemon_docs = g_list_remove (ev_daemon_docs, doc);
+ ev_doc_free (doc);
+ ev_daemon_maybe_start_killtimer (user_data);
- ev_daemon_complete_unregister_document (object, invocation);
- return TRUE;
+ ev_daemon_complete_unregister_document (object, invocation);
+ return TRUE;
}
static gboolean
@@ -309,41 +309,41 @@ handle_find_document_cb (EvDaemon *object,
gboolean spawn,
gpointer user_data)
{
- EvDoc *doc;
+ EvDoc *doc;
- LOG ("FindDocument URI '%s' \n", uri);
+ LOG ("FindDocument URI '%s' \n", uri);
- doc = ev_daemon_find_doc (uri);
- if (doc != NULL) {
- ev_daemon_complete_find_document (object, invocation, doc->dbus_name);
- return TRUE;
- }
-
- if (spawn) {
- GList *uri_invocations;
- gboolean ret_val = TRUE;
-
- uri_invocations = g_hash_table_lookup (pending_invocations, uri);
-
- if (uri_invocations == NULL) {
- /* Only spawn once. */
- ret_val = spawn_evince (uri);
- }
-
- if (ret_val) {
- /* Only defer DBUS answer if evince was succesfully spawned */
- uri_invocations = g_list_prepend (uri_invocations, invocation);
- g_hash_table_insert (pending_invocations,
- g_strdup (uri),
- uri_invocations);
- return TRUE;
- }
- }
-
- LOG ("FindDocument URI '%s' was not registered!\n", uri);
- // FIXME shouldn't this return an error then?
- ev_daemon_complete_find_document (object, invocation, "");
+ doc = ev_daemon_find_doc (uri);
+ if (doc != NULL) {
+ ev_daemon_complete_find_document (object, invocation, doc->dbus_name);
return TRUE;
+ }
+
+ if (spawn) {
+ GList *uri_invocations;
+ gboolean ret_val = TRUE;
+
+ uri_invocations = g_hash_table_lookup (pending_invocations, uri);
+
+ if (uri_invocations == NULL) {
+ /* Only spawn once. */
+ ret_val = spawn_evince (uri);
+ }
+
+ if (ret_val) {
+ /* Only defer DBUS answer if evince was succesfully spawned */
+ uri_invocations = g_list_prepend (uri_invocations, invocation);
+ g_hash_table_insert (pending_invocations,
+ g_strdup (uri),
+ uri_invocations);
+ return TRUE;
+ }
+ }
+
+ LOG ("FindDocument URI '%s' was not registered!\n", uri);
+ // FIXME shouldn't this return an error then?
+ ev_daemon_complete_find_document (object, invocation, "");
+ return TRUE;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]