Making internet searching from the start menu optional
This commit is contained in:
parent
2bae237155
commit
b3f84781db
@ -913,7 +913,7 @@
|
|||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
<property name="n_rows">8</property>
|
<property name="n_rows">9</property>
|
||||||
<property name="n_columns">2</property>
|
<property name="n_columns">2</property>
|
||||||
<property name="row_spacing">5</property>
|
<property name="row_spacing">5</property>
|
||||||
<property name="homogeneous">True</property>
|
<property name="homogeneous">True</property>
|
||||||
@ -1120,6 +1120,25 @@
|
|||||||
<property name="x_padding">5</property>
|
<property name="x_padding">5</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCheckButton" id="enableInternetSearch">
|
||||||
|
<property name="label" translatable="yes">Enable internet search</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">False</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="use_action_appearance">False</property>
|
||||||
|
<property name="draw_indicator">True</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="right_attach">2</property>
|
||||||
|
<property name="top_attach">8</property>
|
||||||
|
<property name="bottom_attach">9</property>
|
||||||
|
<property name="x_options">GTK_FILL</property>
|
||||||
|
<property name="y_options"/>
|
||||||
|
<property name="x_padding">5</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child type="label">
|
<child type="label">
|
||||||
|
@ -44,6 +44,7 @@ class mintMenuConfig( object ):
|
|||||||
|
|
||||||
self.builder.get_object("startWithFavorites").set_label(_("Always start with favorites pane"))
|
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("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("useCustomColors").set_label(_("Use custom colors"))
|
||||||
self.builder.get_object("showRecentPlugin").set_label(_("Show recent documents plugin"))
|
self.builder.get_object("showRecentPlugin").set_label(_("Show recent documents plugin"))
|
||||||
self.builder.get_object("showApplicationsPlugin").set_label(_("Show applications 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.borderColorLabel = self.builder.get_object( "borderColorLabel" )
|
||||||
self.headingColorLabel = self.builder.get_object( "headingColorLabel" )
|
self.headingColorLabel = self.builder.get_object( "headingColorLabel" )
|
||||||
self.showButtonIcon = self.builder.get_object( "showButtonIcon" )
|
self.showButtonIcon = self.builder.get_object( "showButtonIcon" )
|
||||||
|
self.enableInternetSearch = self.builder.get_object( "enableInternetSearch" )
|
||||||
self.buttonText = self.builder.get_object( "buttonText" )
|
self.buttonText = self.builder.get_object( "buttonText" )
|
||||||
self.hotkeyWidget = keybinding.KeybindingWidget(_("Keyboard shortcut:") )
|
self.hotkeyWidget = keybinding.KeybindingWidget(_("Keyboard shortcut:") )
|
||||||
table = self.builder.get_object( "main_table" )
|
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", "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, "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", "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.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 )
|
self.bindGSettingsValueToWidget( self.settingsSystem, "int", "icon-size", self.systemIconSize, "value-changed", self.systemIconSize.set_value, self.systemIconSize.get_value )
|
||||||
|
@ -242,9 +242,11 @@ class pluginclass( object ):
|
|||||||
self.settings.notifyAdd( "use-apt", self.switchAPTUsage)
|
self.settings.notifyAdd( "use-apt", self.switchAPTUsage)
|
||||||
self.settings.notifyAdd( "fav-cols", self.changeFavCols )
|
self.settings.notifyAdd( "fav-cols", self.changeFavCols )
|
||||||
self.settings.notifyAdd( "remember-filter", self.changeRememberFilter)
|
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( "int", "category-hover-delay", self, "categoryhoverdelay" )
|
||||||
self.settings.bindGSettingsEntryToVar( "bool", "do-not-filter", self, "donotfilterapps" )
|
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( "string", "search-command", self, "searchtool" )
|
||||||
self.settings.bindGSettingsEntryToVar( "int", "default-tab", self, "defaultTab" )
|
self.settings.bindGSettingsEntryToVar( "int", "default-tab", self, "defaultTab" )
|
||||||
except Exception, detail:
|
except Exception, detail:
|
||||||
@ -387,6 +389,9 @@ class pluginclass( object ):
|
|||||||
def changeRememberFilter( self, settings, key, args):
|
def changeRememberFilter( self, settings, key, args):
|
||||||
self.rememberFilter = settings.get_boolean(key)
|
self.rememberFilter = settings.get_boolean(key)
|
||||||
|
|
||||||
|
def changeEnableInternetSearch( self, settings, key, args):
|
||||||
|
self.enableInternetSearch = settings.get_boolean(key)
|
||||||
|
|
||||||
def changeShowApplicationComments( self, settings, key, args ):
|
def changeShowApplicationComments( self, settings, key, args ):
|
||||||
self.showapplicationcomments = settings.get_boolean(key)
|
self.showapplicationcomments = settings.get_boolean(key)
|
||||||
for child in self.applicationsBox:
|
for child in self.applicationsBox:
|
||||||
@ -451,6 +456,7 @@ class pluginclass( object ):
|
|||||||
self.showapplicationcomments = self.settings.get( "bool", "show-application-comments")
|
self.showapplicationcomments = self.settings.get( "bool", "show-application-comments")
|
||||||
self.useAPT = self.settings.get( "bool", "use-apt")
|
self.useAPT = self.settings.get( "bool", "use-apt")
|
||||||
self.rememberFilter = self.settings.get( "bool", "remember-filter")
|
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.lastActiveTab = self.settings.get( "int", "last-active-tab")
|
||||||
self.defaultTab = self.settings.get( "int", "default-tab")
|
self.defaultTab = self.settings.get( "int", "default-tab")
|
||||||
@ -577,28 +583,29 @@ class pluginclass( object ):
|
|||||||
|
|
||||||
text = "<b>%s</b>" % text
|
text = "<b>%s</b>" % text
|
||||||
|
|
||||||
suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "")
|
if self.enableInternetSearch:
|
||||||
suggestionButton.connect("clicked", self.search_google)
|
suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "")
|
||||||
suggestionButton.set_text(_("Search Google for %s") % text)
|
suggestionButton.connect("clicked", self.search_google)
|
||||||
suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/google.ico")
|
suggestionButton.set_text(_("Search Google for %s") % text)
|
||||||
self.applicationsBox.add(suggestionButton)
|
suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/google.ico")
|
||||||
self.suggestions.append(suggestionButton)
|
self.applicationsBox.add(suggestionButton)
|
||||||
|
self.suggestions.append(suggestionButton)
|
||||||
|
|
||||||
suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "")
|
suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "")
|
||||||
suggestionButton.connect("clicked", self.search_wikipedia)
|
suggestionButton.connect("clicked", self.search_wikipedia)
|
||||||
suggestionButton.set_text(_("Search Wikipedia for %s") % text)
|
suggestionButton.set_text(_("Search Wikipedia for %s") % text)
|
||||||
suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico")
|
suggestionButton.set_image("/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico")
|
||||||
self.applicationsBox.add(suggestionButton)
|
self.applicationsBox.add(suggestionButton)
|
||||||
self.suggestions.append(suggestionButton)
|
self.suggestions.append(suggestionButton)
|
||||||
|
|
||||||
separator = Gtk.EventBox()
|
separator = Gtk.EventBox()
|
||||||
separator.add(Gtk.HSeparator())
|
separator.add(Gtk.HSeparator())
|
||||||
separator.set_visible_window(False)
|
separator.set_visible_window(False)
|
||||||
separator.set_size_request(-1, 20)
|
separator.set_size_request(-1, 20)
|
||||||
separator.type = "separator"
|
separator.type = "separator"
|
||||||
separator.show_all()
|
separator.show_all()
|
||||||
self.applicationsBox.add(separator)
|
self.applicationsBox.add(separator)
|
||||||
self.suggestions.append(separator)
|
self.suggestions.append(separator)
|
||||||
|
|
||||||
suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "")
|
suggestionButton = SuggestionButton(Gtk.STOCK_ADD, self.iconSize, "")
|
||||||
suggestionButton.connect("clicked", self.search_dictionary)
|
suggestionButton.connect("clicked", self.search_dictionary)
|
||||||
@ -1007,22 +1014,24 @@ class pluginclass( object ):
|
|||||||
def searchPopup( self, widget=None, event=None ):
|
def searchPopup( self, widget=None, event=None ):
|
||||||
menu = Gtk.Menu()
|
menu = Gtk.Menu()
|
||||||
|
|
||||||
menuItem = Gtk.ImageMenuItem(_("Search Google"))
|
if self.enableInternetSearch:
|
||||||
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"))
|
menuItem = Gtk.ImageMenuItem(_("Search Google"))
|
||||||
img = Gtk.Image()
|
img = Gtk.Image()
|
||||||
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/wikipedia.ico')
|
img.set_from_file('/usr/lib/linuxmint/mintMenu/search_engines/google.ico')
|
||||||
menuItem.set_image(img)
|
menuItem.set_image(img)
|
||||||
menuItem.connect("activate", self.search_wikipedia)
|
menuItem.connect("activate", self.search_google)
|
||||||
menu.append(menuItem)
|
menu.append(menuItem)
|
||||||
|
|
||||||
menuItem = Gtk.SeparatorMenuItem()
|
menuItem = Gtk.ImageMenuItem(_("Search Wikipedia"))
|
||||||
menu.append(menuItem)
|
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"))
|
menuItem = Gtk.ImageMenuItem(_("Lookup Dictionary"))
|
||||||
img = Gtk.Image()
|
img = Gtk.Image()
|
||||||
@ -1096,16 +1105,18 @@ class pluginclass( object ):
|
|||||||
return (x, y, False)
|
return (x, y, False)
|
||||||
|
|
||||||
def search_google(self, widget):
|
def search_google(self, widget):
|
||||||
text = self.searchEntry.get_text()
|
if self.enableInternetSearch:
|
||||||
text = text.replace(" ", "+")
|
text = self.searchEntry.get_text()
|
||||||
os.system("xdg-open \"http://www.google.com/cse?cx=002683415331144861350%3Atsq8didf9x0&ie=utf-8&sa=Search&q=" + text + "\" &")
|
text = text.replace(" ", "+")
|
||||||
self.mintMenuWin.hide()
|
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):
|
def search_wikipedia(self, widget):
|
||||||
text = self.searchEntry.get_text()
|
if self.enableInternetSearch:
|
||||||
text = text.replace(" ", "+")
|
text = self.searchEntry.get_text()
|
||||||
os.system("xdg-open \"http://en.wikipedia.org/wiki/Special:Search?search=" + text + "\" &")
|
text = text.replace(" ", "+")
|
||||||
self.mintMenuWin.hide()
|
os.system("xdg-open \"http://en.wikipedia.org/wiki/Special:Search?search=" + text + "\" &")
|
||||||
|
self.mintMenuWin.hide()
|
||||||
|
|
||||||
def search_dictionary(self, widget):
|
def search_dictionary(self, widget):
|
||||||
text = self.searchEntry.get_text()
|
text = self.searchEntry.get_text()
|
||||||
@ -1113,34 +1124,39 @@ class pluginclass( object ):
|
|||||||
self.mintMenuWin.hide()
|
self.mintMenuWin.hide()
|
||||||
|
|
||||||
def search_mint_tutorials(self, widget):
|
def search_mint_tutorials(self, widget):
|
||||||
text = self.searchEntry.get_text()
|
if self.enableInternetSearch:
|
||||||
text = text.replace(" ", "%20")
|
text = self.searchEntry.get_text()
|
||||||
os.system("xdg-open \"http://community.linuxmint.com/index.php/tutorial/search/0/" + text + "\" &")
|
text = text.replace(" ", "%20")
|
||||||
self.mintMenuWin.hide()
|
os.system("xdg-open \"http://community.linuxmint.com/index.php/tutorial/search/0/" + text + "\" &")
|
||||||
|
self.mintMenuWin.hide()
|
||||||
|
|
||||||
def search_mint_ideas(self, widget):
|
def search_mint_ideas(self, widget):
|
||||||
text = self.searchEntry.get_text()
|
if self.enableInternetSearch:
|
||||||
text = text.replace(" ", "%20")
|
text = self.searchEntry.get_text()
|
||||||
os.system("xdg-open \"http://community.linuxmint.com/index.php/idea/search/0/" + text + "\" &")
|
text = text.replace(" ", "%20")
|
||||||
self.mintMenuWin.hide()
|
os.system("xdg-open \"http://community.linuxmint.com/index.php/idea/search/0/" + text + "\" &")
|
||||||
|
self.mintMenuWin.hide()
|
||||||
|
|
||||||
def search_mint_users(self, widget):
|
def search_mint_users(self, widget):
|
||||||
text = self.searchEntry.get_text()
|
if self.enableInternetSearch:
|
||||||
text = text.replace(" ", "%20")
|
text = self.searchEntry.get_text()
|
||||||
os.system("xdg-open \"http://community.linuxmint.com/index.php/user/search/0/" + text + "\" &")
|
text = text.replace(" ", "%20")
|
||||||
self.mintMenuWin.hide()
|
os.system("xdg-open \"http://community.linuxmint.com/index.php/user/search/0/" + text + "\" &")
|
||||||
|
self.mintMenuWin.hide()
|
||||||
|
|
||||||
def search_mint_hardware(self, widget):
|
def search_mint_hardware(self, widget):
|
||||||
text = self.searchEntry.get_text()
|
if self.enableInternetSearch:
|
||||||
text = text.replace(" ", "%20")
|
text = self.searchEntry.get_text()
|
||||||
os.system("xdg-open \"http://community.linuxmint.com/index.php/hardware/search/0/" + text + "\" &")
|
text = text.replace(" ", "%20")
|
||||||
self.mintMenuWin.hide()
|
os.system("xdg-open \"http://community.linuxmint.com/index.php/hardware/search/0/" + text + "\" &")
|
||||||
|
self.mintMenuWin.hide()
|
||||||
|
|
||||||
def search_mint_software(self, widget):
|
def search_mint_software(self, widget):
|
||||||
text = self.searchEntry.get_text()
|
if self.enableInternetSearch:
|
||||||
text = text.replace(" ", "%20")
|
text = self.searchEntry.get_text()
|
||||||
os.system("xdg-open \"http://community.linuxmint.com/index.php/software/search/0/" + text + "\" &")
|
text = text.replace(" ", "%20")
|
||||||
self.mintMenuWin.hide()
|
os.system("xdg-open \"http://community.linuxmint.com/index.php/software/search/0/" + text + "\" &")
|
||||||
|
self.mintMenuWin.hide()
|
||||||
|
|
||||||
def add_to_desktop(self, widget, desktopEntry):
|
def add_to_desktop(self, widget, desktopEntry):
|
||||||
os.system("xdg-desktop-icon install --novendor %s" % desktopEntry.desktopFile)
|
os.system("xdg-desktop-icon install --novendor %s" % desktopEntry.desktopFile)
|
||||||
|
@ -313,6 +313,12 @@
|
|||||||
<summary></summary>
|
<summary></summary>
|
||||||
<description></description>
|
<description></description>
|
||||||
</key>
|
</key>
|
||||||
|
|
||||||
|
<key type="b" name="enable-internet-search">
|
||||||
|
<default>false</default>
|
||||||
|
<summary></summary>
|
||||||
|
<description></description>
|
||||||
|
</key>
|
||||||
</schema>
|
</schema>
|
||||||
|
|
||||||
<schema id="com.linuxmint.mintmenu.plugins.system_management" path="/com/linuxmint/mintmenu/plugins/system_management/">
|
<schema id="com.linuxmint.mintmenu.plugins.system_management" path="/com/linuxmint/mintmenu/plugins/system_management/">
|
||||||
|
Loading…
Reference in New Issue
Block a user