gget r28 - in trunk: data gget



Author: johans
Date: Fri Jul 11 21:51:12 2008
New Revision: 28
URL: http://svn.gnome.org/viewvc/gget?rev=28&view=rev

Log:
Made it configurable whether to show notifications on completed downloads.

Modified:
   trunk/data/gget.glade
   trunk/gget/Configuration.py
   trunk/gget/Download.py
   trunk/gget/PreferencesDialog.py

Modified: trunk/data/gget.glade
==============================================================================
--- trunk/data/gget.glade	(original)
+++ trunk/data/gget.glade	Fri Jul 11 21:51:12 2008
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Wed Jul  9 16:13:04 2008 -->
+<!--Generated with glade3 3.4.5 on Fri Jul 11 23:36:25 2008 -->
 <glade-interface>
   <widget class="GtkWindow" id="main_window">
     <property name="width_request">800</property>
@@ -306,16 +306,25 @@
                     <property name="column_spacing">12</property>
                     <property name="row_spacing">6</property>
                     <child>
-                      <widget class="GtkFileChooserButton" id="download_filechooserbutton">
+                      <widget class="GtkLabel" id="label3">
                         <property name="visible">True</property>
-                        <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
-                        <property name="title" translatable="yes">Select download folder</property>
+                        <property name="xalign">1</property>
+                        <property name="label" translatable="yes">_URL:</property>
+                        <property name="use_underline">True</property>
+                        <property name="mnemonic_widget">url_entry</property>
+                      </widget>
+                      <packing>
+                        <property name="x_options">GTK_FILL</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkEntry" id="url_entry">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
                       </widget>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                        <property name="top_attach">1</property>
-                        <property name="bottom_attach">2</property>
                       </packing>
                     </child>
                     <child>
@@ -333,25 +342,16 @@
                       </packing>
                     </child>
                     <child>
-                      <widget class="GtkEntry" id="url_entry">
+                      <widget class="GtkFileChooserButton" id="download_filechooserbutton">
                         <property name="visible">True</property>
-                        <property name="can_focus">True</property>
+                        <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
+                        <property name="title" translatable="yes">Select download folder</property>
                       </widget>
                       <packing>
                         <property name="left_attach">1</property>
                         <property name="right_attach">2</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkLabel" id="label3">
-                        <property name="visible">True</property>
-                        <property name="xalign">1</property>
-                        <property name="label" translatable="yes">_URL:</property>
-                        <property name="use_underline">True</property>
-                        <property name="mnemonic_widget">url_entry</property>
-                      </widget>
-                      <packing>
-                        <property name="x_options">GTK_FILL</property>
+                        <property name="top_attach">1</property>
+                        <property name="bottom_attach">2</property>
                       </packing>
                     </child>
                   </widget>
@@ -467,6 +467,18 @@
                                     <property name="position">1</property>
                                   </packing>
                                 </child>
+                                <child>
+                                  <widget class="GtkCheckButton" id="notifications_checkbutton">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="label" translatable="yes">Notifications on completed downloads</property>
+                                    <property name="response_id">0</property>
+                                    <property name="draw_indicator">True</property>
+                                  </widget>
+                                  <packing>
+                                    <property name="position">2</property>
+                                  </packing>
+                                </child>
                               </widget>
                             </child>
                           </widget>
@@ -624,8 +636,8 @@
                                           <widget class="GtkFileChooserButton" id="default_folder_filechooserbutton">
                                             <property name="visible">True</property>
                                             <property name="sensitive">False</property>
-                                            <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
                                             <property name="local_only">False</property>
+                                            <property name="action">GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER</property>
                                             <property name="title" translatable="yes">Select download folder</property>
                                           </widget>
                                         </child>

Modified: trunk/gget/Configuration.py
==============================================================================
--- trunk/gget/Configuration.py	(original)
+++ trunk/gget/Configuration.py	Fri Jul 11 21:51:12 2008
@@ -30,22 +30,23 @@
 DIR_GNOME      = "/desktop/gnome"
 DIR_PROXY      = "/system/proxy"
 
