From 6733ce38d2d35defc24c424579c82bb75aa8c9f3 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Fri, 14 Dec 2007 07:44:53 +0000 Subject: [PATCH] Add removals to the setup script. Do not display the Open Folder menu item if not connected to a localhost. --- TODO | 1 - deluge/ui/gtkui/menubar.py | 20 +++++++++++++++++--- setup.py | 19 +++++++++++++++---- 3 files changed, 32 insertions(+), 8 deletions(-) diff --git a/TODO b/TODO index d75e19416..c55352416 100644 --- a/TODO +++ b/TODO @@ -9,7 +9,6 @@ * Maybe add pop-up menus to the status bar items * Address issue where torrents will redownload if the storage is moved outside of deluge. -* Hide open folder if not localhost * Implement 'Classic' mode * Tray tooltip * Add autoload folder diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py index 49d572c57..c2bc775eb 100644 --- a/deluge/ui/gtkui/menubar.py +++ b/deluge/ui/gtkui/menubar.py @@ -47,11 +47,11 @@ class MenuBar(component.Component): component.Component.__init__(self, "MenuBar") self.window = component.get("MainWindow") # Get the torrent menu from the glade file - torrentmenu_glade = gtk.glade.XML( + self.torrentmenu_glade = gtk.glade.XML( pkg_resources.resource_filename("deluge.ui.gtkui", "glade/torrent_menu.glade")) - self.torrentmenu = torrentmenu_glade.get_widget("torrent_menu") + self.torrentmenu = self.torrentmenu_glade.get_widget("torrent_menu") self.menu_torrent = self.window.main_glade.get_widget("menu_torrent") # Attach the torrent_menu to the Torrent file menu @@ -88,7 +88,7 @@ class MenuBar(component.Component): "on_menuitem_about_activate": self.on_menuitem_about_activate }) - torrentmenu_glade.signal_autoconnect({ + self.torrentmenu_glade.signal_autoconnect({ ## Torrent Menu "on_menuitem_pause_activate": self.on_menuitem_pause_activate, "on_menuitem_resume_activate": self.on_menuitem_resume_activate, @@ -111,6 +111,20 @@ class MenuBar(component.Component): for widget in self.change_sensitivity: self.window.main_glade.get_widget(widget).set_sensitive(True) + # Hide the Open Folder menuitem and separator if not connected to a + # localhost. + non_remote_items = [ + "menuitem_open_folder", + "separator4" + ] + if not client.is_localhost(): + for widget in non_remote_items: + self.torrentmenu_glade.get_widget(widget).hide() + self.torrentmenu_glade.get_widget(widget).set_no_show_all(True) + else: + for widget in non_remote_items: + self.torrentmenu_glade.get_widget(widget).set_no_show_all(False) + # Show the Torrent menu because we're connected to a host self.menu_torrent.show() diff --git a/setup.py b/setup.py index 8fa470385..51a3a913c 100644 --- a/setup.py +++ b/setup.py @@ -32,13 +32,12 @@ import ez_setup ez_setup.use_setuptools() from setuptools import setup, find_packages, Extension -from distutils import cmd +from distutils import cmd, sysconfig from distutils.command.build import build as _build from distutils.command.install import install as _install from distutils.command.install_data import install_data as _install_data import msgfmt - import platform import glob import os @@ -54,10 +53,22 @@ _extra_compile_args = [ "-DHAVE_PTHREAD=1", "-DTORRENT_USE_OPENSSL=1", "-DHAVE_SSL=1", - "-g", - "-p" + "-O2" ] +removals = ["-Wstrict-prototypes"] + +if python_version == '2.5': + cv_opt = sysconfig.get_config_vars()["CFLAGS"] + for removal in removals: + cv_opt = cv_opt.replace(removal, " ") + sysconfig.get_config_vars()["CFLAGS"] = " ".join(cv_opt.split()) +else: + cv_opt = sysconfig.get_config_vars()["OPT"] + for removal in removals: + cv_opt = cv_opt.replace(removal, " ") + sysconfig.get_config_vars()["OPT"] = " ".join(cv_opt.split()) + _include_dirs = [ './libtorrent', './libtorrent/include',