Make wallpaper choose in Desktop Preferences inactive in color-only mode.
authorAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 27 Dec 2013 15:06:24 +0000 (17:06 +0200)
committerAndriy Grytsenko <andrej@rep.kiev.ua>
Fri, 27 Dec 2013 15:06:24 +0000 (17:06 +0200)
data/ui/desktop-pref.glade
src/desktop.c

index 92474d0..2e1f9f3 100644 (file)
                             <property name="can_focus">False</property>
                             <property name="spacing">6</property>
                             <child>
-                              <object class="GtkHBox" id="hbox3">
+                              <object class="GtkHBox" id="hbox2">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="spacing">12</property>
                                 <child>
-                                  <object class="GtkLabel" id="label3">
+                                  <object class="GtkLabel" id="label4">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">_Wallpaper:</property>
+                                    <property name="label" translatable="yes">Wallpaper _mode:</property>
                                     <property name="use_underline">True</property>
-                                    <property name="mnemonic_widget">wallpaper</property>
+                                    <property name="mnemonic_widget">wallpaper_mode</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkFileChooserButton" id="wallpaper">
+                                  <object class="GtkComboBox" id="wallpaper_mode">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="title" translatable="yes">Please select an image file</property>
-                                    <property name="width_chars">40</property>
+                                    <property name="model">wp_modes</property>
+                                    <child>
+                                      <object class="GtkCellRendererText" id="cellrenderertext1"/>
+                                      <attributes>
+                                        <attribute name="text">0</attribute>
+                                      </attributes>
+                                    </child>
                                   </object>
                                   <packing>
                                     <property name="expand">True</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkAlignment" id="alignment5">
+                              <object class="GtkVBox" id="wallpaper_box">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="left_padding">24</property>
+                                <property name="spacing">6</property>
                                 <child>
-                                  <object class="GtkCheckButton" id="wallpaper_common">
-                                    <property name="label" translatable="yes">_Use the same wallpaper on all desktops</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>
-                                </child>
-                              </object>
-                              <packing>
-                                <property name="expand">False</property>
-                                <property name="fill">True</property>
-                                <property name="position">1</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <object class="GtkHBox" id="hbox1">
-                                <property name="visible">True</property>
-                                <property name="can_focus">False</property>
-                                <property name="spacing">12</property>
-                                <child>
-                                  <object class="GtkLabel" id="label10">
+                                  <object class="GtkHBox" id="hbox3">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">_Background color:</property>
-                                    <property name="use_underline">True</property>
-                                    <property name="mnemonic_widget">desktop_bg</property>
+                                    <property name="spacing">12</property>
+                                    <child>
+                                      <object class="GtkLabel" id="label3">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="xalign">0</property>
+                                        <property name="label" translatable="yes">_Wallpaper:</property>
+                                        <property name="use_underline">True</property>
+                                        <property name="mnemonic_widget">wallpaper</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">0</property>
+                                      </packing>
+                                    </child>
+                                    <child>
+                                      <object class="GtkFileChooserButton" id="wallpaper">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="title" translatable="yes">Please select an image file</property>
+                                        <property name="width_chars">40</property>
+                                      </object>
+                                      <packing>
+                                        <property name="expand">True</property>
+                                        <property name="fill">True</property>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkColorButton" id="desktop_bg">
+                                  <object class="GtkAlignment" id="alignment5">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">True</property>
-                                    <property name="use_action_appearance">False</property>
-                                    <property name="color">#000000000000</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="left_padding">24</property>
+                                    <child>
+                                      <object class="GtkCheckButton" id="wallpaper_common">
+                                        <property name="label" translatable="yes">_Use the same wallpaper on all desktops</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>
+                                    </child>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
                                 </child>
                               </object>
                               <packing>
-                                <property name="expand">True</property>
+                                <property name="expand">False</property>
                                 <property name="fill">True</property>
-                                <property name="position">2</property>
+                                <property name="position">1</property>
                               </packing>
                             </child>
                             <child>
-                              <object class="GtkHBox" id="hbox2">
+                              <object class="GtkHBox" id="hbox1">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
                                 <property name="spacing">12</property>
                                 <child>
-                                  <object class="GtkLabel" id="label4">
+                                  <object class="GtkLabel" id="label10">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <property name="xalign">0</property>
-                                    <property name="label" translatable="yes">Wallpaper _mode:</property>
+                                    <property name="label" translatable="yes">_Background color:</property>
                                     <property name="use_underline">True</property>
-                                    <property name="mnemonic_widget">wallpaper_mode</property>
+                                    <property name="mnemonic_widget">desktop_bg</property>
                                   </object>
                                   <packing>
                                     <property name="expand">False</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <object class="GtkComboBox" id="wallpaper_mode">
+                                  <object class="GtkColorButton" id="desktop_bg">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="model">wp_modes</property>
-                                    <child>
-                                      <object class="GtkCellRendererText" id="cellrenderertext1"/>
-                                      <attributes>
-                                        <attribute name="text">0</attribute>
-                                      </attributes>
-                                    </child>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <property name="use_action_appearance">False</property>
+                                    <property name="color">#000000000000</property>
                                   </object>
                                   <packing>
-                                    <property name="expand">True</property>
+                                    <property name="expand">False</property>
                                     <property name="fill">True</property>
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
                               </object>
                               <packing>
-                                <property name="expand">False</property>
+                                <property name="expand">True</property>
                                 <property name="fill">True</property>
-                                <property name="position">3</property>
+                                <property name="position">2</property>
                               </packing>
                             </child>
                           </object>
index 483e8fd..f7e5b90 100644 (file)
@@ -4356,6 +4356,14 @@ static void on_wallpaper_mode_changed(GtkComboBox* combo, FmDesktop *desktop)
     }
 }
 
+static void on_wallpaper_mode_changed2(GtkComboBox *combo, GtkWidget *wallpaper_box)
+{
+    /* update the box */
+    if (wallpaper_box)
+        gtk_widget_set_sensitive(wallpaper_box,
+                                 gtk_combo_box_get_active(combo) != FM_WP_COLOR);
+}
+
 static void on_bg_color_set(GtkColorButton *btn, FmDesktop *desktop)
 {
     GdkColor new_val;
@@ -4539,6 +4547,15 @@ void fm_desktop_preference(GtkAction *act, FmDesktop *desktop)
         item = gtk_builder_get_object(builder, "wallpaper_mode");
         gtk_combo_box_set_active(GTK_COMBO_BOX(item), desktop->conf.wallpaper_mode);
         g_signal_connect(item, "changed", G_CALLBACK(on_wallpaper_mode_changed), desktop);
+        item = gtk_builder_get_object(builder, "wallpaper_box");
+        if (item)
+        {
+            g_signal_connect(gtk_builder_get_object(builder, "wallpaper_mode"),
+                             "changed", G_CALLBACK(on_wallpaper_mode_changed2),
+                             item);
+            gtk_widget_set_sensitive(GTK_WIDGET(item),
+                                     desktop->conf.wallpaper_mode != FM_WP_COLOR);
+        }
         item = gtk_builder_get_object(builder, "desktop_bg");
         gtk_color_button_set_color(GTK_COLOR_BUTTON(item), &desktop->conf.desktop_bg);
         g_signal_connect(item, "color-set", G_CALLBACK(on_bg_color_set), desktop);