diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade index 1385230..dda43c5 100644 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade @@ -830,30 +830,19 @@ - + + Show search bar on top True - False + True + False GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK start - Search command: + True 0 5 - - - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_STRUCTURE_MASK - - False - False - - - 1 - 5 + 2 @@ -904,6 +893,33 @@ 2 + + + True + False + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + start + Search command: + + + 0 + 9 + + + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_STRUCTURE_MASK + + False + False + + + 1 + 9 + + diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py index 2971482..3d0c187 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py @@ -41,6 +41,7 @@ class mintMenuConfig(object): self.startWithFavorites = self.builder.get_object("startWithFavorites") self.showAppComments = self.builder.get_object("showAppComments") + self.search_on_top = self.builder.get_object("search_on_top") self.useAPT = self.builder.get_object("use_apt") self.showCategoryIcons = self.builder.get_object("showCategoryIcons") self.showRecentPlugin = self.builder.get_object("showRecentPlugin") @@ -122,6 +123,7 @@ class mintMenuConfig(object): self.bindGSettingsValueToWidget(self.settings, "bool", "start-with-favorites", self.startWithFavorites, "toggled", self.startWithFavorites.set_active, self.startWithFavorites.get_active) self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "show-application-comments", self.showAppComments, "toggled", self.showAppComments.set_active, self.showAppComments.get_active) + self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "search-on-top", self.search_on_top, "toggled", self.search_on_top.set_active, self.search_on_top.get_active) self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "use-apt", self.useAPT, "toggled", self.useAPT.set_active, self.useAPT.get_active) self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "show-category-icons", self.showCategoryIcons, "toggled", self.showCategoryIcons.set_active, self.showCategoryIcons.get_active) self.bindGSettingsValueToWidget(self.settingsApplications, "bool", "categories-mouse-over", self.hover, "toggled", self.hover.set_active, self.hover.get_active) diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.glade b/usr/lib/linuxmint/mintMenu/plugins/applications.glade index ffc4296..e171e13 100644 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.glade +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.glade @@ -17,7 +17,7 @@ True False - + True False vertical @@ -180,7 +180,7 @@ vertical 3 - + True False True @@ -261,7 +261,7 @@ - + True False @@ -358,7 +358,7 @@ - + 30 True False @@ -415,7 +415,6 @@ False False - end 1 diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index b952bf3..45b8daf 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -172,6 +172,9 @@ class pluginclass(object): self.builder.add_from_file (os.path.join(os.path.dirname(__file__), "applications.glade")) # Read GLADE file + self.main_box = self.builder.get_object("main_box") + self.notebook = self.builder.get_object("notebook2") + self.search_bar = self.builder.get_object("search_bar") self.searchEntry = self.builder.get_object("searchEntry") self.searchButton = self.builder.get_object("searchButton") self.showAllAppsButton = self.builder.get_object("showAllAppsButton") @@ -181,7 +184,6 @@ class pluginclass(object): self.favoritesBox = self.builder.get_object("favoritesBox") self.applicationsScrolledWindow = self.builder.get_object("applicationsScrolledWindow") - self.headingstocolor = [self.builder.get_object("label6"), self.builder.get_object("label2")] self.numApps = 0 # These properties are NECESSARY to maintain consistency @@ -230,6 +232,7 @@ class pluginclass(object): self.settings.notifyAdd("swap-generic-name", self.changeSwapGenericName) self.settings.notifyAdd("show-category-icons", self.changeShowCategoryIcons) self.settings.notifyAdd("show-application-comments", self.changeShowApplicationComments) + self.settings.notifyAdd("search-on-top", self.switch_search_bar_position) self.settings.notifyAdd("use-apt", self.switchAPTUsage) self.settings.notifyAdd("fav-cols", self.changeFavCols) self.settings.notifyAdd("remember-filter", self.changeRememberFilter) @@ -243,6 +246,9 @@ class pluginclass(object): except Exception as e: print(e) + # Position search bar + self.position_search_bar() + self.currentFavCol = 0 self.favorites = [] @@ -376,6 +382,21 @@ class pluginclass(object): if isinstance(child, FavApplicationLauncher): child.setIconSize(self.faviconsize) + def switch_search_bar_position(self, settings, key, args): + self.search_on_top = settings.get_boolean(key) + self.position_search_bar() + + def position_search_bar(self): + """ Set search bar position (top/bottom) based on self.search_on_top """ + self.main_box.remove(self.notebook) + self.main_box.remove(self.search_bar) + if self.search_on_top: + self.main_box.pack_start(self.search_bar, False, False, 0) + self.main_box.pack_start(self.notebook, True, True, 0) + else: + self.main_box.pack_start(self.notebook, True, True, 0) + self.main_box.pack_start(self.search_bar, False, False, 0) + def switchAPTUsage(self, settings, key, args): self.useAPT = settings.get_boolean(key) self.refresh_apt_cache() @@ -462,6 +483,7 @@ class pluginclass(object): self.showcategoryicons = self.settings.get("bool", "show-category-icons") self.categoryhoverdelay = self.settings.get("int", "category-hover-delay") self.showapplicationcomments = self.settings.get("bool", "show-application-comments") + self.search_on_top = self.settings.get("bool", "search-on-top") 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") @@ -520,11 +542,10 @@ class pluginclass(object): self.settings.set("int", "last-active-tab", self.lastActiveTab) def changeTab(self, tabNum, clear = True): - notebook = self.builder.get_object("notebook2") if tabNum == 0: - notebook.set_current_page(0) + self.notebook.set_current_page(0) elif tabNum == 1: - notebook.set_current_page(1) + self.notebook.set_current_page(1) self.focusSearchEntry(clear) self.lastActiveTab = tabNum 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 65c00e9..ef3918d 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 @@ -248,6 +248,12 @@ + + false + + + + true