-KEY_SHOW_STATUSBAR    = "/general/show_statusbar"
-KEY_SHOW_TOOLBAR      = "/general/show_toolbar"
-KEY_SHOW_STATUS_ICON  = "/general/show_status_icon"
-KEY_SHOW_MAIN_WINDOW  = "/general/show_main_window"
-KEY_AUTOSTART         = "/general/autostart"
-KEY_AUTORESUME        = "/general/autoresume"
-KEY_WINDOW_WIDTH      = "/general/window_width"
-KEY_WINDOW_HEIGHT     = "/general/window_height"
-KEY_WINDOW_POSITION_X = "/general/window_position_x"
-KEY_WINDOW_POSITION_Y = "/general/window_position_y"
-KEY_SHOW_STATUS       = "/general/show_status"
-KEY_SHOW_CURRENT_SIZE = "/general/show_current_size"
-KEY_SHOW_TOTAL_SIZE   = "/general/show_total_size"
-KEY_SHOW_PROGRESS     = "/general/show_progress"
-KEY_SHOW_SPEED        = "/general/show_speed"
-KEY_SHOW_ETA          = "/general/show_eta"
+KEY_SHOW_STATUSBAR     = "/general/show_statusbar"
+KEY_SHOW_TOOLBAR       = "/general/show_toolbar"
+KEY_SHOW_STATUS_ICON   = "/general/show_status_icon"
+KEY_SHOW_MAIN_WINDOW   = "/general/show_main_window"
+KEY_SHOW_NOTIFICATIONS = "/general/show_notifications"
+KEY_AUTOSTART          = "/general/autostart"
+KEY_AUTORESUME         = "/general/autoresume"
+KEY_WINDOW_WIDTH       = "/general/window_width"
+KEY_WINDOW_HEIGHT      = "/general/window_height"
+KEY_WINDOW_POSITION_X  = "/general/window_position_x"
+KEY_WINDOW_POSITION_Y  = "/general/window_position_y"
+KEY_SHOW_STATUS        = "/general/show_status"
+KEY_SHOW_CURRENT_SIZE  = "/general/show_current_size"
+KEY_SHOW_TOTAL_SIZE    = "/general/show_total_size"
+KEY_SHOW_PROGRESS      = "/general/show_progress"
+KEY_SHOW_SPEED         = "/general/show_speed"
+KEY_SHOW_ETA           = "/general/show_eta"
 
 KEY_ASK_FOR_LOCATION  = "/folders/ask_for_location"
 KEY_DEFAULT_FOLDER    = "/folders/default_folder"
@@ -53,12 +54,12 @@
 KEY_EXTENSIONS        = "/folders/extensions"
 KEY_EXTENSION_FOLDERS = "/folders/extension_folders"
 
-KEY_PROXY_MODE        = "/network/proxy_mode"
-KEY_PROXY_HOST        = "/network/proxy_host"
-KEY_PROXY_PORT        = "/network/proxy_port"
-KEY_PROXY_AUTH        = "/network/proxy_auth"
-KEY_PROXY_USER        = "/network/proxy_user"
-KEY_PROXY_PASSWORD    = "/network/proxy_password"
+KEY_PROXY_MODE     = "/network/proxy_mode"
+KEY_PROXY_HOST     = "/network/proxy_host"
+KEY_PROXY_PORT     = "/network/proxy_port"
+KEY_PROXY_AUTH     = "/network/proxy_auth"
+KEY_PROXY_USER     = "/network/proxy_user"
+KEY_PROXY_PASSWORD = "/network/proxy_password"
 
 KEY_TOOLBAR_STYLE              = "/interface/toolbar_style"
 
@@ -75,22 +76,23 @@
 KEY_PROXY_FTP_HOST             = "/system/proxy/ftp_host"
 KEY_PROXY_FTP_PORT             = "/system/proxy/ftp_port"
 
