diff options
author | Federico Mena Quintero <federico@novell.com> | 2009-05-30 20:47:42 -0500 |
---|---|---|
committer | Federico Mena Quintero <federico@novell.com> | 2009-06-08 20:17:38 -0500 |
commit | 74e06ac80e3c34b416ca0a72615dfa11398b8d33 (patch) | |
tree | c9055ec7e6758d8d4b242803f6bf14ce78a02012 | |
parent | 1efda260d36a35be30de143ac60129109f82720d (diff) | |
download | gnome-control-center-randr-hotplug.tar.gz |
Use the timestamp of the Apply button to change the RANDR configurationrandr-hotplug
There is no timestamp available when the dialog returns from gtk_dialog_run().
So, we save the timestamp at the time the Apply button is clicked.
Signed-off-by: Federico Mena Quintero <federico@novell.com>
-rw-r--r-- | capplets/display/display-capplet.glade | 2 | ||||
-rw-r--r-- | capplets/display/xrandr-capplet.c | 23 |
2 files changed, 23 insertions, 2 deletions
diff --git a/capplets/display/display-capplet.glade b/capplets/display/display-capplet.glade index 712cb49a1..d94770bb3 100644 --- a/capplets/display/display-capplet.glade +++ b/capplets/display/display-capplet.glade @@ -45,7 +45,7 @@ </child> <child> - <widget class="GtkButton" id="button1"> + <widget class="GtkButton" id="apply_button"> <property name="visible">True</property> <property name="can_default">True</property> <property name="can_focus">True</property> diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index 015feaf9a..8bfc303ef 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -59,6 +59,10 @@ struct App GtkWidget *clone_checkbox; GtkWidget *show_icon_checkbox; + /* We store the event timestamp when the Apply button is clicked */ + GtkWidget *apply_button; + guint32 apply_button_clicked_timestamp; + GtkWidget *area; gboolean ignore_gui_changes; GConfClient *client; @@ -1886,7 +1890,7 @@ apply (App *app) gtk_widget_set_sensitive (app->dialog, FALSE); - begin_version2_apply_configuration (app, gtk_widget_get_window (app->dialog), gtk_get_current_event_time ()); + begin_version2_apply_configuration (app, gtk_widget_get_window (app->dialog), app->apply_button_clicked_timestamp); } #if 0 @@ -2092,6 +2096,19 @@ hide_help_button (App *app) } static void +apply_button_clicked_cb (GtkButton *button, gpointer data) +{ + App *app = data; + + /* We simply store the timestamp at which the Apply button was clicked. + * We'll just wait for the dialog to return from gtk_dialog_run(), and + * *then* use the timestamp when applying the RANDR configuration. + */ + + app->apply_button_clicked_timestamp = gtk_get_current_event_time (); +} + +static void run_application (App *app) { #ifndef GLADEDIR @@ -2194,6 +2211,10 @@ run_application (App *app) /* Until we have help to show, we'll just hide the Help button */ hide_help_button (app); + app->apply_button = glade_xml_get_widget (xml, "apply_button"); + g_signal_connect (app->apply_button, "clicked", + G_CALLBACK (apply_button_clicked_cb), app); + on_screen_changed (app->screen, app); g_object_unref (xml); |