bnc472226 (RANDR) - Put the D-bus connection and proxy in the main App structure, not in local variables.
We'll need this to maintain state for the D-bus async callback. Signed-off-by: Federico Mena Quintero <federico@novell.com> svn path=/trunk/; revision=9241
This commit is contained in:
parent
18edc5202f
commit
5e0e21f11e
1 changed files with 23 additions and 13 deletions
|
@ -62,6 +62,11 @@ struct App
|
|||
GtkWidget *area;
|
||||
gboolean ignore_gui_changes;
|
||||
GConfClient *client;
|
||||
|
||||
/* These are used while we are waiting for the ApplyConfiguration method to be executed over D-bus */
|
||||
DBusGConnection *connection;
|
||||
DBusGProxy *proxy;
|
||||
|
||||
};
|
||||
|
||||
static void rebuild_gui (App *app);
|
||||
|
@ -1709,8 +1714,6 @@ static void
|
|||
apply (App *app)
|
||||
{
|
||||
GError *error = NULL;
|
||||
DBusGConnection *connection;
|
||||
DBusGProxy *proxy;
|
||||
|
||||
gnome_rr_config_sanitize (app->current_configuration);
|
||||
|
||||
|
@ -1725,30 +1728,37 @@ apply (App *app)
|
|||
return;
|
||||
}
|
||||
|
||||
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
|
||||
if (connection == NULL) {
|
||||
g_assert (app->connection == NULL);
|
||||
g_assert (app->proxy == NULL);
|
||||
|
||||
app->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
|
||||
if (app->connection == NULL) {
|
||||
error_message (app, _("Could not get session bus while applying display configuration"), error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
proxy = dbus_g_proxy_new_for_name (connection,
|
||||
"org.gnome.SettingsDaemon",
|
||||
"/org/gnome/SettingsDaemon/XRANDR",
|
||||
"org.gnome.SettingsDaemon.XRANDR");
|
||||
if (!proxy) {
|
||||
app->proxy = dbus_g_proxy_new_for_name (app->connection,
|
||||
"org.gnome.SettingsDaemon",
|
||||
"/org/gnome/SettingsDaemon/XRANDR",
|
||||
"org.gnome.SettingsDaemon.XRANDR");
|
||||
if (!app->proxy) {
|
||||
error_message (app, _("Could not get org.gnome.SettingsDaemon.XRANDR"), NULL);
|
||||
dbus_g_connection_unref (app->connection);
|
||||
app->connection = NULL;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if (!dbus_g_proxy_call (proxy, "ApplyConfiguration", &error, G_TYPE_INVALID, G_TYPE_INVALID)) {
|
||||
if (!dbus_g_proxy_call (app->proxy, "ApplyConfiguration", &error, G_TYPE_INVALID, G_TYPE_INVALID)) {
|
||||
error_message (app, _("Could not apply the selected configuration"), error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
g_object_unref (proxy);
|
||||
dbus_g_connection_unref (connection);
|
||||
g_object_unref (app->proxy);
|
||||
app->proxy = NULL;
|
||||
|
||||
dbus_g_connection_unref (app->connection);
|
||||
app->connection = NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue