2424
2424
get_ior (gboolean start_if_not_found,
2425
2425
GString *failure_log)
2427
DBusMessage *message, *reply;
2428
DBusConnection *connection;
2429
DBusError bus_error;
2427
GDBusConnection *connection;
2430
GError *error = NULL;
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.
2443
dbus_error_init (&bus_error);
2444
connection = dbus_bus_get (DBUS_BUS_SESSION, &bus_error);
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"),
2451
dbus_error_free (&bus_error);
2455
message = dbus_message_new_method_call ("org.gnome.GConf",
2459
dbus_message_set_auto_start (message, start_if_not_found);
2461
reply = dbus_connection_send_with_reply_and_block (connection, message, -1,
2463
dbus_message_unref (message);
2465
if (dbus_error_is_set (&bus_error)) {
2467
g_string_append_printf (failure_log,
2468
_("Could not send message to GConf daemon: %s"),
2470
dbus_error_free (&bus_error);
2475
if (!dbus_message_get_args (reply, &bus_error, DBUS_TYPE_STRING,
2476
&ior, DBUS_TYPE_INVALID)) {
2478
g_string_append_printf (failure_log,
2479
_("daemon gave erroneous reply: %s"),
2481
dbus_error_free (&bus_error);
2485
ior = g_strdup (ior);
2487
dbus_message_unref (reply);
2488
dbus_connection_unref (connection);
2451
g_error_free (error);
2455
value = g_dbus_connection_call_sync (connection,
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,
2467
g_object_unref (connection);
2469
if (value == NULL) {
2471
g_string_append_printf (failure_log,
2472
_("GetIOR failed: %s"),
2475
g_error_free (error);
2479
g_variant_get (value, "(s)", &ior, NULL);
2480
g_variant_unref (value);
2882
2874
g_set_error (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"));
2888
2880
g_string_free (failure_log, TRUE);