From 66f76df4d31488caa178d053dc53d52f29dca43d Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Mon, 20 May 2019 15:19:55 +0100 Subject: [PATCH] Remove obsolete code --- usr/lib/linuxmint/mintMenu/mintMenu.py | 14 +- .../mintMenu/plugins/applications.py | 126 ++++++++---------- .../mintMenu/plugins/easygsettings.py | 92 ------------- usr/lib/linuxmint/mintMenu/plugins/places.py | 66 ++++----- usr/lib/linuxmint/mintMenu/plugins/recent.py | 44 ++---- .../mintMenu/plugins/system_management.py | 62 ++++----- .../com.linuxmint.mintmenu.gschema.xml | 47 ------- 7 files changed, 126 insertions(+), 325 deletions(-) delete mode 100644 usr/lib/linuxmint/mintMenu/plugins/easygsettings.py diff --git a/usr/lib/linuxmint/mintMenu/mintMenu.py b/usr/lib/linuxmint/mintMenu/mintMenu.py index 8357646..160c6f8 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenu.py +++ b/usr/lib/linuxmint/mintMenu/mintMenu.py @@ -207,18 +207,8 @@ class MainWindow(object): self.headingsToColor.append(label1) Align1.show() label1.show() - - if not hasattr(MyPlugin, 'sticky') or MyPlugin.sticky: - heading = Gtk.EventBox() - Align1.set_padding(0, 0, 10, 0) - heading.set_visible_window(False) - heading.set_size_request(MyPlugin.width, 30) - else: - heading = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) - #heading.set_relief(Gtk.ReliefStyle.NONE) - heading.set_size_request(MyPlugin.width, -1) - #heading.set_sensitive(False) - #heading.connect("button_press_event", self.TogglePluginView, VBox1, MyPlugin.icon, MyPlugin.heading, MyPlugin) + heading = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) + heading.set_size_request(MyPlugin.width, -1) heading.add(Align1) heading.show() diff --git a/usr/lib/linuxmint/mintMenu/plugins/applications.py b/usr/lib/linuxmint/mintMenu/plugins/applications.py index b67da19..e2cc457 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/applications.py +++ b/usr/lib/linuxmint/mintMenu/plugins/applications.py @@ -18,7 +18,6 @@ import plugins.recentHelper as RecentHelper from plugins.easybuttons import (ApplicationLauncher, CategoryButton, FavApplicationLauncher, MenuApplicationLauncher) -from plugins.easygsettings import EasyGSettings # i18n gettext.install("mintmenu", "/usr/share/linuxmint/locale") @@ -227,27 +226,26 @@ class pluginclass(object): # self.searchButton.connect("button_release_event", self.SearchWithButton) try: # GSettings stuff - self.settings = EasyGSettings("com.linuxmint.mintmenu.plugins.applications") + self.settings = Gio.Settings("com.linuxmint.mintmenu.plugins.applications") self.GetGSettingsEntries() - self.settings.notifyAdd("icon-size", self.changeIconSize) - self.settings.notifyAdd("favicon-size", self.changeFavIconSize) - self.settings.notifyAdd("height", self.changePluginSize) - self.settings.notifyAdd("width", self.changePluginSize) - self.settings.notifyAdd("categories-mouse-over", self.changeCategoriesMouseOver) - 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.positionSearchBar) - 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") + self.settings.connect("changed::icon-size", self.changeIconSize) + self.settings.connect("changed::favicon-size", self.changeFavIconSize) + self.settings.connect("changed::height", self.changePluginSize) + self.settings.connect("changed::width", self.changePluginSize) + self.settings.connect("changed::categories-mouse-over", self.changeCategoriesMouseOver) + self.settings.connect("changed::swap-generic-name", self.changeSwapGenericName) + self.settings.connect("changed::show-category-icons", self.changeShowCategoryIcons) + self.settings.connect("changed::show-application-comments", self.changeShowApplicationComments) + self.settings.connect("changed::search-on-top", self.positionSearchBar) + self.settings.connect("changed::use-apt", self.switchAPTUsage) + self.settings.connect("changed::fav-cols", self.changeFavCols) + self.settings.connect("changed::remember-filter", self.changeRememberFilter) + self.settings.connect("changed::enable-internet-search", self.changeEnableInternetSearch) + self.settings.connect("changed::category-hover-delay", self.GetGSettingsEntries) + self.settings.connect("changed::do-not-filter", self.GetGSettingsEntries) + self.settings.connect("changed::enable-internet-search", self.GetGSettingsEntries) + self.settings.connect("changed::search-command", self.GetGSettingsEntries) + self.settings.connect("changed::default-tab", self.GetGSettingsEntries) except Exception as e: print(e) @@ -337,9 +335,7 @@ class pluginclass(object): self.mintMenuWin.window.disconnect(self.keyPress_handler) - self.settings.notifyRemoveAll() - - def changePluginSize(self, settings, key, args): + def changePluginSize(self, settings, key): if key == "width": self.width = settings.get_int(key) self.applicationsBox.set_size_request(self.width - self.categoriesBox.get_preferred_width().natural_width, -1) @@ -348,14 +344,14 @@ class pluginclass(object): self.heigth = settings.get_int(key) self.content_holder.set_size_request(self.width, self.height) - def changeSwapGenericName(self, settings, key, args): + def changeSwapGenericName(self, settings, key): self.swapgeneric = settings.get_boolean(key) for child in self.favoritesBox: if isinstance(child, FavApplicationLauncher): child.setSwapGeneric(self.swapgeneric) - def changeShowCategoryIcons(self, settings, key, args): + def changeShowCategoryIcons(self, settings, key): self.showcategoryicons = settings.get_boolean(key) if self.showcategoryicons: @@ -366,7 +362,7 @@ class pluginclass(object): for child in self.categoriesBox: child.setIconSize(categoryIconSize) - def changeIconSize(self, settings, key, args): + def changeIconSize(self, settings, key): self.iconSize = settings.get_int(key) if self.showcategoryicons: @@ -383,39 +379,39 @@ class pluginclass(object): except: pass - def changeFavIconSize(self, settings, key, args): + def changeFavIconSize(self, settings, key): self.faviconsize = settings.get_int(key) for child in self.favoritesBox: if isinstance(child, FavApplicationLauncher): child.setIconSize(self.faviconsize) - def positionSearchBar(self, settings=None, key=None, args=None): + def positionSearchBar(self, settings=None, key=None): self.main_box.remove(self.notebook) self.main_box.remove(self.search_bar) - if self.settings.get("bool", "search-on-top"): + if self.settings.get_boolean("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): + def switchAPTUsage(self, settings, key): self.useAPT = settings.get_boolean(key) self.refresh_apt_cache() - def changeRememberFilter(self, settings, key, args): + def changeRememberFilter(self, settings, key): self.rememberFilter = settings.get_boolean(key) - def changeEnableInternetSearch(self, settings, key, args): + def changeEnableInternetSearch(self, settings, key): self.enableInternetSearch = settings.get_boolean(key) - def changeShowApplicationComments(self, settings, key, args): + def changeShowApplicationComments(self, settings, key): self.showapplicationcomments = settings.get_boolean(key) for child in self.applicationsBox: child.setShowComment(self.showapplicationcomments) - def changeCategoriesMouseOver(self, settings, key, args): + def changeCategoriesMouseOver(self, settings, key): self.categories_mouse_over = settings.get_boolean(key) for child in self.categoriesBox: if self.categories_mouse_over and not child.mouseOverHandlerIds: @@ -427,7 +423,7 @@ class pluginclass(object): child.disconnect(child.mouseOverHandlerIds[1]) child.mouseOverHandlerIds = None - def changeFavCols(self, settings, key, args): + def changeFavCols(self, settings, key): self.favCols = settings.get_int(key) for fav in self.favorites: self.favoritesBox.remove(fav) @@ -445,8 +441,6 @@ class pluginclass(object): oldswapgeneric = self.swapgeneric oldshowcategoryicons = self.showcategoryicons oldcategoryhoverdelay = self.categoryhoverdelay - oldsticky = self.sticky - oldminimized = self.minimized oldicon = self.icon oldhideseparator = self.hideseparator oldshowapplicationcomments = self.showapplicationcomments @@ -460,8 +454,6 @@ class pluginclass(object): oldswapgeneric == self.swapgeneric and oldshowcategoryicons == self.showcategoryicons and oldcategoryhoverdelay == self.categoryhoverdelay and - oldsticky == self.sticky and - oldminimized == self.minimized and oldicon == self.icon and oldhideseparator == self.hideseparator and oldshowapplicationcomments == self.showapplicationcomments @@ -473,47 +465,37 @@ class pluginclass(object): RecentHelper.buildRecentApps() self.RebuildPlugin() - def GetGSettingsEntries(self): + def GetGSettingsEntries(self, settings=None, key=None): - self.categories_mouse_over = self.settings.get("bool", "categories-mouse-over") - self.width = self.settings.get("int", "width") - self.height = self.settings.get("int", "height") - self.donotfilterapps = self.settings.get("bool", "do-not-filter") - self.iconSize = self.settings.get("int", "icon-size") - self.faviconsize = self.settings.get("int", "favicon-size") - self.favCols = self.settings.get("int", "fav-cols") - self.swapgeneric = self.settings.get("bool", "swap-generic-name") - 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.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.categories_mouse_over = self.settings.get_boolean("categories-mouse-over") + self.width = self.settings.get_int("width") + self.height = self.settings.get_int("height") + self.donotfilterapps = self.settings.get_boolean("do-not-filter") + self.iconSize = self.settings.get_int("icon-size") + self.faviconsize = self.settings.get_int("favicon-size") + self.favCols = self.settings.get_int("fav-cols") + self.swapgeneric = self.settings.get_boolean("swap-generic-name") + self.showcategoryicons = self.settings.get_boolean("show-category-icons") + self.categoryhoverdelay = self.settings.get_int("category-hover-delay") + self.showapplicationcomments = self.settings.get_boolean("show-application-comments") + self.useAPT = self.settings.get_boolean("use-apt") + self.rememberFilter = self.settings.get_boolean("remember-filter") + self.enableInternetSearch = self.settings.get_boolean("enable-internet-search") - self.lastActiveTab = self.settings.get("int", "last-active-tab") - self.defaultTab = self.settings.get("int", "default-tab") - - # Allow plugin to be minimized to the left plugin pane - self.sticky = self.settings.get("bool", "sticky") - self.minimized = self.settings.get("bool", "minimized") + self.lastActiveTab = self.settings.get_int("last-active-tab") + self.defaultTab = self.settings.get_int("default-tab") # Search tool - self.searchtool = self.settings.get("string", "search-command") + self.searchtool = self.settings.get_string("search-command") if self.searchtool == "beagle-search SEARCH_STRING": self.searchtool = "mate-search-tool --named \"%s\" --start" - self.settings.set("string", "search-command", "mate-search-tool --named \"%s\" --start") + self.settings.set_string("search-command", "mate-search-tool --named \"%s\" --start") # Plugin icon - self.icon = self.settings.get("string", "icon") + self.icon = self.settings.get_string("icon") # Hide vertical dotted separator - self.hideseparator = self.settings.get("bool", "hide-separator") - - def SetHidden(self, minimized): - if minimized: - self.settings.set("bool", "minimized", True) - else: - self.settings.set("bool", "minimized", False) + self.hideseparator = self.settings.get_boolean("hide-separator") def RebuildPlugin(self): self.content_holder.set_size_request(self.width, self.height) @@ -541,7 +523,7 @@ class pluginclass(object): self.Filter(self.activeFilter[2], self.activeFilter[1]) def onHideMenu(self): - self.settings.set("int", "last-active-tab", self.lastActiveTab) + self.settings.set_int("last-active-tab", self.lastActiveTab) def changeTab(self, tabNum, clear = True): notebook = self.builder.get_object("notebook2") diff --git a/usr/lib/linuxmint/mintMenu/plugins/easygsettings.py b/usr/lib/linuxmint/mintMenu/plugins/easygsettings.py deleted file mode 100644 index 96891da..0000000 --- a/usr/lib/linuxmint/mintMenu/plugins/easygsettings.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/python2 - -from gi.repository import Gio - - -class EasyGSettings: - - def __init__(self, schema = None): - self.schema = schema - self.settings = Gio.Settings.new(self.schema) - self.handlerIds = [] - - def get(self, type, key): - - if type == "bool": - return self.settings.get_boolean(key) - if type == "string": - return self.settings.get_string(key) - if type == "int": - return self.settings.get_int(key) - if type == "color": - color = self.settings.get_string(key) - if not self.evalColor(color): - self.settings.set_string(key, "#ffffff") - return "#ffffff" - return color - - t = type.split("-") - if len(t) == 2 and t[0] == "list": - return self.settings.get_strv(key) - - return self.settings.get(key) - - def set(self, type, key, value): - - if type == "bool": - return self.settings.set_boolean(key, value) - - if type == "string": - return self.settings.set_string(key, value) - - if type == "int": - return self.settings.set_int(key, value) - - if type == "color": - if self.evalColor(value): - return self.settings.set_string(key, value) - else: - return self.settings.set_string(key, "#ffffff") - - t = type.split("-") - if len(t) == 2 and t[0] == "list": - return self.settings.set_strv(key, value) - - return self.settings.set(key, value) - - def notifyAdd(self, key, callback, args = None): - handlerId = self.settings.connect("changed::"+key, callback, args) - self.handlerIds.append(handlerId) - return handlerId - - def notifyRemove(self, handlerId): - return self.settings.disconnect(handlerId) - - def notifyRemoveAll(self): - for handlerId in self.handlerIds: - self.settings.disconnect(handlerId) - - def evalColor(self, colorToTest): - if colorToTest[0] != '#' or len(colorToTest) != 7: - return False - for i in colorToTest[1:]: - if i not in ['a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']: - return False - return True - - def bindGSettingsEntryToVar(self, type, key, obj, varName): - return self.notifyAdd(key, self.setVar, (type, obj, varName)) - - def setVar(self, settings, key, args): - type, obj, varName = args - - if type == "string": - setattr(obj, varName, settings.get_string(key)) - elif type == "int": - setattr(obj, varName, settings.get_int(key)) - elif type == "float": - setattr(obj, varName, settings.get_float(key)) - elif type == "bool": - setattr(obj, varName, settings.get_boolean(key)) - else: - setattr(obj, varName, settings.get_value(key)) diff --git a/usr/lib/linuxmint/mintMenu/plugins/places.py b/usr/lib/linuxmint/mintMenu/plugins/places.py index 26d1e47..c47026d 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/places.py +++ b/usr/lib/linuxmint/mintMenu/plugins/places.py @@ -12,10 +12,8 @@ gi.require_version("Gtk", "3.0") from gi.repository import Gtk, Gio, GLib from plugins.easybuttons import easyButton -from plugins.easygsettings import EasyGSettings from plugins.execute import Execute - # i18n gettext.install("mintmenu", "/usr/share/linuxmint/locale") locale.bindtextdomain("mintmenu", "/usr/share/linuxmint/locale") @@ -54,19 +52,19 @@ class pluginclass(object): self.itemstocolor = [builder.get_object("viewport2")] # Settings - self.settings = EasyGSettings("com.linuxmint.mintmenu.plugins.places") + self.settings = Gio.Settings("com.linuxmint.mintmenu.plugins.places") - self.settings.notifyAdd("icon-size", self.RegenPlugin) - self.settings.notifyAdd("show-computer", self.RegenPlugin) - self.settings.notifyAdd("show-desktop", self.RegenPlugin) - self.settings.notifyAdd("show-home_folder", self.RegenPlugin) - self.settings.notifyAdd("show-network", self.RegenPlugin) - self.settings.notifyAdd("show-trash", self.RegenPlugin) - self.settings.notifyAdd("custom-names", self.RegenPlugin) - self.settings.notifyAdd("allow-scrollbar", self.RegenPlugin) - self.settings.notifyAdd("show-gtk-bookmarks", self.RegenPlugin) - self.settings.notifyAdd("height", self.changePluginSize) - self.settings.notifyAdd("width", self.changePluginSize) + self.settings.connect("changed::icon-size", self.RegenPlugin) + self.settings.connect("changed::show-computer", self.RegenPlugin) + self.settings.connect("changed::show-desktop", self.RegenPlugin) + self.settings.connect("changed::show-home_folder", self.RegenPlugin) + self.settings.connect("changed::show-network", self.RegenPlugin) + self.settings.connect("changed::show-trash", self.RegenPlugin) + self.settings.connect("changed::custom-names", self.RegenPlugin) + self.settings.connect("changed::allow-scrollbar", self.RegenPlugin) + self.settings.connect("changed::show-gtk-bookmarks", self.RegenPlugin) + self.settings.connect("changed::height", self.changePluginSize) + self.settings.connect("changed::width", self.changePluginSize) self.loadSettings() @@ -76,18 +74,15 @@ class pluginclass(object): if self.showtrash: self.refreshTrash() - def destroy(self): - self.settings.notifyRemoveAll() - def changePluginSize(self, settings, key, args = None): - self.allowScrollbar = self.settings.get("bool", "allow-scrollbar") - self.width = self.settings.get("int", "width") + self.allowScrollbar = self.settings.get_boolean("allow-scrollbar") + self.width = self.settings.get_int("width") if not self.allowScrollbar: self.height = -1 self.scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER) else: self.scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) - self.height = self.settings.get("int", "height") + self.height = self.settings.get_int("height") self.content_holder.set_size_request(self.width, self.height) def RegenPlugin(self, *args, **kargs): @@ -98,39 +93,36 @@ class pluginclass(object): self.do_gtk_bookmarks() def loadSettings(self): - self.width = self.settings.get("int", "width") - self.allowScrollbar = self.settings.get("bool", "allow-scrollbar") - self.showGTKBookmarks = self.settings.get("bool", "show-gtk-bookmarks") + self.width = self.settings.get_int("width") + self.allowScrollbar = self.settings.get_boolean("allow-scrollbar") + self.showGTKBookmarks = self.settings.get_boolean("show-gtk-bookmarks") self.scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) - self.height = self.settings.get("int", "height") + self.height = self.settings.get_int("height") self.content_holder.set_size_request(self.width, self.height) if not self.allowScrollbar: self.height = -1 self.scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER) self.content_holder.set_size_request(self.width, self.height) - self.iconsize = self.settings.get("int", "icon-size") + self.iconsize = self.settings.get_int("icon-size") # Check default items - self.showcomputer = self.settings.get("bool", "show-computer") - self.showhomefolder = self.settings.get("bool", "show-home-folder") - self.shownetwork = self.settings.get("bool", "show-network") - self.showdesktop = self.settings.get("bool", "show-desktop") - self.showtrash = self.settings.get("bool", "show-trash") + self.showcomputer = self.settings.get_boolean("show-computer") + self.showhomefolder = self.settings.get_boolean("show-home-folder") + self.shownetwork = self.settings.get_boolean("show-network") + self.showdesktop = self.settings.get_boolean("show-desktop") + self.showtrash = self.settings.get_boolean("show-trash") # Get paths for custom items - self.custompaths = self.settings.get("list-string", "custom-paths") + self.custompaths = self.settings.get_strv("custom-paths") # Get names for custom items - self.customnames = self.settings.get("list-string", "custom-names") + self.customnames = self.settings.get_strv("custom-names") # Hide vertical dotted separator - self.hideseparator = self.settings.get("bool", "hide-separator") + self.hideseparator = self.settings.get_boolean("hide-separator") # Plugin icon - self.icon = self.settings.get("string", "icon") - # Allow plugin to be minimized to the left plugin pane - self.sticky = self.settings.get("bool", "sticky") - self.minimized = self.settings.get("bool", "minimized") + self.icon = self.settings.get_string("icon") def ClearAll(self): for child in self.placesBtnHolder.get_children(): diff --git a/usr/lib/linuxmint/mintMenu/plugins/recent.py b/usr/lib/linuxmint/mintMenu/plugins/recent.py index 8daec5d..f18a005 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/recent.py +++ b/usr/lib/linuxmint/mintMenu/plugins/recent.py @@ -1,16 +1,15 @@ #!/usr/bin/python2 -import os -import subprocess import gettext import locale +import os +import subprocess import gi gi.require_version("Gtk", "3.0") -from gi.repository import Gtk +from gi.repository import Gtk, Gio import plugins.recentHelper as RecentHelper -from plugins.easygsettings import EasyGSettings from plugins.execute import Execute # i18n @@ -56,15 +55,11 @@ class pluginclass: #Plugin icon self.icon = 'mate-folder.png' - self.settings = EasyGSettings("com.linuxmint.mintmenu.plugins.recent") + self.settings = Gio.Settings("com.linuxmint.mintmenu.plugins.recent") + self.settings.connect('changed', self.RegenPlugin) - self.settings.notifyAdd('height', self.RegenPlugin) - self.settings.notifyAdd('width', self.RegenPlugin) - self.settings.notifyAdd('num-recent-docs', self.RegenPlugin) - self.settings.notifyAdd('recent-font-size', self.RegenPlugin) - - self.appSettings = EasyGSettings("com.linuxmint.mintmenu.plugins.applications") - self.appSettings.notifyAdd("icon-size", self.RegenPlugin) + self.appSettings = Gio.Settings("com.linuxmint.mintmenu.plugins.applications") + self.appSettings.connect("changed::icon-size", self.RegenPlugin) self.FileList=[] self.RecManagerInstance = Gtk.RecentManager.get_default() @@ -86,7 +81,6 @@ class pluginclass: self.builder.get_object("RecentTabs").destroy() self.builder.get_object("ClrBtn").destroy() self.content_holder.destroy() - self.settings.notifyRemoveAll() if self.recentManagerId: self.RecManagerInstance.disconnect(self.recentManagerId) @@ -94,29 +88,19 @@ class pluginclass: self.GetGSettingsEntries() def GetGSettingsEntries(self): - self.recenth = self.settings.get('int', 'height') - self.recentw = self.settings.get('int', 'width') - self.numentries = self.settings.get('int', 'num-recent-docs') + self.recenth = self.settings.get_int("height") + self.recentw = self.settings.get_int("width") + self.numentries = self.settings.get_int("num-recent-docs") RecentHelper.numentries = self.numentries - - self.recentfontsize = self.settings.get('int', 'recent-font-size') + self.recentfontsize = self.settings.get_int("recent-font-size") # Hide vertical dotted separator - self.hideseparator = self.settings.get("bool", "hide-separator") + self.hideseparator = self.settings.get_boolean("hide-separator") # Plugin icon - self.icon = self.settings.get("string", 'icon') - # Allow plugin to be minimized to the left plugin pane - self.sticky = self.settings.get("bool", "sticky") - self.minimized = self.settings.get("bool", "minimized") - RecentHelper.iconSize = self.appSettings.get("int", "icon-size") + self.icon = self.settings.get_string("icon") + RecentHelper.iconSize = self.appSettings.get_int("icon-size") self.RebuildPlugin() - def SetHidden(self, minimized): - if minimized: - self.settings.set("bool", "minimized", True) - else: - self.settings.set("bool", "minimized", False) - def RebuildPlugin(self): self.content_holder.set_size_request(self.recentw, self.recenth) self.DoRecent() diff --git a/usr/lib/linuxmint/mintMenu/plugins/system_management.py b/usr/lib/linuxmint/mintMenu/plugins/system_management.py index d8d6c51..673ee5d 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/system_management.py +++ b/usr/lib/linuxmint/mintMenu/plugins/system_management.py @@ -6,10 +6,9 @@ import locale import gi gi.require_version("Gtk", "3.0") -from gi.repository import Gtk +from gi.repository import Gtk, Gio from plugins.easybuttons import easyButton -from plugins.easygsettings import EasyGSettings from plugins.execute import Execute # i18n @@ -48,33 +47,29 @@ class pluginclass(object): self.itemstocolor = [self.builder.get_object("viewport2")] # Gconf stuff - self.settings = EasyGSettings("com.linuxmint.mintmenu.plugins.system_management") + self.settings = Gio.Settings("com.linuxmint.mintmenu.plugins.system_management") - self.settings.notifyAdd("icon-size", self.RegenPlugin) - self.settings.notifyAdd("show-control-center", self.RegenPlugin) - self.settings.notifyAdd("show-lock-screen", self.RegenPlugin) - self.settings.notifyAdd("show-logout", self.RegenPlugin) - self.settings.notifyAdd("show-package-manager", self.RegenPlugin) - self.settings.notifyAdd("show-software-manager", self.RegenPlugin) - self.settings.notifyAdd("show-terminal", self.RegenPlugin) - self.settings.notifyAdd("show-quit", self.RegenPlugin) - self.settings.notifyAdd("allow-scrollbar", self.RegenPlugin) - self.settings.notifyAdd("height", self.changePluginSize) - self.settings.notifyAdd("width", self.changePluginSize) - self.settings.bindGSettingsEntryToVar("bool", "sticky", self, "sticky") + self.settings.connect("changed::icon-size", self.RegenPlugin) + self.settings.connect("changed::show-control-center", self.RegenPlugin) + self.settings.connect("changed::show-lock-screen", self.RegenPlugin) + self.settings.connect("changed::show-logout", self.RegenPlugin) + self.settings.connect("changed::show-package-manager", self.RegenPlugin) + self.settings.connect("changed::show-software-manager", self.RegenPlugin) + self.settings.connect("changed::show-terminal", self.RegenPlugin) + self.settings.connect("changed::show-quit", self.RegenPlugin) + self.settings.connect("changed::allow-scrollbar", self.RegenPlugin) + self.settings.connect("changed::height", self.changePluginSize) + self.settings.connect("changed::width", self.changePluginSize) self.GetGSettingsEntries() self.content_holder.set_size_request(self.width, self.height) - def destroy(self): - self.settings.notifyRemoveAll() - def wake(self): pass def changePluginSize(self, settings, key, args): - self.allowScrollbar = self.settings.get("bool", "allow-scrollbar") + self.allowScrollbar = self.settings.get_boolean("allow-scrollbar") if key == "width": self.width = settings.get_int(key) elif key == "height": @@ -95,25 +90,25 @@ class pluginclass(object): def GetGSettingsEntries(self): - self.width = self.settings.get("int", "width") - self.allowScrollbar = self.settings.get("bool", "allow-scrollbar") + self.width = self.settings.get_int("width") + self.allowScrollbar = self.settings.get_boolean("allow-scrollbar") self.scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) - self.height = self.settings.get("int", "height") + self.height = self.settings.get_int("height") self.content_holder.set_size_request(self.width, self.height) if not self.allowScrollbar: self.height = -1 self.scrolledWindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER) self.content_holder.set_size_request(self.width, self.height) - self.iconsize = self.settings.get("int","icon-size") + self.iconsize = self.settings.get_int("icon-size") # Check toggles - self.showSoftwareManager = self.settings.get("bool", "show-software-manager") - self.showPackageManager = self.settings.get("bool", "show-package-manager") - self.showControlCenter = self.settings.get("bool", "show-control-center") - self.showTerminal = self.settings.get("bool", "show-terminal") - self.showLockScreen = self.settings.get("bool", "show-lock-screen") - self.showLogout = self.settings.get("bool", "show-logout") - self.showQuit = self.settings.get("bool", "show-quit") + self.showSoftwareManager = self.settings.get_boolean("show-software-manager") + self.showPackageManager = self.settings.get_boolean("show-package-manager") + self.showControlCenter = self.settings.get_boolean("show-control-center") + self.showTerminal = self.settings.get_boolean("show-terminal") + self.showLockScreen = self.settings.get_boolean("show-lock-screen") + self.showLogout = self.settings.get_boolean("show-logout") + self.showQuit = self.settings.get_boolean("show-quit") if self.de == "cinnamon": self.lock_cmd = "cinnamon-screensaver-command --lock" @@ -137,12 +132,9 @@ class pluginclass(object): self.settings_cmd = "mate-control-center" # Hide vertical dotted separator - self.hideseparator = self.settings.get("bool", "hide-separator") + self.hideseparator = self.settings.get_boolean("hide-separator") # Plugin icon - self.icon = self.settings.get("string", "icon") - # Allow plugin to be minimized to the left plugin pane - self.sticky = self.settings.get("bool", "sticky") - self.minimized = self.settings.get("bool", "minimized") + self.icon = self.settings.get_string("icon") def ClearAll(self): for child in self.systemBtnHolder.get_children(): 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 4b1ed9b..16697af 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 @@ -83,17 +83,6 @@ - - false - - - - - - false - - - false @@ -266,18 +255,6 @@ - - false - - - - - - false - - - - "mate-search-tool --named \"%s\" --start" @@ -389,18 +366,6 @@ - - false - - - - - - false - - - - "preferences-system" @@ -446,18 +411,6 @@ - - false - - - - - - false - - - -