Updating branch refs/heads/bluesabre/display-settings to d05ed8bcc2e6e2c1a69563f7695e79b436ad038b (commit) from 86be9fb8961af306dfd3cb75910665160ed6f915 (commit)
commit d05ed8bcc2e6e2c1a69563f7695e79b436ad038b Author: Sean Davis <smd.seanda...@gmail.com> Date: Wed Sep 26 05:39:00 2012 -0400 Enhancements to minimal dialog, tweaked code to support new minimal dialog. dialogs/display-settings/main.c | 119 +------------------- .../display-settings/minimal-display-dialog.glade | 14 +- 2 files changed, 9 insertions(+), 124 deletions(-) diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c index b6192b1..86dd15e 100644 --- a/dialogs/display-settings/main.c +++ b/dialogs/display-settings/main.c @@ -1140,90 +1140,6 @@ screen_on_event (GdkXEvent *xevent, } - -static void -display_settings_minimal_dialog_response (GtkDialog *dialog, - gint response_id, - GtkBuilder *builder) -{ - GObject *first_screen_radio; - GObject *second_screen_radio; - XfceRRMode *mode1, *mode2; - gboolean use_first_screen; - gboolean use_second_screen; - guint first, second; - gint m, n, found; - - if (response_id == 1) - { - /* TODO: handle correctly more than 2 outputs? */ - first = 0; - second = 1; - - first_screen_radio = gtk_builder_get_object (builder, "radiobutton1"); - second_screen_radio = gtk_builder_get_object (builder, "radiobutton2"); - - use_first_screen = - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (first_screen_radio)); - use_second_screen = - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (second_screen_radio)); - - if (use_first_screen) - { - xfce_randr->mode[first] = xfce_randr_preferred_mode (xfce_randr, first); - xfce_randr->mode[second] = None; - } - else if (use_second_screen) - { - xfce_randr->mode[second] = xfce_randr_preferred_mode (xfce_randr, second); - xfce_randr->mode[first] = None; - } - else - { - if (xfce_randr->clone_modes[0] != None) - { - xfce_randr->mode[first] = xfce_randr->clone_modes[0]; - xfce_randr->mode[second] = xfce_randr->clone_modes[0]; - } - else - { - found = FALSE; - /* No clone mode available, try to find a "similar" mode */ - for (n = 0; n < xfce_randr->output_info[first]->nmode; ++n) - { - mode1 = &xfce_randr->modes[first][n]; - for (m = 0; m < xfce_randr->output_info[second]->nmode; ++m) - { - mode2 = &xfce_randr->modes[second][m]; - /* "similar" means same resolution */ - if (mode1->width == mode2->width - && mode1->height == mode2->height) - { - xfce_randr->mode[first] = mode1->id; - xfce_randr->mode[second] = mode2->id; - found = TRUE; - break; - } - } - - if (found) - break; - } - } - } - /* Save the two outputs and apply */ - xfce_randr_save_output (xfce_randr, "MinimalAutoConfig", display_channel, - first); - xfce_randr_save_output (xfce_randr, "MinimalAutoConfig", display_channel, - second); - xfce_randr_apply (xfce_randr, "MinimalAutoConfig", display_channel); - } - - gtk_main_quit (); -} - - - gint main (gint argc, gchar **argv) { @@ -1235,7 +1151,6 @@ main (gint argc, gchar **argv) GError *error = NULL; gboolean succeeded = TRUE; gint event_base, error_base; - guint first, second; gchar *command; const gchar *alternative = NULL; const gchar *alternative_icon = NULL; @@ -1407,45 +1322,15 @@ main (gint argc, gchar **argv) if (xfce_randr->noutput < 2) goto cleanup; - /* TODO: handle correctly more than 2 outputs? */ - first = 0; - second = 1; - builder = gtk_builder_new (); if (gtk_builder_add_from_string (builder, minimal_display_dialog_ui, minimal_display_dialog_ui_length, &error) != 0) { - GObject *first_screen_radio; - GObject *second_screen_radio; - gchar *screen_name; /* Build the minimal dialog */ - dialog = (GtkWidget *) gtk_builder_get_object (builder, "dialog1"); - g_signal_connect (G_OBJECT (dialog), "response", - G_CALLBACK (display_settings_minimal_dialog_response), builder); - - /* Set the radio buttons captions */ - first_screen_radio = - gtk_builder_get_object (builder, "radiobutton1"); - second_screen_radio = - gtk_builder_get_object (builder, "radiobutton2"); - - screen_name = - xfce_randr_friendly_name (xfce_randr, - xfce_randr->resources->outputs[first], - xfce_randr->output_info[first]->name); - gtk_button_set_label (GTK_BUTTON (first_screen_radio), - screen_name); - g_free (screen_name); - - screen_name = - xfce_randr_friendly_name (xfce_randr, - xfce_randr->resources->outputs[second], - xfce_randr->output_info[second]->name); - gtk_button_set_label (GTK_BUTTON (second_screen_radio), - screen_name); - g_free (screen_name); + dialog = (GtkWidget *) gtk_builder_get_object (builder, "dialog"); + g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_main_quit), NULL); /* Show the minimal dialog and start the main loop */ gtk_window_present (GTK_WINDOW (dialog)); diff --git a/dialogs/display-settings/minimal-display-dialog.glade b/dialogs/display-settings/minimal-display-dialog.glade index 206534e..3b818ab 100644 --- a/dialogs/display-settings/minimal-display-dialog.glade +++ b/dialogs/display-settings/minimal-display-dialog.glade @@ -2,7 +2,7 @@ <interface> <requires lib="gtk+" version="2.24"/> <!-- interface-naming-policy project-wide --> - <object class="GtkWindow" id="window1"> + <object class="GtkWindow" id="dialog"> <property name="can_focus">False</property> <property name="title" translatable="yes">Displays</property> <property name="resizable">False</property> @@ -24,7 +24,7 @@ <property name="column_spacing">48</property> <property name="row_spacing">3</property> <child> - <object class="GtkButton" id="button1"> + <object class="GtkToggleButton" id="extend_left"> <property name="width_request">128</property> <property name="height_request">128</property> <property name="visible">True</property> @@ -45,7 +45,7 @@ </packing> </child> <child> - <object class="GtkButton" id="button2"> + <object class="GtkToggleButton" id="mirror"> <property name="width_request">128</property> <property name="height_request">128</property> <property name="visible">True</property> @@ -68,7 +68,7 @@ </packing> </child> <child> - <object class="GtkButton" id="button3"> + <object class="GtkToggleButton" id="extend_right"> <property name="width_request">128</property> <property name="height_request">128</property> <property name="visible">True</property> @@ -145,7 +145,7 @@ <property name="visible">True</property> <property name="can_focus">False</property> <child> - <object class="GtkCheckButton" id="checkbutton1"> + <object class="GtkCheckButton" id="presentation_mode"> <property name="label" translatable="yes">Presentation Mode</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -160,7 +160,7 @@ </packing> </child> <child> - <object class="GtkButton" id="button5"> + <object class="GtkButton" id="cancel_button"> <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> @@ -175,7 +175,7 @@ </packing> </child> <child> - <object class="GtkButton" id="button4"> + <object class="GtkButton" id="advanced_button"> <property name="label" translatable="yes">Advanced</property> <property name="visible">True</property> <property name="can_focus">True</property> _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits