[Xfce4-commits] <xfce4-settings:bluesabre/display-settings> Correctly install and load icons for minimal dialog (thanks Lionel!)

Simon Steinbeiss noreply at xfce.org
Sat Oct 27 17:02:01 CEST 2012


Updating branch refs/heads/bluesabre/display-settings
         to 0efdd446fcd218233d322a9ad2356a352996baed (commit)
       from 6cd2472b23aefe6b83423e1d2188a3e9e382bcae (commit)

commit 0efdd446fcd218233d322a9ad2356a352996baed
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Sat Oct 27 17:00:51 2012 +0200

    Correctly install and load icons for minimal dialog (thanks Lionel!)

 dialogs/display-settings/Makefile.am               |    8 ++++++
 dialogs/display-settings/main.c                    |   24 ++++++++++++++++++++
 .../display-settings/minimal-display-dialog.glade  |    4 ---
 3 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/dialogs/display-settings/Makefile.am b/dialogs/display-settings/Makefile.am
index 86137d9..2a5abc2 100644
--- a/dialogs/display-settings/Makefile.am
+++ b/dialogs/display-settings/Makefile.am
@@ -73,7 +73,15 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 
 @INTLTOOL_DESKTOP_RULE@
 
+iconsdir = $(datadir)/icons/hicolor/128x128/devices
+icons_DATA = \
+	xfce-display-extend.png \
+	xfce-display-external.png \
+	xfce-display-internal.png \
+	xfce-display-mirror.png
+
 EXTRA_DIST = \
+	$(icons_DATA) \
 	$(desktop_in_files) \
 	confirmation-dialog.glade \
 	display-dialog.glade \
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 92b0e34..3bc1d67 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1781,6 +1781,25 @@ display_settings_minimal_advanced_clicked (GtkButton  *button,
 }
 
 static void
+display_settings_minimal_load_icon (GtkBuilder  *builder,
+                                    const gchar *img_name,
+                                    const gchar *icon_name)
+{
+    GObject      *dialog;
+    GtkImage     *img;
+    GtkIconTheme *icon_theme;
+    GdkPixbuf    *icon;
+
+    dialog = gtk_builder_get_object (builder, "dialog");
+    img = GTK_IMAGE (gtk_builder_get_object (builder, img_name));
+    g_return_if_fail (dialog && img);
+
+    icon_theme = gtk_icon_theme_get_for_screen (gtk_window_get_screen (GTK_WINDOW (dialog)));
+    icon = gtk_icon_theme_load_icon (icon_theme, icon_name, 128, 0, NULL);
+    gtk_image_set_from_pixbuf (GTK_IMAGE (img), icon);
+}
+
+static void
 display_settings_show_minimal_dialog (GdkDisplay *display)
 {
     GtkBuilder *builder;
@@ -1801,6 +1820,11 @@ display_settings_show_minimal_dialog (GdkDisplay *display)
         g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_main_quit), NULL);
         g_signal_connect (cancel, "clicked", G_CALLBACK (gtk_main_quit), NULL);
 
+        display_settings_minimal_load_icon (builder, "image1", "xfce-display-internal");
+        display_settings_minimal_load_icon (builder, "image2", "xfce-display-mirror");
+        display_settings_minimal_load_icon (builder, "image3", "xfce-display-extend");
+        display_settings_minimal_load_icon (builder, "image4", "xfce-display-external");
+
         only_display1 = gtk_builder_get_object (builder, "display1");
         mirror_displays = gtk_builder_get_object (builder, "mirror");
         extend_right = gtk_builder_get_object (builder, "extend_right");
diff --git a/dialogs/display-settings/minimal-display-dialog.glade b/dialogs/display-settings/minimal-display-dialog.glade
index 888d855..3b04070 100644
--- a/dialogs/display-settings/minimal-display-dialog.glade
+++ b/dialogs/display-settings/minimal-display-dialog.glade
@@ -94,7 +94,6 @@
                   <object class="GtkImage" id="image1">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="pixbuf">display1.png</property>
                   </object>
                 </child>
               </object>
@@ -118,7 +117,6 @@
                   <object class="GtkImage" id="image2">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="pixbuf">mirror.png</property>
                   </object>
                 </child>
               </object>
@@ -144,7 +142,6 @@
                   <object class="GtkImage" id="image3">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="pixbuf">extend-right.png</property>
                   </object>
                 </child>
               </object>
@@ -170,7 +167,6 @@
                   <object class="GtkImage" id="image4">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="pixbuf">display2.png</property>
                   </object>
                 </child>
               </object>


More information about the Xfce4-commits mailing list