[Xfce4-commits] <xfce4-settings:bluesabre/display-settings2> Identify Displays button

Sean Davis noreply at xfce.org
Sat Jan 25 20:06:04 CET 2014


Updating branch refs/heads/bluesabre/display-settings2
         to 18af539c96d36b5464901b12f528768478b898fd (commit)
       from 3c2a9784feea5f9cd549e5b5b1167aad453eb839 (commit)

commit 18af539c96d36b5464901b12f528768478b898fd
Author: Sean Davis <smd.seandavis at gmail.com>
Date:   Wed Dec 11 02:36:52 2013 +0000

    Identify Displays button
    
    Signed-off-by: Sean Davis <smd.seandavis at gmail.com>

 dialogs/display-settings/display-dialog.glade |   40 +++++++++++---
 dialogs/display-settings/main.c               |   71 ++++++++++++++-----------
 2 files changed, 74 insertions(+), 37 deletions(-)

diff --git a/dialogs/display-settings/display-dialog.glade b/dialogs/display-settings/display-dialog.glade
index b4bbd80..db7fcef 100644
--- a/dialogs/display-settings/display-dialog.glade
+++ b/dialogs/display-settings/display-dialog.glade
@@ -273,14 +273,40 @@
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
                 <child>
-                  <object class="GtkCheckButton" id="minimal-autoshow">
-                    <property name="label" translatable="yes">Configure _new displays when connected</property>
+                  <object class="GtkHBox" id="hbox2">
                     <property name="visible">True</property>
-                    <property name="can_focus">True</property>
-                    <property name="receives_default">False</property>
-                    <property name="use_action_appearance">False</property>
-                    <property name="use_underline">True</property>
-                    <property name="draw_indicator">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkCheckButton" id="minimal-autoshow">
+                        <property name="label" translatable="yes">Configure _new displays when connected</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">False</property>
+                        <property name="use_action_appearance">False</property>
+                        <property name="use_underline">True</property>
+                        <property name="draw_indicator">True</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkToggleButton" id="identify-displays">
+                        <property name="label" translatable="yes">Identify Displays</property>
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="receives_default">True</property>
+                        <property name="use_action_appearance">False</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="pack_type">end</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
                   </object>
                 </child>
               </object>
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 8c706db..b48c9e9 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -154,6 +154,7 @@ static gint randr_event_base;
 
 /* Used to identify the display */
 static GHashTable *display_popups;
+gboolean show_popups = FALSE;
 
 gboolean supports_alpha = FALSE;
 
@@ -1440,6 +1441,42 @@ display_settings_dialog_response (GtkDialog  *dialog,
         gtk_main_quit ();
 }
 
+static void
+set_display_popups_visible(gboolean visible)
+{
+    GHashTableIter iter;
+    gpointer key, value;
+    GtkWidget *popup;
+
+    g_hash_table_iter_init (&iter, display_popups);
+    while (g_hash_table_iter_next (&iter, &key, &value))
+    {
+        popup = (GtkWidget *) value;
+        gtk_widget_set_visible(popup, visible);
+    }
+}
+
+static gboolean
+focus_out_event (GtkWidget *widget, GdkEventFocus *event, gpointer data)
+{
+    set_display_popups_visible(FALSE);
+    return TRUE;
+}
+
+static gboolean
+focus_in_event (GtkWidget *widget, GdkEventFocus *event, gpointer data)
+{
+    set_display_popups_visible(TRUE && show_popups);
+    return TRUE;
+}
+
+static void
+on_identify_displays_toggled (GtkWidget *widget, GtkBuilder *builder)
+{
+    show_popups = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
+    set_display_popups_visible (show_popups);
+}
+
 
 
 static GtkWidget *
@@ -1449,7 +1486,7 @@ display_settings_dialog_new (GtkBuilder *builder)
     GtkCellRenderer  *renderer;
     GtkTreeSelection *selection;
     GObject          *combobox;
-    GObject          *label, *check, *mirror;
+    GObject          *label, *check, *mirror, *identify;
 
     /* Get the treeview */
     treeview = gtk_builder_get_object (builder, "randr-outputs");
@@ -1467,6 +1504,9 @@ display_settings_dialog_new (GtkBuilder *builder)
 
     /* Identification popups */
     display_setting_identity_popups_populate ();
+    identify = gtk_builder_get_object (builder, "identify-displays");
+    g_signal_connect (G_OBJECT (identify), "toggled", G_CALLBACK (on_identify_displays_toggled), builder);
+    set_display_popups_visible (show_popups);
 
     /* Treeview selection */
     selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview));
@@ -1707,35 +1747,6 @@ screen_on_event (GdkXEvent *xevent,
 }
 
 static void
-set_display_popups_visible(gboolean visible)
-{
-    GHashTableIter iter;
-    gpointer key, value;
-    GtkWidget *popup;
-
-    g_hash_table_iter_init (&iter, display_popups);
-    while (g_hash_table_iter_next (&iter, &key, &value))
-    {
-        popup = (GtkWidget *) value;
-        gtk_widget_set_visible(popup, visible);
-    }
-}
-
-static gboolean
-focus_out_event (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
-    set_display_popups_visible(FALSE);
-    return TRUE;
-}
-
-static gboolean
-focus_in_event (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
-    set_display_popups_visible(TRUE);
-    return TRUE;
-}
-
-static void
 display_settings_show_main_dialog (GdkDisplay *display)
 {
     GtkBuilder  *builder;


More information about the Xfce4-commits mailing list