diff --git a/data/wicd.glade b/data/wicd.glade index 0fe8d7a..9d39ce3 100644 --- a/data/wicd.glade +++ b/data/wicd.glade @@ -1,25 +1,23 @@ - - - + + + 450 400 True Wicd Network Manager - GTK_WIN_POS_CENTER + center 550 - GDK_GRAVITY_CENTER - - + center True True - GTK_TOOLBAR_BOTH_HORIZ - GTK_ICON_SIZE_MENU + both-horiz + 0 True @@ -31,8 +29,8 @@ True + gtk-network True - gtk-network True True @@ -40,31 +38,21 @@ True + Create an ad-hoc network True - Create an ad-hoc network True + True - - - True - gtk-add - - + Find a hidden network True Enter a hidden network to try to locate. - Find a hidden network True + True - - - True - network-wireless - - @@ -74,6 +62,9 @@ + + False + @@ -86,6 +77,7 @@ + False True @@ -99,6 +91,7 @@ + False True @@ -112,6 +105,7 @@ + False True @@ -125,6 +119,7 @@ + False True @@ -139,12 +134,14 @@ + False True False + 0 @@ -165,12 +162,12 @@ True False - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC + automatic + automatic True - GTK_SHADOW_NONE + none True @@ -198,15 +195,17 @@ 3 + 0 - True - Cancel the current connection attempt gtk-cancel + True + False + False + Cancel the current connection attempt True - 0 @@ -238,8 +237,8 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK 5 Configure Scripts - GTK_WIN_POS_CENTER_ON_PARENT - GDK_WINDOW_TYPE_HINT_DIALOG + center-on-parent + dialog False @@ -259,6 +258,7 @@ False False + 0 @@ -272,6 +272,9 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Pre-connection Script: + + 0 + @@ -302,6 +305,9 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Post-connection Script: + + 0 + @@ -332,6 +338,9 @@ GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK Disconnection Script: + + 0 + @@ -359,32 +368,41 @@ True - GTK_BUTTONBOX_END + end + gtk-cancel True True - gtk-cancel + False True - 0 + + False + False + 0 + + gtk-ok + 1 True True - gtk-ok + False True - 1 + False + False 1 False - GTK_PACK_END + end + 0 @@ -392,8 +410,8 @@ 5 - GTK_WIN_POS_CENTER_ON_PARENT - GDK_WINDOW_TYPE_HINT_DIALOG + center-on-parent + dialog False @@ -414,17 +432,17 @@ True True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC + automatic + automatic True - GTK_RESIZE_QUEUE - GTK_SHADOW_NONE + queue + none True - 18 + 20 2 4 4 @@ -433,14 +451,14 @@ True + Always switch to a wired connection when available True True + False True If selected, wicd will automatically connect to a wired network as soon as a cable is plugged in, even if a wireless connection is already active. - Always switch to a wired connection when available - 0 True @@ -490,10 +508,10 @@ is already active. 12 + Automatically reconnect on network connection loss True True - Automatically reconnect on network connection loss - 0 + False True @@ -525,10 +543,10 @@ is already active. 12 + Use last wired network profile True True - Use last wired network profile - 0 + False True True @@ -547,10 +565,10 @@ is already active. 12 + Prompt for wired network profile True True - Prompt for wired network profile - 0 + False True True pref_use_last_radio @@ -570,10 +588,10 @@ is already active. 12 + Use default wired network profile True True - Use default wired network profile - 0 + False True True pref_use_last_radio @@ -766,10 +784,10 @@ is already active. 12 + Use global DNS servers True True - Use global DNS servers - 0 + False True @@ -840,11 +858,11 @@ is already active. 24 + Always show wired interface True True + False If enabled, the wired network interface will always be displayed in the main window. This can be useful if your wired network card does not detect when the interface is connected to a cable. - Always show wired interface - 0 True @@ -856,6 +874,41 @@ is already active. + + + True + 0 + <b>Notifications</b> + True + + + 2 + 18 + 19 + + + + + + True + 12 + + + Display notifications about connection status + True + True + False + True + + + + + 2 + 19 + 20 + + + @@ -870,8 +923,8 @@ is already active. General Settings - tab False + tab @@ -885,13 +938,13 @@ is already active. True True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC + automatic + automatic True - GTK_RESIZE_QUEUE - GTK_SHADOW_NONE + queue + none True @@ -931,23 +984,24 @@ is already active. True + Automatic (recommended) True True - Automatic (recommended) - 0 + False True True False + 0 + ip True True - ip - 0 + False True True flush_auto_radio @@ -959,10 +1013,10 @@ is already active. + route True True - route - 0 + False True True flush_auto_radio @@ -990,23 +1044,24 @@ is already active. True + Automatic (recommended) True True - Automatic (recommended) - 0 + False True True False + 0 + ethtool True True - ethtool - 0 + False True True link_auto_radio @@ -1018,10 +1073,10 @@ is already active. + mii-tool True True - mii-tool - 0 + False True True link_auto_radio @@ -1049,24 +1104,25 @@ is already active. True + Automatic (recommended) True True - Automatic (recommended) - 0 + False True True dhclient_radio False + 0 + dhclient True True - dhclient - 0 + False True True @@ -1077,10 +1133,10 @@ is already active. + dhcpcd True True - dhcpcd - 0 + False True True dhclient_radio @@ -1092,10 +1148,10 @@ is already active. + pump True True - pump - 0 + False True True dhclient_radio @@ -1147,23 +1203,24 @@ is already active. True + Automatic (recommended) True True - Automatic (recommended) - 0 + False True True False + 0 + gksudo True True - gksudo - 0 + False True True sudo_auto_radio @@ -1175,10 +1232,10 @@ is already active. + kdesu True True - kdesu - 0 + False True True sudo_auto_radio @@ -1190,10 +1247,10 @@ is already active. + ktsuss True True - ktsuss - 0 + False True True sudo_auto_radio @@ -1228,9 +1285,9 @@ is already active. External Programs - tab 1 False + tab @@ -1270,6 +1327,7 @@ to read its description. False + 0 @@ -1316,10 +1374,10 @@ to read its description. 12 + Use dBm to measure signal strength True True - Use dBm to measure signal strength - 0 + False True @@ -1337,10 +1395,10 @@ to read its description. 12 + Enable debug mode True True - Enable debug mode - 0 + False True @@ -1477,9 +1535,9 @@ WPA supplicant driver. Advanced Settings - tab 2 False + tab @@ -1490,34 +1548,41 @@ WPA supplicant driver. True - GTK_BUTTONBOX_END + end + gtk-cancel True True True - gtk-cancel True - 0 + + False + False + 0 + + gtk-ok + 1 True True True - gtk-ok True - 1 + False + False 1 False - GTK_PACK_END + end + 0 diff --git a/wicd/prefs.py b/wicd/prefs.py index 30d7a5d..2c577ea 100644 --- a/wicd/prefs.py +++ b/wicd/prefs.py @@ -41,6 +41,8 @@ wired = None from translations import language +USER_SETTINGS_DIR = os.path.expanduser('~/.wicd/') + def setup_dbus(): global daemon, wireless, wired daemon = dbusmanager.get_interface('daemon') @@ -144,6 +146,11 @@ class PreferencesDialog(object): self.backendcombo.set_active(self.backends.index(cur_backend)) except ValueError: self.backendcombo.set_active(0) + + self.notificationscheckbox.set_active( + os.path.exists( + os.path.join(USER_SETTINGS_DIR, 'USE_NOTIFICATIONS') + )) self.wTree.get_widget("notebook2").set_current_page(0) @@ -224,6 +231,15 @@ class PreferencesDialog(object): [width, height] = self.dialog.get_size() daemon.WriteWindowSize(width, height, "pref") + + not_path = os.path.join(USER_SETTINGS_DIR, 'USE_NOTIFICATIONS') + if self.notificationscheckbox.get_active(): + if not os.path.exists(not_path): + open(not_path, 'w') + else: + if os.path.exists(not_path): + os.remove(not_path) + def set_label(self, glade_str, label): """ Sets the label for the given widget in wicd.glade. """ @@ -308,6 +324,9 @@ class PreferencesDialog(object): 'use_last_used_profile') + self.notificationscheckbox = setup_label("pref_use_libnotify", + 'display_notifications') + # DHCP Clients self.dhcpautoradio = setup_label("dhcp_auto_radio", "wicd_auto_config") self.dhclientradio = self.wTree.get_widget("dhclient_radio") diff --git a/wicd/wicd-client.py b/wicd/wicd-client.py index d7d0b2e..143d9e5 100755 --- a/wicd/wicd-client.py +++ b/wicd/wicd-client.py @@ -53,6 +53,8 @@ try: except ImportError: HAS_NOTIFY = False +USE_NOTIFY = os.path.exists(os.path.join(os.path.expanduser('~/.wicd'), + 'USE_NOTIFICATIONS')) # Wicd specific imports from wicd import wpath @@ -245,9 +247,7 @@ class TrayIcon(object): if not state or not info: [state, info] = daemon.GetConnectionStatus() - self._show_notification('hello!') - - self.should_notify = (self.last_state != state) and HAS_NOTIFY + self.should_notify = (self.last_state != state) and HAS_NOTIFY and USE_NOTIFY self.last_state = state