From a8f751a4aaa2136efdc7fa0afd6633edb45a7d9d Mon Sep 17 00:00:00 2001 From: JKAbrams Date: Tue, 9 Aug 2016 13:04:37 +0200 Subject: [PATCH 1/3] Added setting to disable internet searching --- usr/lib/linuxmint/mintMenu/mintMenu.py | 2 + .../linuxmint/mintMenu/mintMenuConfig.glade | 24 ++- usr/lib/linuxmint/mintMenu/mintMenuConfig.py | 4 +- .../mintMenu/plugins/applications.py | 140 ++++++++++-------- .../com.linuxmint.mintmenu.gschema.xml | 6 + 5 files changed, 111 insertions(+), 65 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/mintMenu.py b/usr/lib/linuxmint/mintMenu/mintMenu.py index 0945e4d..86beed6 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenu.py +++ b/usr/lib/linuxmint/mintMenu/mintMenu.py @@ -480,6 +480,7 @@ class MenuWin( object ): self.settings.connect( "changed::hot-key", self.reloadSettings ) self.settings.connect( "changed::applet-icon", self.reloadSettings ) self.settings.connect( "changed::hide-applet-icon", self.reloadSettings ) + #self.settings.connect( "changed::enable-internet-search", self.reloadSettings ) self.settings.connect( "changed::applet-icon-size", self.reloadSettings ) self.settings.connect( "changed::hot-key", self.hotkeyChanged ) self.loadSettings() @@ -601,6 +602,7 @@ class MenuWin( object ): def loadSettings( self, *args, **kargs ): self.hideIcon = self.settings.get_boolean( "hide-applet-icon" ) + #self.internetSearchEnabled = self.settings.get_boolean( "enable-internet-search" ) self.buttonText = self.settings.get_string( "applet-text" ) self.theme_name = self.settings.get_string( "theme-name" ) self.hotkeyText = self.settings.get_string( "hot-key" ) diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade index 29dcf3f..2616f1a 100644 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade @@ -913,7 +913,7 @@ True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8 + 9 2 5 True @@ -1120,7 +1120,26 @@ 5 - + + + Enable internet search + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + True + + + 2 + 8 + 9 + GTK_FILL + + 5 + + + @@ -2070,3 +2089,4 @@ + diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py index 5e48a8d..55633d9 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py @@ -44,6 +44,7 @@ class mintMenuConfig( object ): self.builder.get_object("startWithFavorites").set_label(_("Always start with favorites pane")) self.builder.get_object("showButtonIcon").set_label(_("Show button icon")) + self.builder.get_object("enableInternetSearch").set_label(_("Enable internet search")) self.builder.get_object("useCustomColors").set_label(_("Use custom colors")) self.builder.get_object("showRecentPlugin").set_label(_("Show recent documents plugin")) self.builder.get_object("showApplicationsPlugin").set_label(_("Show applications plugin")) @@ -139,6 +140,7 @@ class mintMenuConfig( object ): self.borderColorLabel = self.builder.get_object( "borderColorLabel" ) self.headingColorLabel = self.builder.get_object( "headingColorLabel" ) self.showButtonIcon = self.builder.get_object( "showButtonIcon" ) + self.enableInternetSearch = self.builder.get_object( "enableInternetSearch" ) self.buttonText = self.builder.get_object( "buttonText" ) self.hotkeyWidget = keybinding.KeybindingWidget(_("Keyboard shortcut:") ) table = self.builder.get_object( "main_table" ) @@ -208,7 +210,7 @@ class mintMenuConfig( object ): self.bindGSettingsValueToWidget( self.settingsApplications, "int", "favicon-size", self.favIconSize, "value-changed", self.favIconSize.set_value, self.favIconSize.get_value ) self.bindGSettingsValueToWidget( self.settingsApplications, "int", "fav-cols", self.favCols, "value-changed", self.favCols.set_value, self.favCols.get_value ) self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "remember-filter", self.rememberFilter, "toggled", self.rememberFilter.set_active, self.rememberFilter.get_active) - + self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "enable-internet-search", self.enableInternetSearch, "toggled", self.enableInternetSearch.set_active, self.enableInternetSearch.get_active) self.bindGSettingsValueToWidget( self.settingsPlaces, "int", "icon-size", self.placesIconSize, "value-changed", self.placesIconSize.set_value, self.placesIconSize.get_value ) self.bindGSettingsValueToWidget( self.settingsSystem, "int", "icon-size", self.systemIconSize, "value-changed", self.systemIconSize.set_value, self.systemIconSize.get_value ) diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index 2a927ef..3ba9f5d 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -242,9 +242,11 @@ class pluginclass( object ): self.settings.notifyAdd( "use-apt", self.switchAPTUsage) self.settings.notifyAdd( "fav-cols", self.changeFavCols ) self.settings.notifyAdd( "remember-filter", self.changeRememberFilter) + self.settings.notifyAdd( "enable-internet-search", self.changeEnableInternetSearch) self.settings.bindGSettingsEntryToVar( "int", "category-hover-delay", self, "categoryhoverdelay" ) self.settings.bindGSettingsEntryToVar( "bool", "do-not-filter", self, "donotfilterapps" ) + self.settings.bindGSettingsEntryToVar( "bool", "enable-internet-search", self, "enableInternetSearch" ) self.settings.bindGSettingsEntryToVar( "string", "search-command", self, "searchtool" ) self.settings.bindGSettingsEntryToVar( "int", "default-tab", self, "defaultTab" ) except Exception, detail: @@ -387,6 +389,9 @@ class pluginclass( object ): def changeRememberFilter( self, settings, key, args): self.rememberFilter = settings.get_boolean(key) + def changeEnableInternetSearch( self, settings, key, args): + self.enableInternetSearch = settings.get_boolean(key) + def changeShowApplicationComments( self, settings, key, args ): self.showapplicationcomments = settings.get_boolean(key) for child in self.applicationsBox: @@ -451,6 +456,7 @@ class pluginclass( object ): self.showapplicationcomments = self.settings.get( "bool", "show-application-comments") self.useAPT = self.settings.get( "bool", "use-apt") self.rememberFilter = self.settings.get( "bool", "remember-filter") + self.enableInternetSearch = self.settings.get( "bool", "enable-internet-search") self.lastActiveTab = self.settings.get( "int", "last-active-tab") self.defaultTab = self.settings.get( "int", "default-tab") @@ -577,28 +583,29 @@ class pluginclass( object ): text = "%s" % text - suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") - suggestionButton.connect("clicked", self.search_google) - suggestionButton.set_text(_("Search Google for %s") % text) - suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/google.ico") - self.applicationsBox.add(suggestionButton) - self.suggestions.append(suggestionButton) + if self.enableInternetSearch: + suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") + suggestionButton.connect("clicked", self.search_google) + suggestionButton.set_text(_("Search Google for %s") % text) + suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/google.ico") + self.applicationsBox.add(suggestionButton) + self.suggestions.append(suggestionButton) - suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") - suggestionButton.connect("clicked", self.search_wikipedia) - suggestionButton.set_text(_("Search Wikipedia for %s") % text) - suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico") - self.applicationsBox.add(suggestionButton) - self.suggestions.append(suggestionButton) + suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") + suggestionButton.connect("clicked", self.search_wikipedia) + suggestionButton.set_text(_("Search Wikipedia for %s") % text) + suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico") + self.applicationsBox.add(suggestionButton) + self.suggestions.append(suggestionButton) - separator = Gtk.EventBox() - separator.add(Gtk.HSeparator()) - separator.set_visible_window(False) - separator.set_size_request(-1, 20) - separator.type = "separator" - separator.show_all() - self.applicationsBox.add(separator) - self.suggestions.append(separator) + separator = Gtk.EventBox() + separator.add(Gtk.HSeparator()) + separator.set_visible_window(False) + separator.set_size_request(-1, 20) + separator.type = "separator" + separator.show_all() + self.applicationsBox.add(separator) + self.suggestions.append(separator) suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") suggestionButton.connect("clicked", self.search_dictionary) @@ -1007,22 +1014,24 @@ class pluginclass( object ): def searchPopup( self, widget=None, event=None ): menu = Gtk.Menu() - menuItem = Gtk.ImageMenuItem(_("Search Google")) - img = Gtk.Image() - img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/google.ico') - menuItem.set_image(img) - menuItem.connect("activate", self.search_google) - menu.append(menuItem) + if self.enableInternetSearch: - menuItem = Gtk.ImageMenuItem(_("Search Wikipedia")) - img = Gtk.Image() - img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico') - menuItem.set_image(img) - menuItem.connect("activate", self.search_wikipedia) - menu.append(menuItem) + menuItem = Gtk.ImageMenuItem(_("Search Google")) + img = Gtk.Image() + img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/google.ico') + menuItem.set_image(img) + menuItem.connect("activate", self.search_google) + menu.append(menuItem) - menuItem = Gtk.SeparatorMenuItem() - menu.append(menuItem) + menuItem = Gtk.ImageMenuItem(_("Search Wikipedia")) + img = Gtk.Image() + img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico') + menuItem.set_image(img) + menuItem.connect("activate", self.search_wikipedia) + menu.append(menuItem) + + menuItem = Gtk.SeparatorMenuItem() + menu.append(menuItem) menuItem = Gtk.ImageMenuItem(_("Lookup Dictionary")) img = Gtk.Image() @@ -1096,16 +1105,18 @@ class pluginclass( object ): return (x, y, False) def search_google(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "+") - os.system("xdg-open \"http://www.google.com/cse?cx=002683415331144861350%3Atsq8didf9x0&ie=utf-8&sa=Search&q=" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "+") + os.system("xdg-open \"http://www.google.com/cse?cx=002683415331144861350%3Atsq8didf9x0&ie=utf-8&sa=Search&q=" + text + "\" &") + self.mintMenuWin.hide() def search_wikipedia(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "+") - os.system("xdg-open \"http://en.wikipedia.org/wiki/Special:Search?search=" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "+") + os.system("xdg-open \"http://en.wikipedia.org/wiki/Special:Search?search=" + text + "\" &") + self.mintMenuWin.hide() def search_dictionary(self, widget): text = self.searchEntry.get_text() @@ -1113,34 +1124,39 @@ class pluginclass( object ): self.mintMenuWin.hide() def search_mint_tutorials(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/tutorial/search/0/" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/tutorial/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_ideas(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/idea/search/0/" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/idea/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_users(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/user/search/0/" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/user/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_hardware(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/hardware/search/0/" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/hardware/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_software(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/software/search/0/" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/software/search/0/" + text + "\" &") + self.mintMenuWin.hide() def add_to_desktop(self, widget, desktopEntry): os.system("xdg-desktop-icon install --novendor %s" % desktopEntry.desktopFile) diff --git a/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml b/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml index 22d4c84..f02e736 100644 --- a/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml +++ b/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml @@ -313,6 +313,12 @@ + + + false + + + From 2bae23715596af02571ef918ce73743b88b45d84 Mon Sep 17 00:00:00 2001 From: JKAbrams Date: Tue, 9 Aug 2016 13:27:49 +0200 Subject: [PATCH 2/3] Revert "Added setting to disable internet searching" This reverts commit a8f751a4aaa2136efdc7fa0afd6633edb45a7d9d. --- usr/lib/linuxmint/mintMenu/mintMenu.py | 2 - .../linuxmint/mintMenu/mintMenuConfig.glade | 24 +-- usr/lib/linuxmint/mintMenu/mintMenuConfig.py | 4 +- .../mintMenu/plugins/applications.py | 140 ++++++++---------- .../com.linuxmint.mintmenu.gschema.xml | 6 - 5 files changed, 65 insertions(+), 111 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/mintMenu.py b/usr/lib/linuxmint/mintMenu/mintMenu.py index 86beed6..0945e4d 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenu.py +++ b/usr/lib/linuxmint/mintMenu/mintMenu.py @@ -480,7 +480,6 @@ class MenuWin( object ): self.settings.connect( "changed::hot-key", self.reloadSettings ) self.settings.connect( "changed::applet-icon", self.reloadSettings ) self.settings.connect( "changed::hide-applet-icon", self.reloadSettings ) - #self.settings.connect( "changed::enable-internet-search", self.reloadSettings ) self.settings.connect( "changed::applet-icon-size", self.reloadSettings ) self.settings.connect( "changed::hot-key", self.hotkeyChanged ) self.loadSettings() @@ -602,7 +601,6 @@ class MenuWin( object ): def loadSettings( self, *args, **kargs ): self.hideIcon = self.settings.get_boolean( "hide-applet-icon" ) - #self.internetSearchEnabled = self.settings.get_boolean( "enable-internet-search" ) self.buttonText = self.settings.get_string( "applet-text" ) self.theme_name = self.settings.get_string( "theme-name" ) self.hotkeyText = self.settings.get_string( "hot-key" ) diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade index 2616f1a..29dcf3f 100644 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade @@ -913,7 +913,7 @@ True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 9 + 8 2 5 True @@ -1120,26 +1120,7 @@ 5 - - - Enable internet search - True - True - False - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - False - True - - - 2 - 8 - 9 - GTK_FILL - - 5 - - - + @@ -2089,4 +2070,3 @@ - diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py index 55633d9..5e48a8d 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py @@ -44,7 +44,6 @@ class mintMenuConfig( object ): self.builder.get_object("startWithFavorites").set_label(_("Always start with favorites pane")) self.builder.get_object("showButtonIcon").set_label(_("Show button icon")) - self.builder.get_object("enableInternetSearch").set_label(_("Enable internet search")) self.builder.get_object("useCustomColors").set_label(_("Use custom colors")) self.builder.get_object("showRecentPlugin").set_label(_("Show recent documents plugin")) self.builder.get_object("showApplicationsPlugin").set_label(_("Show applications plugin")) @@ -140,7 +139,6 @@ class mintMenuConfig( object ): self.borderColorLabel = self.builder.get_object( "borderColorLabel" ) self.headingColorLabel = self.builder.get_object( "headingColorLabel" ) self.showButtonIcon = self.builder.get_object( "showButtonIcon" ) - self.enableInternetSearch = self.builder.get_object( "enableInternetSearch" ) self.buttonText = self.builder.get_object( "buttonText" ) self.hotkeyWidget = keybinding.KeybindingWidget(_("Keyboard shortcut:") ) table = self.builder.get_object( "main_table" ) @@ -210,7 +208,7 @@ class mintMenuConfig( object ): self.bindGSettingsValueToWidget( self.settingsApplications, "int", "favicon-size", self.favIconSize, "value-changed", self.favIconSize.set_value, self.favIconSize.get_value ) self.bindGSettingsValueToWidget( self.settingsApplications, "int", "fav-cols", self.favCols, "value-changed", self.favCols.set_value, self.favCols.get_value ) self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "remember-filter", self.rememberFilter, "toggled", self.rememberFilter.set_active, self.rememberFilter.get_active) - self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "enable-internet-search", self.enableInternetSearch, "toggled", self.enableInternetSearch.set_active, self.enableInternetSearch.get_active) + self.bindGSettingsValueToWidget( self.settingsPlaces, "int", "icon-size", self.placesIconSize, "value-changed", self.placesIconSize.set_value, self.placesIconSize.get_value ) self.bindGSettingsValueToWidget( self.settingsSystem, "int", "icon-size", self.systemIconSize, "value-changed", self.systemIconSize.set_value, self.systemIconSize.get_value ) diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index 3ba9f5d..2a927ef 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -242,11 +242,9 @@ class pluginclass( object ): self.settings.notifyAdd( "use-apt", self.switchAPTUsage) self.settings.notifyAdd( "fav-cols", self.changeFavCols ) self.settings.notifyAdd( "remember-filter", self.changeRememberFilter) - self.settings.notifyAdd( "enable-internet-search", self.changeEnableInternetSearch) self.settings.bindGSettingsEntryToVar( "int", "category-hover-delay", self, "categoryhoverdelay" ) self.settings.bindGSettingsEntryToVar( "bool", "do-not-filter", self, "donotfilterapps" ) - self.settings.bindGSettingsEntryToVar( "bool", "enable-internet-search", self, "enableInternetSearch" ) self.settings.bindGSettingsEntryToVar( "string", "search-command", self, "searchtool" ) self.settings.bindGSettingsEntryToVar( "int", "default-tab", self, "defaultTab" ) except Exception, detail: @@ -389,9 +387,6 @@ class pluginclass( object ): def changeRememberFilter( self, settings, key, args): self.rememberFilter = settings.get_boolean(key) - def changeEnableInternetSearch( self, settings, key, args): - self.enableInternetSearch = settings.get_boolean(key) - def changeShowApplicationComments( self, settings, key, args ): self.showapplicationcomments = settings.get_boolean(key) for child in self.applicationsBox: @@ -456,7 +451,6 @@ class pluginclass( object ): self.showapplicationcomments = self.settings.get( "bool", "show-application-comments") self.useAPT = self.settings.get( "bool", "use-apt") self.rememberFilter = self.settings.get( "bool", "remember-filter") - self.enableInternetSearch = self.settings.get( "bool", "enable-internet-search") self.lastActiveTab = self.settings.get( "int", "last-active-tab") self.defaultTab = self.settings.get( "int", "default-tab") @@ -583,29 +577,28 @@ class pluginclass( object ): text = "%s" % text - if self.enableInternetSearch: - suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") - suggestionButton.connect("clicked", self.search_google) - suggestionButton.set_text(_("Search Google for %s") % text) - suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/google.ico") - self.applicationsBox.add(suggestionButton) - self.suggestions.append(suggestionButton) + suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") + suggestionButton.connect("clicked", self.search_google) + suggestionButton.set_text(_("Search Google for %s") % text) + suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/google.ico") + self.applicationsBox.add(suggestionButton) + self.suggestions.append(suggestionButton) - suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") - suggestionButton.connect("clicked", self.search_wikipedia) - suggestionButton.set_text(_("Search Wikipedia for %s") % text) - suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico") - self.applicationsBox.add(suggestionButton) - self.suggestions.append(suggestionButton) + suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") + suggestionButton.connect("clicked", self.search_wikipedia) + suggestionButton.set_text(_("Search Wikipedia for %s") % text) + suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico") + self.applicationsBox.add(suggestionButton) + self.suggestions.append(suggestionButton) - separator = Gtk.EventBox() - separator.add(Gtk.HSeparator()) - separator.set_visible_window(False) - separator.set_size_request(-1, 20) - separator.type = "separator" - separator.show_all() - self.applicationsBox.add(separator) - self.suggestions.append(separator) + separator = Gtk.EventBox() + separator.add(Gtk.HSeparator()) + separator.set_visible_window(False) + separator.set_size_request(-1, 20) + separator.type = "separator" + separator.show_all() + self.applicationsBox.add(separator) + self.suggestions.append(separator) suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") suggestionButton.connect("clicked", self.search_dictionary) @@ -1014,24 +1007,22 @@ class pluginclass( object ): def searchPopup( self, widget=None, event=None ): menu = Gtk.Menu() - if self.enableInternetSearch: + menuItem = Gtk.ImageMenuItem(_("Search Google")) + img = Gtk.Image() + img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/google.ico') + menuItem.set_image(img) + menuItem.connect("activate", self.search_google) + menu.append(menuItem) - menuItem = Gtk.ImageMenuItem(_("Search Google")) - img = Gtk.Image() - img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/google.ico') - menuItem.set_image(img) - menuItem.connect("activate", self.search_google) - menu.append(menuItem) + menuItem = Gtk.ImageMenuItem(_("Search Wikipedia")) + img = Gtk.Image() + img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico') + menuItem.set_image(img) + menuItem.connect("activate", self.search_wikipedia) + menu.append(menuItem) - menuItem = Gtk.ImageMenuItem(_("Search Wikipedia")) - img = Gtk.Image() - img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico') - menuItem.set_image(img) - menuItem.connect("activate", self.search_wikipedia) - menu.append(menuItem) - - menuItem = Gtk.SeparatorMenuItem() - menu.append(menuItem) + menuItem = Gtk.SeparatorMenuItem() + menu.append(menuItem) menuItem = Gtk.ImageMenuItem(_("Lookup Dictionary")) img = Gtk.Image() @@ -1105,18 +1096,16 @@ class pluginclass( object ): return (x, y, False) def search_google(self, widget): - if self.enableInternetSearch: - text = self.searchEntry.get_text() - text = text.replace(" ", "+") - os.system("xdg-open \"http://www.google.com/cse?cx=002683415331144861350%3Atsq8didf9x0&ie=utf-8&sa=Search&q=" + text + "\" &") - self.mintMenuWin.hide() + text = self.searchEntry.get_text() + text = text.replace(" ", "+") + os.system("xdg-open \"http://www.google.com/cse?cx=002683415331144861350%3Atsq8didf9x0&ie=utf-8&sa=Search&q=" + text + "\" &") + self.mintMenuWin.hide() def search_wikipedia(self, widget): - if self.enableInternetSearch: - text = self.searchEntry.get_text() - text = text.replace(" ", "+") - os.system("xdg-open \"http://en.wikipedia.org/wiki/Special:Search?search=" + text + "\" &") - self.mintMenuWin.hide() + text = self.searchEntry.get_text() + text = text.replace(" ", "+") + os.system("xdg-open \"http://en.wikipedia.org/wiki/Special:Search?search=" + text + "\" &") + self.mintMenuWin.hide() def search_dictionary(self, widget): text = self.searchEntry.get_text() @@ -1124,39 +1113,34 @@ class pluginclass( object ): self.mintMenuWin.hide() def search_mint_tutorials(self, widget): - if self.enableInternetSearch: - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/tutorial/search/0/" + text + "\" &") - self.mintMenuWin.hide() + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/tutorial/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_ideas(self, widget): - if self.enableInternetSearch: - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/idea/search/0/" + text + "\" &") - self.mintMenuWin.hide() + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/idea/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_users(self, widget): - if self.enableInternetSearch: - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/user/search/0/" + text + "\" &") - self.mintMenuWin.hide() + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/user/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_hardware(self, widget): - if self.enableInternetSearch: - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/hardware/search/0/" + text + "\" &") - self.mintMenuWin.hide() + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/hardware/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_software(self, widget): - if self.enableInternetSearch: - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/software/search/0/" + text + "\" &") - self.mintMenuWin.hide() + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/software/search/0/" + text + "\" &") + self.mintMenuWin.hide() def add_to_desktop(self, widget, desktopEntry): os.system("xdg-desktop-icon install --novendor %s" % desktopEntry.desktopFile) diff --git a/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml b/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml index f02e736..22d4c84 100644 --- a/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml +++ b/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml @@ -313,12 +313,6 @@ - - - false - - - From b3f84781db638c981463ac7fc4b3d24e1ec559ac Mon Sep 17 00:00:00 2001 From: JKAbrams Date: Tue, 9 Aug 2016 13:45:02 +0200 Subject: [PATCH 3/3] Making internet searching from the start menu optional --- .../linuxmint/mintMenu/mintMenuConfig.glade | 21 ++- usr/lib/linuxmint/mintMenu/mintMenuConfig.py | 3 + .../mintMenu/plugins/applications.py | 140 ++++++++++-------- .../com.linuxmint.mintmenu.gschema.xml | 6 + 4 files changed, 107 insertions(+), 63 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade index 29dcf3f..13a87ec 100644 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade @@ -913,7 +913,7 @@ True False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 8 + 9 2 5 True @@ -1120,6 +1120,25 @@ 5 + + + Enable internet search + True + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + False + True + + + 2 + 8 + 9 + GTK_FILL + + 5 + + diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py index 5e48a8d..6faf3a0 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py @@ -44,6 +44,7 @@ class mintMenuConfig( object ): self.builder.get_object("startWithFavorites").set_label(_("Always start with favorites pane")) self.builder.get_object("showButtonIcon").set_label(_("Show button icon")) + self.builder.get_object("enableInternetSearch").set_label(_("Enable internet search")) self.builder.get_object("useCustomColors").set_label(_("Use custom colors")) self.builder.get_object("showRecentPlugin").set_label(_("Show recent documents plugin")) self.builder.get_object("showApplicationsPlugin").set_label(_("Show applications plugin")) @@ -139,6 +140,7 @@ class mintMenuConfig( object ): self.borderColorLabel = self.builder.get_object( "borderColorLabel" ) self.headingColorLabel = self.builder.get_object( "headingColorLabel" ) self.showButtonIcon = self.builder.get_object( "showButtonIcon" ) + self.enableInternetSearch = self.builder.get_object( "enableInternetSearch" ) self.buttonText = self.builder.get_object( "buttonText" ) self.hotkeyWidget = keybinding.KeybindingWidget(_("Keyboard shortcut:") ) table = self.builder.get_object( "main_table" ) @@ -208,6 +210,7 @@ class mintMenuConfig( object ): self.bindGSettingsValueToWidget( self.settingsApplications, "int", "favicon-size", self.favIconSize, "value-changed", self.favIconSize.set_value, self.favIconSize.get_value ) self.bindGSettingsValueToWidget( self.settingsApplications, "int", "fav-cols", self.favCols, "value-changed", self.favCols.set_value, self.favCols.get_value ) self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "remember-filter", self.rememberFilter, "toggled", self.rememberFilter.set_active, self.rememberFilter.get_active) + self.bindGSettingsValueToWidget( self.settingsApplications, "bool", "enable-internet-search", self.enableInternetSearch, "toggled", self.enableInternetSearch.set_active, self.enableInternetSearch.get_active) self.bindGSettingsValueToWidget( self.settingsPlaces, "int", "icon-size", self.placesIconSize, "value-changed", self.placesIconSize.set_value, self.placesIconSize.get_value ) self.bindGSettingsValueToWidget( self.settingsSystem, "int", "icon-size", self.systemIconSize, "value-changed", self.systemIconSize.set_value, self.systemIconSize.get_value ) diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index 2a927ef..3ba9f5d 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -242,9 +242,11 @@ class pluginclass( object ): self.settings.notifyAdd( "use-apt", self.switchAPTUsage) self.settings.notifyAdd( "fav-cols", self.changeFavCols ) self.settings.notifyAdd( "remember-filter", self.changeRememberFilter) + self.settings.notifyAdd( "enable-internet-search", self.changeEnableInternetSearch) self.settings.bindGSettingsEntryToVar( "int", "category-hover-delay", self, "categoryhoverdelay" ) self.settings.bindGSettingsEntryToVar( "bool", "do-not-filter", self, "donotfilterapps" ) + self.settings.bindGSettingsEntryToVar( "bool", "enable-internet-search", self, "enableInternetSearch" ) self.settings.bindGSettingsEntryToVar( "string", "search-command", self, "searchtool" ) self.settings.bindGSettingsEntryToVar( "int", "default-tab", self, "defaultTab" ) except Exception, detail: @@ -387,6 +389,9 @@ class pluginclass( object ): def changeRememberFilter( self, settings, key, args): self.rememberFilter = settings.get_boolean(key) + def changeEnableInternetSearch( self, settings, key, args): + self.enableInternetSearch = settings.get_boolean(key) + def changeShowApplicationComments( self, settings, key, args ): self.showapplicationcomments = settings.get_boolean(key) for child in self.applicationsBox: @@ -451,6 +456,7 @@ class pluginclass( object ): self.showapplicationcomments = self.settings.get( "bool", "show-application-comments") self.useAPT = self.settings.get( "bool", "use-apt") self.rememberFilter = self.settings.get( "bool", "remember-filter") + self.enableInternetSearch = self.settings.get( "bool", "enable-internet-search") self.lastActiveTab = self.settings.get( "int", "last-active-tab") self.defaultTab = self.settings.get( "int", "default-tab") @@ -577,28 +583,29 @@ class pluginclass( object ): text = "%s" % text - suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") - suggestionButton.connect("clicked", self.search_google) - suggestionButton.set_text(_("Search Google for %s") % text) - suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/google.ico") - self.applicationsBox.add(suggestionButton) - self.suggestions.append(suggestionButton) + if self.enableInternetSearch: + suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") + suggestionButton.connect("clicked", self.search_google) + suggestionButton.set_text(_("Search Google for %s") % text) + suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/google.ico") + self.applicationsBox.add(suggestionButton) + self.suggestions.append(suggestionButton) - suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") - suggestionButton.connect("clicked", self.search_wikipedia) - suggestionButton.set_text(_("Search Wikipedia for %s") % text) - suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico") - self.applicationsBox.add(suggestionButton) - self.suggestions.append(suggestionButton) + suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") + suggestionButton.connect("clicked", self.search_wikipedia) + suggestionButton.set_text(_("Search Wikipedia for %s") % text) + suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico") + self.applicationsBox.add(suggestionButton) + self.suggestions.append(suggestionButton) - separator = Gtk.EventBox() - separator.add(Gtk.HSeparator()) - separator.set_visible_window(False) - separator.set_size_request(-1, 20) - separator.type = "separator" - separator.show_all() - self.applicationsBox.add(separator) - self.suggestions.append(separator) + separator = Gtk.EventBox() + separator.add(Gtk.HSeparator()) + separator.set_visible_window(False) + separator.set_size_request(-1, 20) + separator.type = "separator" + separator.show_all() + self.applicationsBox.add(separator) + self.suggestions.append(separator) suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "") suggestionButton.connect("clicked", self.search_dictionary) @@ -1007,22 +1014,24 @@ class pluginclass( object ): def searchPopup( self, widget=None, event=None ): menu = Gtk.Menu() - menuItem = Gtk.ImageMenuItem(_("Search Google")) - img = Gtk.Image() - img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/google.ico') - menuItem.set_image(img) - menuItem.connect("activate", self.search_google) - menu.append(menuItem) + if self.enableInternetSearch: - menuItem = Gtk.ImageMenuItem(_("Search Wikipedia")) - img = Gtk.Image() - img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico') - menuItem.set_image(img) - menuItem.connect("activate", self.search_wikipedia) - menu.append(menuItem) + menuItem = Gtk.ImageMenuItem(_("Search Google")) + img = Gtk.Image() + img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/google.ico') + menuItem.set_image(img) + menuItem.connect("activate", self.search_google) + menu.append(menuItem) - menuItem = Gtk.SeparatorMenuItem() - menu.append(menuItem) + menuItem = Gtk.ImageMenuItem(_("Search Wikipedia")) + img = Gtk.Image() + img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico') + menuItem.set_image(img) + menuItem.connect("activate", self.search_wikipedia) + menu.append(menuItem) + + menuItem = Gtk.SeparatorMenuItem() + menu.append(menuItem) menuItem = Gtk.ImageMenuItem(_("Lookup Dictionary")) img = Gtk.Image() @@ -1096,16 +1105,18 @@ class pluginclass( object ): return (x, y, False) def search_google(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "+") - os.system("xdg-open \"http://www.google.com/cse?cx=002683415331144861350%3Atsq8didf9x0&ie=utf-8&sa=Search&q=" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "+") + os.system("xdg-open \"http://www.google.com/cse?cx=002683415331144861350%3Atsq8didf9x0&ie=utf-8&sa=Search&q=" + text + "\" &") + self.mintMenuWin.hide() def search_wikipedia(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "+") - os.system("xdg-open \"http://en.wikipedia.org/wiki/Special:Search?search=" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "+") + os.system("xdg-open \"http://en.wikipedia.org/wiki/Special:Search?search=" + text + "\" &") + self.mintMenuWin.hide() def search_dictionary(self, widget): text = self.searchEntry.get_text() @@ -1113,34 +1124,39 @@ class pluginclass( object ): self.mintMenuWin.hide() def search_mint_tutorials(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/tutorial/search/0/" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/tutorial/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_ideas(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/idea/search/0/" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/idea/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_users(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/user/search/0/" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/user/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_hardware(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/hardware/search/0/" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/hardware/search/0/" + text + "\" &") + self.mintMenuWin.hide() def search_mint_software(self, widget): - text = self.searchEntry.get_text() - text = text.replace(" ", "%20") - os.system("xdg-open \"http://community.linuxmint.com/index.php/software/search/0/" + text + "\" &") - self.mintMenuWin.hide() + if self.enableInternetSearch: + text = self.searchEntry.get_text() + text = text.replace(" ", "%20") + os.system("xdg-open \"http://community.linuxmint.com/index.php/software/search/0/" + text + "\" &") + self.mintMenuWin.hide() def add_to_desktop(self, widget, desktopEntry): os.system("xdg-desktop-icon install --novendor %s" % desktopEntry.desktopFile) diff --git a/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml b/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml index 22d4c84..f02e736 100644 --- a/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml +++ b/usr/share/glib-2.0/schemas/com.linuxmint.mintmenu.gschema.xml @@ -313,6 +313,12 @@ + + + false + + +