diff options
author | Carlos Soriano <csoriano@gnome.org> | 2016-08-29 18:24:05 +0200 |
---|---|---|
committer | Carlos Soriano <csoriano@gnome.org> | 2016-08-29 18:37:10 +0200 |
commit | 52d960542b4d5fdf2bd06735d0dbf7934cf2ec12 (patch) | |
tree | 5e000d5ed40b52b003c02b597e51ae0b87ff22ac /src/nautilus-freedesktop-dbus.c | |
parent | 4cafccd82859a4ee0bdfad3e31a310f2d94c0485 (diff) | |
download | nautilus-52d960542b4d5fdf2bd06735d0dbf7934cf2ec12.tar.gz |
general: run uncrustify
And make the style of Nautilus the same for all files.
Hopefully we can fix all the style issues we can find in the next days,
so expect a little of movement on this.
https://bugzilla.gnome.org/show_bug.cgi?id=770564
Diffstat (limited to 'src/nautilus-freedesktop-dbus.c')
-rw-r--r-- | src/nautilus-freedesktop-dbus.c | 228 |
1 files changed, 119 insertions, 109 deletions
diff --git a/src/nautilus-freedesktop-dbus.c b/src/nautilus-freedesktop-dbus.c index 7d03bc086..c4657aba3 100644 --- a/src/nautilus-freedesktop-dbus.c +++ b/src/nautilus-freedesktop-dbus.c @@ -32,197 +32,207 @@ #include <gio/gio.h> -struct _NautilusFreedesktopDBus { - GObject parent; +struct _NautilusFreedesktopDBus +{ + GObject parent; - /* Id from g_dbus_own_name() */ - guint owner_id; + /* Id from g_dbus_own_name() */ + guint owner_id; - /* Our DBus implementation skeleton */ - NautilusFreedesktopFileManager1 *skeleton; + /* Our DBus implementation skeleton */ + NautilusFreedesktopFileManager1 *skeleton; }; -struct _NautilusFreedesktopDBusClass { - GObjectClass parent_class; +struct _NautilusFreedesktopDBusClass +{ + GObjectClass parent_class; }; G_DEFINE_TYPE (NautilusFreedesktopDBus, nautilus_freedesktop_dbus, G_TYPE_OBJECT); static gboolean skeleton_handle_show_items_cb (NautilusFreedesktopFileManager1 *object, - GDBusMethodInvocation *invocation, - const gchar *const *uris, - const gchar *startup_id, - gpointer data) + GDBusMethodInvocation *invocation, + const gchar * const *uris, + const gchar *startup_id, + gpointer data) { - NautilusApplication *application; - int i; + NautilusApplication *application; + int i; - application = NAUTILUS_APPLICATION (g_application_get_default ()); + application = NAUTILUS_APPLICATION (g_application_get_default ()); - for (i = 0; uris[i] != NULL; i++) { - GFile *file; - GFile *parent; + for (i = 0; uris[i] != NULL; i++) + { + GFile *file; + GFile *parent; - file = g_file_new_for_uri (uris[i]); - parent = g_file_get_parent (file); + file = g_file_new_for_uri (uris[i]); + parent = g_file_get_parent (file); - if (parent != NULL) { - nautilus_application_open_location (application, parent, file, startup_id); - g_object_unref (parent); - } else { - nautilus_application_open_location (application, file, NULL, startup_id); - } + if (parent != NULL) + { + nautilus_application_open_location (application, parent, file, startup_id); + g_object_unref (parent); + } + else + { + nautilus_application_open_location (application, file, NULL, startup_id); + } - g_object_unref (file); - } + g_object_unref (file); + } - nautilus_freedesktop_file_manager1_complete_show_items (object, invocation); - return TRUE; + nautilus_freedesktop_file_manager1_complete_show_items (object, invocation); + return TRUE; } static gboolean skeleton_handle_show_folders_cb (NautilusFreedesktopFileManager1 *object, - GDBusMethodInvocation *invocation, - const gchar *const *uris, - const gchar *startup_id, - gpointer data) + GDBusMethodInvocation *invocation, + const gchar * const *uris, + const gchar *startup_id, + gpointer data) { - NautilusApplication *application; - int i; + NautilusApplication *application; + int i; - application = NAUTILUS_APPLICATION (g_application_get_default ()); + application = NAUTILUS_APPLICATION (g_application_get_default ()); - for (i = 0; uris[i] != NULL; i++) { - GFile *file; + for (i = 0; uris[i] != NULL; i++) + { + GFile *file; - file = g_file_new_for_uri (uris[i]); + file = g_file_new_for_uri (uris[i]); - nautilus_application_open_location (application, file, NULL, startup_id); + nautilus_application_open_location (application, file, NULL, startup_id); - g_object_unref (file); - } + g_object_unref (file); + } - nautilus_freedesktop_file_manager1_complete_show_folders (object, invocation); - return TRUE; + nautilus_freedesktop_file_manager1_complete_show_folders (object, invocation); + return TRUE; } static gboolean skeleton_handle_show_item_properties_cb (NautilusFreedesktopFileManager1 *object, - GDBusMethodInvocation *invocation, - const gchar *const *uris, - const gchar *startup_id, - gpointer data) + GDBusMethodInvocation *invocation, + const gchar * const *uris, + const gchar *startup_id, + gpointer data) { - GList *files; - int i; + GList *files; + int i; - files = NULL; + files = NULL; - for (i = 0; uris[i] != NULL; i++) { - files = g_list_prepend (files, nautilus_file_get_by_uri (uris[i])); - } + for (i = 0; uris[i] != NULL; i++) + { + files = g_list_prepend (files, nautilus_file_get_by_uri (uris[i])); + } - files = g_list_reverse (files); + files = g_list_reverse (files); - nautilus_properties_window_present (files, NULL, startup_id); + nautilus_properties_window_present (files, NULL, startup_id); - nautilus_file_list_free (files); + nautilus_file_list_free (files); - nautilus_freedesktop_file_manager1_complete_show_item_properties (object, invocation); - return TRUE; + nautilus_freedesktop_file_manager1_complete_show_item_properties (object, invocation); + return TRUE; } static void bus_acquired_cb (GDBusConnection *conn, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { - NautilusFreedesktopDBus *fdb = user_data; + NautilusFreedesktopDBus *fdb = user_data; - DEBUG ("Bus acquired at %s", name); + DEBUG ("Bus acquired at %s", name); - fdb->skeleton = nautilus_freedesktop_file_manager1_skeleton_new (); + fdb->skeleton = nautilus_freedesktop_file_manager1_skeleton_new (); - g_signal_connect (fdb->skeleton, "handle-show-items", - G_CALLBACK (skeleton_handle_show_items_cb), fdb); - g_signal_connect (fdb->skeleton, "handle-show-folders", - G_CALLBACK (skeleton_handle_show_folders_cb), fdb); - g_signal_connect (fdb->skeleton, "handle-show-item-properties", - G_CALLBACK (skeleton_handle_show_item_properties_cb), fdb); + g_signal_connect (fdb->skeleton, "handle-show-items", + G_CALLBACK (skeleton_handle_show_items_cb), fdb); + g_signal_connect (fdb->skeleton, "handle-show-folders", + G_CALLBACK (skeleton_handle_show_folders_cb), fdb); + g_signal_connect (fdb->skeleton, "handle-show-item-properties", + G_CALLBACK (skeleton_handle_show_item_properties_cb), fdb); - g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (fdb->skeleton), conn, NAUTILUS_FDO_DBUS_PATH, NULL); + g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (fdb->skeleton), conn, NAUTILUS_FDO_DBUS_PATH, NULL); } static void name_acquired_cb (GDBusConnection *connection, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { - DEBUG ("Acquired the name %s on the session message bus\n", name); + DEBUG ("Acquired the name %s on the session message bus\n", name); } static void name_lost_cb (GDBusConnection *connection, - const gchar *name, - gpointer user_data) + const gchar *name, + gpointer user_data) { - DEBUG ("Lost (or failed to acquire) the name %s on the session message bus\n", name); + DEBUG ("Lost (or failed to acquire) the name %s on the session message bus\n", name); } static void nautilus_freedesktop_dbus_dispose (GObject *object) { - NautilusFreedesktopDBus *fdb = (NautilusFreedesktopDBus *) object; - - if (fdb->owner_id != 0) { - g_bus_unown_name (fdb->owner_id); - fdb->owner_id = 0; - } - - if (fdb->skeleton != NULL) { - g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (fdb->skeleton)); - g_object_unref (fdb->skeleton); - fdb->skeleton = NULL; - } - - G_OBJECT_CLASS (nautilus_freedesktop_dbus_parent_class)->dispose (object); + NautilusFreedesktopDBus *fdb = (NautilusFreedesktopDBus *) object; + + if (fdb->owner_id != 0) + { + g_bus_unown_name (fdb->owner_id); + fdb->owner_id = 0; + } + + if (fdb->skeleton != NULL) + { + g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (fdb->skeleton)); + g_object_unref (fdb->skeleton); + fdb->skeleton = NULL; + } + + G_OBJECT_CLASS (nautilus_freedesktop_dbus_parent_class)->dispose (object); } static void nautilus_freedesktop_dbus_class_init (NautilusFreedesktopDBusClass *klass) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (klass); - object_class->dispose = nautilus_freedesktop_dbus_dispose; + object_class->dispose = nautilus_freedesktop_dbus_dispose; } static void nautilus_freedesktop_dbus_init (NautilusFreedesktopDBus *fdb) { - fdb->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, - NAUTILUS_FDO_DBUS_NAME, - G_BUS_NAME_OWNER_FLAGS_NONE, - bus_acquired_cb, - name_acquired_cb, - name_lost_cb, - fdb, - NULL); + fdb->owner_id = g_bus_own_name (G_BUS_TYPE_SESSION, + NAUTILUS_FDO_DBUS_NAME, + G_BUS_NAME_OWNER_FLAGS_NONE, + bus_acquired_cb, + name_acquired_cb, + name_lost_cb, + fdb, + NULL); } void -nautilus_freedesktop_dbus_set_open_locations (NautilusFreedesktopDBus *fdb, - const gchar **locations) +nautilus_freedesktop_dbus_set_open_locations (NautilusFreedesktopDBus *fdb, + const gchar **locations) { - g_return_if_fail (NAUTILUS_IS_FREEDESKTOP_DBUS (fdb)); + g_return_if_fail (NAUTILUS_IS_FREEDESKTOP_DBUS (fdb)); - nautilus_freedesktop_file_manager1_set_open_locations (fdb->skeleton, locations); + nautilus_freedesktop_file_manager1_set_open_locations (fdb->skeleton, locations); } /* Tries to own the org.freedesktop.FileManager1 service name */ NautilusFreedesktopDBus * nautilus_freedesktop_dbus_new (void) -{ - return g_object_new (nautilus_freedesktop_dbus_get_type (), - NULL); +{ + return g_object_new (nautilus_freedesktop_dbus_get_type (), + NULL); } |