Add option to remember last category or search when reopening the

menu (default to true, which was previous behavior).
This commit is contained in:
Michael Webster 2013-04-20 19:19:32 -04:00
parent 97167b7656
commit 84aa87727f
4 changed files with 47 additions and 7 deletions

View File

@ -958,7 +958,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">7</property> <property name="n_rows">8</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>
@ -1146,6 +1146,25 @@
<property name="x_padding">5</property> <property name="x_padding">5</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkCheckButton" id="remember_filter">
<property name="label" translatable="yes">Remember the last category or 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">7</property>
<property name="bottom_attach">8</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">

View File

@ -54,6 +54,7 @@ class mintMenuConfig( object ):
self.builder.get_object("showAppComments").set_label(_("Show application comments")) self.builder.get_object("showAppComments").set_label(_("Show application comments"))
self.builder.get_object("showCategoryIcons").set_label(_("Show category icons")) self.builder.get_object("showCategoryIcons").set_label(_("Show category icons"))
self.builder.get_object("hover").set_label(_("Hover")) self.builder.get_object("hover").set_label(_("Hover"))
self.builder.get_object("remember_filter").set_label(_("Remember the last category or search"))
self.builder.get_object("use_apt").set_label(_("Search for packages to install")) self.builder.get_object("use_apt").set_label(_("Search for packages to install"))
self.builder.get_object("swapGeneric").set_label(_("Swap name and generic name")) self.builder.get_object("swapGeneric").set_label(_("Swap name and generic name"))
@ -126,6 +127,7 @@ class mintMenuConfig( object ):
self.swapGeneric = self.builder.get_object("swapGeneric") self.swapGeneric = self.builder.get_object("swapGeneric")
self.hover = self.builder.get_object( "hover" ) self.hover = self.builder.get_object( "hover" )
self.hoverDelay = self.builder.get_object( "hoverDelay" ) self.hoverDelay = self.builder.get_object( "hoverDelay" )
self.rememberFilter = self.builder.get_object( "remember_filter" )
self.iconSize = self.builder.get_object( "iconSize" ) self.iconSize = self.builder.get_object( "iconSize" )
self.favIconSize = self.builder.get_object( "favIconSize" ) self.favIconSize = self.builder.get_object( "favIconSize" )
self.placesIconSize = self.builder.get_object( "placesIconSize" ) self.placesIconSize = self.builder.get_object( "placesIconSize" )
@ -210,6 +212,7 @@ class mintMenuConfig( object ):
self.bindGSettingsValueToWidget( self.settingsApplications, "int", "icon-size", self.iconSize, "value-changed", self.iconSize.set_value, self.iconSize.get_value ) self.bindGSettingsValueToWidget( self.settingsApplications, "int", "icon-size", self.iconSize, "value-changed", self.iconSize.set_value, self.iconSize.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", "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.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 )

View File

@ -297,6 +297,7 @@ class pluginclass( object ):
self.settings.notifyAdd( "show-application-comments", self.changeShowApplicationComments ) self.settings.notifyAdd( "show-application-comments", self.changeShowApplicationComments )
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.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" )
@ -322,7 +323,7 @@ class pluginclass( object ):
self.drag_origin = None self.drag_origin = None
self.rebuildLock = False self.rebuildLock = False
self.activeFilter = (1, "") self.activeFilter = (1, "", self.searchEntry)
self.adminMenu = None self.adminMenu = None
@ -443,6 +444,9 @@ class pluginclass( object ):
self.useAPT = settings.get_boolean(key) self.useAPT = settings.get_boolean(key)
self.refresh_apt_cache() self.refresh_apt_cache()
def changeRememberFilter( self, settings, key, args):
self.rememberFilter = 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:
@ -502,6 +506,7 @@ class pluginclass( object ):
self.categoryhoverdelay = self.settings.get( "int", "category-hover-delay") self.categoryhoverdelay = self.settings.get( "int", "category-hover-delay")
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.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")
@ -553,6 +558,10 @@ class pluginclass( object ):
self.changeTab( 1 ) self.changeTab( 1 )
self.searchEntry.select_region( 0, -1 ) self.searchEntry.select_region( 0, -1 )
if self.rememberFilter:
self.Filter(self.activeFilter[2], self.activeFilter[1])
else:
self.Filter(self.searchEntry, "")
def onHideMenu( self ): def onHideMenu( self ):
self.settings.set( "int", "last-active-tab", self.lastActiveTab ) self.settings.set( "int", "last-active-tab", self.lastActiveTab )
@ -565,7 +574,6 @@ class pluginclass( object ):
notebook.set_current_page( 1 ) notebook.set_current_page( 1 )
self.lastActiveTab = tabNum self.lastActiveTab = tabNum
self.focusSearchEntry() self.focusSearchEntry()
def Todos( self ): def Todos( self ):
@ -581,7 +589,10 @@ class pluginclass( object ):
# restoring the original selection is somehow broken, so just select the end # restoring the original selection is somehow broken, so just select the end
# of the existing text, that's the most likely candidate anyhow # of the existing text, that's the most likely candidate anyhow
self.searchEntry.grab_focus() self.searchEntry.grab_focus()
gtk.gtk_editable_set_position(hash(self.searchEntry), -1) if self.rememberFilter:
gtk.gtk_editable_set_position(hash(self.searchEntry), -1)
else:
self.searchEntry.set_text("")
def buildButtonList( self ): def buildButtonList( self ):
if self.buildingButtonList: if self.buildingButtonList:
@ -800,7 +811,8 @@ class pluginclass( object ):
if self.donotfilterapps: if self.donotfilterapps:
widget.set_text( "" ) widget.set_text( "" )
else: else:
self.changeTab( 1 ) if self.lastActiveTab != 1:
self.changeTab( 1 )
text = widget.get_text() text = widget.get_text()
showns = False # Are any app shown? showns = False # Are any app shown?
for i in self.applicationsBox.get_children(): for i in self.applicationsBox.get_children():
@ -835,10 +847,10 @@ class pluginclass( object ):
allButton = self.categoriesBox.get_children()[0]; allButton = self.categoriesBox.get_children()[0];
allButton.set_relief( Gtk.ReliefStyle.HALF ) allButton.set_relief( Gtk.ReliefStyle.HALF )
self.activeFilter = (0, text) self.activeFilter = (0, text, widget)
else: else:
#print "CATFILTER" #print "CATFILTER"
self.activeFilter = (1, category) self.activeFilter = (1, category, widget)
if category == "": if category == "":
listedDesktopFiles = [] listedDesktopFiles = []
for i in self.applicationsBox.get_children(): for i in self.applicationsBox.get_children():

View File

@ -313,6 +313,12 @@
<summary></summary> <summary></summary>
<description></description> <description></description>
</key> </key>
<key type="b" name="remember-filter">
<default>true</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/">