-FUNCTION_SUFFIXES = {KEY_SHOW_TOOLBAR:      'bool',
-                     KEY_SHOW_STATUSBAR:    'bool',
-                     KEY_SHOW_STATUS_ICON:  'bool',
-                     KEY_SHOW_MAIN_WINDOW:  'bool',
-                     KEY_AUTOSTART:         'bool',
-                     KEY_AUTORESUME:        'bool',
-                     KEY_WINDOW_WIDTH:      'int',
-                     KEY_WINDOW_HEIGHT:     'int',
-                     KEY_WINDOW_POSITION_X: 'int',
-                     KEY_WINDOW_POSITION_Y: 'int',
-                     KEY_SHOW_STATUS:       'bool',
-                     KEY_SHOW_CURRENT_SIZE: 'bool',
-                     KEY_SHOW_TOTAL_SIZE:   'bool',
-                     KEY_SHOW_PROGRESS:     'bool',
-                     KEY_SHOW_SPEED:        'bool',
-                     KEY_SHOW_ETA:          'bool',
+FUNCTION_SUFFIXES = {KEY_SHOW_TOOLBAR:       'bool',
+                     KEY_SHOW_STATUSBAR:     'bool',
+                     KEY_SHOW_STATUS_ICON:   'bool',
+                     KEY_SHOW_MAIN_WINDOW:   'bool',
+                     KEY_SHOW_NOTIFICATIONS: 'bool',
+                     KEY_AUTOSTART:          'bool',
+                     KEY_AUTORESUME:         'bool',
+                     KEY_WINDOW_WIDTH:       'int',
+                     KEY_WINDOW_HEIGHT:      'int',
+                     KEY_WINDOW_POSITION_X:  'int',
+                     KEY_WINDOW_POSITION_Y:  'int',
+                     KEY_SHOW_STATUS:        'bool',
+                     KEY_SHOW_CURRENT_SIZE:  'bool',
+                     KEY_SHOW_TOTAL_SIZE:    'bool',
+                     KEY_SHOW_PROGRESS:      'bool',
+                     KEY_SHOW_SPEED:         'bool',
+                     KEY_SHOW_ETA:           'bool',
 
                      KEY_ASK_FOR_LOCATION:  'bool',
                      KEY_DEFAULT_FOLDER:    'string',
@@ -205,6 +207,16 @@
 
     show_main_window = property(get_show_main_window, set_show_main_window)
 
+    # Show Notifications
+    def get_show_notifications(self):
+        return self.__get_option(KEY_SHOW_NOTIFICATIONS)
+
+    def set_show_notifications(self, show_notifications):
+        self.__set_option(KEY_SHOW_NOTIFICATIONS, show_notifications)
+
+    show_notifications = property(get_show_notifications,
+            set_show_notifications)
+
     # Autostart
     def get_autostart(self):
         return self.__get_option(KEY_AUTOSTART)

Modified: trunk/gget/Download.py
==============================================================================
--- trunk/gget/Download.py	(original)
+++ trunk/gget/Download.py	Fri Jul 11 21:51:12 2008
@@ -138,6 +138,7 @@
 
     def __status_changed(self, download, status):
         if status == COMPLETED:
-            Notification(download)
+            if self.config.show_notifications:
+                Notification(download)
 
 # vim: set sw=4 et sts=4 tw=79 fo+=l:

Modified: trunk/gget/PreferencesDialog.py
==============================================================================
--- trunk/gget/PreferencesDialog.py	(original)
+++ trunk/gget/PreferencesDialog.py	Fri Jul 11 21:51:12 2008
@@ -88,6 +88,7 @@
         # General tab
         self.status_icon_checkbutton = xml.get_widget("status_icon_checkbutton")
         self.main_window_checkbutton = xml.get_widget("main_window_checkbutton")
+        self.notifications_checkbutton = xml.get_widget("notifications_checkbutton")
 
         self.autostart_checkbutton = xml.get_widget("autostart_checkbutton")
         self.autoresume_checkbutton = xml.get_widget("autoresume_checkbutton")
@@ -174,6 +175,8 @@
                 self.__status_icon_checkbutton_toggled)
         self.main_window_checkbutton.connect("toggled",
                 self.__main_window_checkbutton_toggled)
+        self.notifications_checkbutton.connect("toggled",
+                self.__notifications_checkbutton_toggled)
 
         self.autostart_checkbutton.connect("toggled",
                 self.__autostart_checkbutton_toggled)
@@ -224,6 +227,8 @@
                 self.__show_status_icon_key_changed)
         self.config.add_notify(Configuration.KEY_SHOW_MAIN_WINDOW,
                 self.__show_main_window_key_changed)
+        self.config.add_notify(Configuration.KEY_SHOW_NOTIFICATIONS,
+                self.__show_notifications_key_changed)
         self.config.add_notify(Configuration.KEY_AUTOSTART,
                 self.__autostart_key_changed)
         self.config.add_notify(Configuration.KEY_AUTORESUME,
@@ -273,6 +278,14 @@
         else:
             self.main_window_checkbutton.set_active(True)
 
+    def __show_notifications_key_changed(self, client, cnxn_id, entry, data):
+        if not entry.value:
+            self.notifications_checkbutton.set_active(True)
+        elif entry.value.type == gconf.VALUE_BOOL:
+            self.notifications_checkbutton.set_active(entry.value.get_bool())
+        else:
+            self.notifications_checkbutton.set_active(True)
+
     def __autostart_key_changed(self, client, cnxn_id, entry, data):
         if not entry.value:
             self.autostart_checkbutton.set_active(True)
@@ -383,6 +396,9 @@
     def __main_window_checkbutton_toggled(self, checkbutton):
         self.config.show_main_window = checkbutton.get_active()
 
+    def __notifications_checkbutton_toggled(self, checkbutton):
+        self.config.show_notifications = checkbutton.get_active()
+
     def __autostart_checkbutton_toggled(self, checkbutton):
         self.config.autostart = checkbutton.get_active()
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]