Commits

Anonymous committed b625aed

Adding "Minimize on close" option

  • Participants
  • Parent commits c15521e

Comments (0)

Files changed (4)

File data/preferenes_dialog.ui

                             <property name="position">0</property>
                           </packing>
                         </child>
+
                         <child>
                           <object class="GtkCheckButton" id="checkbutton1">
                             <property name="label" translatable="yes">Quit application without confirmation</property>
                           </packing>
                         </child>
                         <child>
+                          <object class="GtkCheckButton" id="checkbutton5">
+                            <property name="label" translatable="yes">Minimize on close</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="draw_indicator">True</property>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="position">2</property>
+                          </packing>
+                        </child>
+                        <child>
                           <object class="GtkCheckButton" id="checkbutton4">
                             <property name="label" translatable="yes">Check for updates on startup</property>
                             <property name="visible">True</property>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">True</property>
-                            <property name="position">2</property>
+                            <property name="position">3</property>
                           </packing>
                         </child>
                         <child>

File lib/SharkDown.py

 
         # Main window and widgets initialization
         self.window = builder.get_object('mainwindow')
-        self.window.connect("delete-event", self.window.hide_on_delete)
+        self.window.connect("delete-event", self.on_hide_window)
         self.mainmenu = builder.get_object('mainmenu')
 
         self.vbox_results = builder.get_object('vbox_results')
             SongCoverThread.cancel_downloads.set()
             gtk.main_quit()
 
+    def on_hide_window(self, widget, data = None):
+        if config()['minimize_on_close'] == '1':
+            self.window.hide()
+        else:
+            self.on_quit_app(widget, data)
+        return True
+
     def on_copy_song(self, widget, data = None):
         """
         Copy the selected song name from the results list in the

File lib/enviroment.py

             'proxy_user': '',
             'proxy_pass': '',
             'cover_cache_limit': 16 * 1024 * 1024,
+            'minimize_on_close' : 0,
         }
 
     def _safe_create_dirs(self, dirs):

File lib/guihelpers.py

         self.quit_without_confirmation = builder.get_object("checkbutton1")
         self.quit_without_confirmation.set_active(int(config()['quit_without_confirmation']))
         self.bubble = builder.get_object("checkbutton2")
+        self.minimize_on_close = builder.get_object("checkbutton5")
+        self.minimize_on_close.set_active(int(config()['minimize_on_close']))
         self.speed = builder.get_object("spinbutton1")
         self.speed.set_value(int(config()['speed_limit']))
         self.file_pattern = builder.get_object("entry1")
         else:
             config()['quit_without_confirmation'] = '0'
 
+        if self.minimize_on_close.get_active():
+            config()['minimize_on_close'] = '1'
+        else:
+            config()['minimize_on_close'] = '0'
+
         if self.bubble.get_active():
             config()['show_notification'] = 1
         else: