~ubuntu-branches/ubuntu/oneiric/gconf/oneiric-proposed

« back to all changes in this revision

Viewing changes to gconf/gconf-internals.c

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort, Josselin Mouette, Sjoerd Simons, Emilio Pozuelo Monfort
  • Date: 2010-12-06 00:53:14 UTC
  • mfrom: (1.1.25 upstream)
  • mto: (7.3.4 sid)
  • mto: This revision was merged to the branch mainline in revision 58.
  • Revision ID: james.westby@ubuntu.com-20101206005314-uz89yke6r1xfw504
Tags: 2.32.1-1
[ Josselin Mouette ]
* Include patch-translations.mk, bump build-depends accordingly.
* Include 03_error_message.patch in POTFILES.in.
* pt_BR.po: Brazilian Portuguese translation. Closes: #599032.
* fr.po: French translation by Christian Perrier. Closes: #599049.
* da.po: Danish translation by Joe Hansen. Closes: #599125.
* cs.po: Czech translation by Michal Simunek. Closes: #599198.
* update-gconf-defaults: patch from Ubuntu to deal with broken 
  symlinks. Closes: #599393. Thanks Michael Vogt.
* de.po: German translation by Helge Kreutzmann. Closes: #599683.
* sv.po: Swedish translation by Martin Bagge. Closes: #599854.
* 04_manpage.patch: patch from A. Costa. Fixes typos in the manual 
  page. Closes: #600899.

[ Sjoerd Simons ]
* New upstream release
* Bump gobject-introspection to the lastest version to generate the most
  recent .gir version
* debian/patches/03_error_message.patch
  + Removed, merged upstream
* debian/rules:
  + Specify compilation with gtk2

[ Emilio Pozuelo Monfort ]
* Switch to source format 3.0 (quilt).
* debian/patches/*:
  - Updated to apply cleanly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
#include <time.h>
37
37
#include <math.h>
38
38
 
39
 
#include <dbus/dbus.h>
 
39
#include <gio/gio.h>
40
40
 
41
41
#ifdef G_OS_WIN32
42
42
#include <windows.h>
2424
2424
get_ior (gboolean start_if_not_found,
2425
2425
         GString  *failure_log)
2426
2426
{
2427
 
        DBusMessage *message, *reply;
2428
 
        DBusConnection *connection;
2429
 
        DBusError bus_error;
 
2427
        GDBusConnection *connection;
 
2428
        GVariant *value;
2430
2429
        char *ior;
 
2430
        GError *error = NULL;
2431
2431
 
2432
2432
        /* if the bus isn't running and we don't want to start gconfd then
2433
2433
         * we don't want to autolaunch the bus either, so bail early.
2440
2440
                return NULL;
2441
2441
        }
2442
2442
 
2443
 
        dbus_error_init (&bus_error);
2444
 
        connection = dbus_bus_get (DBUS_BUS_SESSION, &bus_error);
 
2443
        g_type_init ();
2445
2444
 
2446
 
        if (dbus_error_is_set (&bus_error)) {
 
2445
        connection = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error);
 
2446
        if (connection == NULL) {
2447
2447
                if (failure_log)
2448
2448
                    g_string_append_printf (failure_log,
2449
2449
                                            _("Failed to get connection to session: %s"),
2450
 
                                            bus_error.message);
2451
 
                dbus_error_free (&bus_error);
2452
 
                return NULL;
2453
 
        }
2454
 
 
2455
 
        message = dbus_message_new_method_call ("org.gnome.GConf",
2456
 
                                                "/org/gnome/GConf",
2457
 
                                                "org.gnome.GConf",
2458
 
                                                "GetIOR");
2459
 
        dbus_message_set_auto_start (message, start_if_not_found);
2460
 
 
2461
 
        reply = dbus_connection_send_with_reply_and_block (connection, message, -1,
2462
 
                                                           &bus_error);
2463
 
        dbus_message_unref (message);
2464
 
 
2465
 
        if (dbus_error_is_set (&bus_error)) {
2466
 
                if (failure_log)
2467
 
                    g_string_append_printf (failure_log,
2468
 
                                            _("Could not send message to GConf daemon: %s"),
2469
 
                                            bus_error.message);
2470
 
                dbus_error_free (&bus_error);
2471
 
                return NULL;
2472
 
        }
2473
 
 
2474
 
        ior = NULL;
2475
 
        if (!dbus_message_get_args (reply, &bus_error, DBUS_TYPE_STRING,
2476
 
                                    &ior, DBUS_TYPE_INVALID)) {
2477
 
                if (failure_log)
2478
 
                    g_string_append_printf (failure_log,
2479
 
                                            _("daemon gave erroneous reply: %s"),
2480
 
                                            bus_error.message);
2481
 
                dbus_error_free (&bus_error);
2482
 
                return NULL;
2483
 
        }
2484
 
 
2485
 
        ior = g_strdup (ior);
2486
 
 
2487
 
        dbus_message_unref (reply);
2488
 
        dbus_connection_unref (connection);
 
2450
                                            error->message);
 
2451
                g_error_free (error);
 
2452
                return NULL;
 
2453
        }
 
2454
 
 
2455
        value = g_dbus_connection_call_sync (connection,
 
2456
                                             "org.gnome.GConf",
 
2457
                                             "/org/gnome/GConf",
 
2458
                                             "org.gnome.GConf",
 
2459
                                             "GetIOR",
 
2460
                                             g_variant_new ("()"),
 
2461
                                             G_VARIANT_TYPE ("(s)"),
 
2462
                                             start_if_not_found ? G_DBUS_CALL_FLAGS_NONE 
 
2463
                                                                : G_DBUS_CALL_FLAGS_NO_AUTO_START,
 
2464
                                             -1,
 
2465
                                             NULL,
 
2466
                                             &error);
 
2467
        g_object_unref (connection);
 
2468
 
 
2469
        if (value == NULL) {
 
2470
                if (failure_log)
 
2471
                    g_string_append_printf (failure_log,
 
2472
                                            _("GetIOR failed: %s"),
 
2473
                                            error->message);
 
2474
 
 
2475
                g_error_free (error);
 
2476
                return NULL;
 
2477
        }
 
2478
 
 
2479
        g_variant_get (value, "(s)", &ior, NULL);
 
2480
        g_variant_unref (value);
2489
2481
 
2490
2482
        return ior;
2491
2483
}
2882
2874
    g_set_error (error,
2883
2875
                 GCONF_ERROR,
2884
2876
                 GCONF_ERROR_NO_SERVER,
2885
 
                 _("Failed to contact configuration server; some possible causes are that you need to enable TCP/IP networking for ORBit, or you have stale NFS locks due to a system crash. See http://projects.gnome.org/gconf/ for information. (Details - %s)"),
 
2877
                 _("Failed to contact configuration server; the most common cause is a missing or misconfigured D-Bus session bus daemon. See http://projects.gnome.org/gconf/ for information. (Details - %s)"),
2886
2878
                 failure_log->len > 0 ? failure_log->str : _("none"));
2887
2879
 
2888
2880
  g_string_free (failure_log, TRUE);