summaryrefslogtreecommitdiff
path: root/common/test-settings-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/test-settings-server.c')
-rw-r--r--common/test-settings-server.c180
1 files changed, 90 insertions, 90 deletions
diff --git a/common/test-settings-server.c b/common/test-settings-server.c
index cc2f609e..a7fe7918 100644
--- a/common/test-settings-server.c
+++ b/common/test-settings-server.c
@@ -44,125 +44,125 @@ static GdmSettings *settings = NULL;
static gboolean
acquire_name_on_proxy (DBusGProxy *bus_proxy)
{
- GError *error;
- guint result;
- gboolean res;
- gboolean ret;
-
- ret = FALSE;
-
- if (bus_proxy == NULL) {
- goto out;
- }
-
- error = NULL;
- res = dbus_g_proxy_call (bus_proxy,
- "RequestName",
- &error,
- G_TYPE_STRING, GDM_DBUS_NAME,
- G_TYPE_UINT, 0,
- G_TYPE_INVALID,
- G_TYPE_UINT, &result,
- G_TYPE_INVALID);
- if (! res) {
- if (error != NULL) {
- g_warning ("Failed to acquire %s: %s", GDM_DBUS_NAME, error->message);
- g_error_free (error);
- } else {
- g_warning ("Failed to acquire %s", GDM_DBUS_NAME);
- }
- goto out;
- }
-
- if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
- if (error != NULL) {
- g_warning ("Failed to acquire %s: %s", GDM_DBUS_NAME, error->message);
- g_error_free (error);
- } else {
- g_warning ("Failed to acquire %s", GDM_DBUS_NAME);
- }
- goto out;
- }
-
- ret = TRUE;
+ GError *error;
+ guint result;
+ gboolean res;
+ gboolean ret;
+
+ ret = FALSE;
+
+ if (bus_proxy == NULL) {
+ goto out;
+ }
+
+ error = NULL;
+ res = dbus_g_proxy_call (bus_proxy,
+ "RequestName",
+ &error,
+ G_TYPE_STRING, GDM_DBUS_NAME,
+ G_TYPE_UINT, 0,
+ G_TYPE_INVALID,
+ G_TYPE_UINT, &result,
+ G_TYPE_INVALID);
+ if (! res) {
+ if (error != NULL) {
+ g_warning ("Failed to acquire %s: %s", GDM_DBUS_NAME, error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Failed to acquire %s", GDM_DBUS_NAME);
+ }
+ goto out;
+ }
+
+ if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+ if (error != NULL) {
+ g_warning ("Failed to acquire %s: %s", GDM_DBUS_NAME, error->message);
+ g_error_free (error);
+ } else {
+ g_warning ("Failed to acquire %s", GDM_DBUS_NAME);
+ }
+ goto out;
+ }
+
+ ret = TRUE;
out:
- return ret;
+ return ret;
}
static DBusGProxy *
get_bus_proxy (DBusGConnection *connection)
{
- DBusGProxy *bus_proxy;
+ DBusGProxy *bus_proxy;
- bus_proxy = dbus_g_proxy_new_for_name (connection,
- DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS,
- DBUS_INTERFACE_DBUS);
- return bus_proxy;
+ bus_proxy = dbus_g_proxy_new_for_name (connection,
+ DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS);
+ return bus_proxy;
}
static DBusGConnection *
get_system_bus (void)
{
- GError *error;
- DBusGConnection *bus;
- DBusConnection *connection;
-
- error = NULL;
- bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
- if (bus == NULL) {
- g_warning ("Couldn't connect to system bus: %s",
- error->message);
- g_error_free (error);
- goto out;
- }
-
- connection = dbus_g_connection_get_connection (bus);
- dbus_connection_set_exit_on_disconnect (connection, FALSE);
+ GError *error;
+ DBusGConnection *bus;
+ DBusConnection *connection;
+
+ error = NULL;
+ bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+ if (bus == NULL) {
+ g_warning ("Couldn't connect to system bus: %s",
+ error->message);
+ g_error_free (error);
+ goto out;
+ }
+
+ connection = dbus_g_connection_get_connection (bus);
+ dbus_connection_set_exit_on_disconnect (connection, FALSE);
out:
- return bus;
+ return bus;
}
int
main (int argc, char **argv)
{
- GMainLoop *main_loop;
+ GMainLoop *main_loop;
DBusGConnection *connection;
- DBusGProxy *bus_proxy;
+ DBusGProxy *bus_proxy;
g_type_init ();
- connection = get_system_bus ();
- if (connection == NULL) {
- goto out;
- }
-
- bus_proxy = get_bus_proxy (connection);
- if (bus_proxy == NULL) {
- g_warning ("Could not construct bus_proxy object; bailing out");
- goto out;
- }
-
- if (! acquire_name_on_proxy (bus_proxy) ) {
- g_warning ("Could not acquire name; bailing out");
- goto out;
- }
-
- settings = gdm_settings_new ();
- if (settings == NULL) {
- g_warning ("Unable to initialize settings");
- exit (1);
+ connection = get_system_bus ();
+ if (connection == NULL) {
+ goto out;
+ }
+
+ bus_proxy = get_bus_proxy (connection);
+ if (bus_proxy == NULL) {
+ g_warning ("Could not construct bus_proxy object; bailing out");
+ goto out;
+ }
+
+ if (! acquire_name_on_proxy (bus_proxy) ) {
+ g_warning ("Could not acquire name; bailing out");
+ goto out;
+ }
+
+ settings = gdm_settings_new ();
+ if (settings == NULL) {
+ g_warning ("Unable to initialize settings");
+ exit (1);
}
- main_loop = g_main_loop_new (NULL, FALSE);
- g_main_loop_run (main_loop);
+ main_loop = g_main_loop_new (NULL, FALSE);
+ g_main_loop_run (main_loop);
- g_main_loop_unref (main_loop);
+ g_main_loop_unref (main_loop);
g_object_unref (settings);
out:
- return 0;
+ return 0;
}