File gnome-control-center-bnc472226-randr-dont-block-gui.diff of Package gnome-control-center
bnc472226 - Don't block the display capplet's GUI while the RANDR configuration is being changed
diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c
index bd5b997..15bfa41 100644
--- a/capplets/display/xrandr-capplet.c
+++ b/capplets/display/xrandr-capplet.c
@@ -64,6 +64,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;
+ DBusGProxyCall *proxy_call;
};
static void rebuild_gui (App *app);
@@ -1709,12 +1714,40 @@ check_required_virtual_size (App *app)
}
}
+/* Callback for dbus_g_proxy_begin_call() */
+static void
+apply_configuration_returned_cb (DBusGProxy *proxy,
+ DBusGProxyCall *call_id,
+ void *data)
+{
+ App *app = data;
+ gboolean success;
+ GError *error;
+
+ g_assert (call_id == app->proxy_call);
+
+ error = NULL;
+ success = dbus_g_proxy_end_call (proxy, call_id, &error, G_TYPE_INVALID);
+
+ if (!success) {
+ error_message (app, _("Could not apply the selected configuration"), error->message);
+ g_error_free (error);
+ }
+
+ g_object_unref (app->proxy);
+ app->proxy = NULL;
+
+ dbus_g_connection_unref (app->connection);
+ app->connection = NULL;
+ app->proxy_call = NULL;
+
+ gtk_widget_set_sensitive (app->dialog, TRUE);
+}
+
static void
apply (App *app)
{
GError *error = NULL;
- DBusGConnection *connection;
- DBusGProxy *proxy;
gnome_rr_config_sanitize (app->current_configuration);
@@ -1729,30 +1762,34 @@ 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);
+ g_assert (app->proxy_call == 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)) {
- error_message (app, _("Could not apply the selected configuration"), error->message);
- g_error_free (error);
}
- g_object_unref (proxy);
- dbus_g_connection_unref (connection);
+ gtk_widget_set_sensitive (app->dialog, FALSE);
+ app->proxy_call = dbus_g_proxy_begin_call (app->proxy, "ApplyConfiguration",
+ apply_configuration_returned_cb, app,
+ NULL,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
}
#if 0