From 15b6b0100cddd1cd9dde9ead7d62df633a7ec374 Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Thu, 23 Sep 2010 09:54:23 +0100 Subject: [PATCH] Added GTK Bookmarks in places (disabled by default) --- debian/changelog | 6 ++ mintmenu.pot | 98 ++++++++++--------- .../linuxmint/mintMenu/mintMenuConfig.glade | 12 +++ usr/lib/linuxmint/mintMenu/mintMenuConfig.py | 5 +- usr/lib/linuxmint/mintMenu/plugins/places.py | 30 +++++- 5 files changed, 101 insertions(+), 50 deletions(-) diff --git a/debian/changelog b/debian/changelog index 37babff..a2a8a46 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +mintmenu (5.1.0) julia; urgency=low + + * Added GTK bookmarks in places + + -- Clement Lefebvre Thu, 23 Sep 2010 09:54:00 +0000 + mintmenu (5.0.9) julia; urgency=low * Added GTK RC name to mintmenu (allows GTK themes to have mintMenu specific sections) diff --git a/mintmenu.pot b/mintmenu.pot index efa61d9..620bfe9 100644 --- a/mintmenu.pot +++ b/mintmenu.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2010-09-15 17:16+0100\n" +"POT-Creation-Date: 2010-09-23 09:53+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -28,27 +28,27 @@ msgstr "" msgid "Couldn't initialize plugin" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenu.py:537 +#: usr/lib/linuxmint/mintMenu/mintMenu.py:539 msgid "Preferences" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenu.py:537 +#: usr/lib/linuxmint/mintMenu/mintMenu.py:539 msgid "Edit menu" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenu.py:537 +#: usr/lib/linuxmint/mintMenu/mintMenu.py:539 msgid "Reload plugins" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenu.py:537 +#: usr/lib/linuxmint/mintMenu/mintMenu.py:539 msgid "About" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenu.py:745 +#: usr/lib/linuxmint/mintMenu/mintMenu.py:747 msgid "Advanced Gnome Menu" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenu.py:748 +#: usr/lib/linuxmint/mintMenu/mintMenu.py:750 msgid "Based on USP from S.Chanderbally" msgstr "" @@ -212,126 +212,130 @@ msgid "Places" msgstr "" #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:88 -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:99 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:100 msgid "Allow Scrollbar" msgstr "" #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:89 -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:100 -msgid "Height:" +msgid "Show GTK Bookmarks" msgstr "" #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:90 -msgid "Toggle Default Places:" +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:101 +msgid "Height:" msgstr "" #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:91 -#: usr/lib/linuxmint/mintMenu/plugins/places.py:145 -msgid "Computer" +msgid "Toggle Default Places:" msgstr "" #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:92 -#: usr/lib/linuxmint/mintMenu/plugins/places.py:152 -msgid "Home Folder" +#: usr/lib/linuxmint/mintMenu/plugins/places.py:148 +msgid "Computer" msgstr "" #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:93 -#: usr/lib/linuxmint/mintMenu/plugins/places.py:159 -msgid "Network" +#: usr/lib/linuxmint/mintMenu/plugins/places.py:155 +msgid "Home Folder" msgstr "" #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:94 -#: usr/lib/linuxmint/mintMenu/plugins/places.py:179 -msgid "Desktop" +#: usr/lib/linuxmint/mintMenu/plugins/places.py:162 +msgid "Network" msgstr "" #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:95 -#: usr/lib/linuxmint/mintMenu/plugins/places.py:186 -msgid "Trash" +#: usr/lib/linuxmint/mintMenu/plugins/places.py:182 +msgid "Desktop" msgstr "" #: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:96 +#: usr/lib/linuxmint/mintMenu/plugins/places.py:189 +msgid "Trash" +msgstr "" + +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:97 msgid "Custom Places:" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:98 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:99 #: usr/lib/linuxmint/mintMenu/plugins/system_management.py:38 msgid "System" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:101 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:102 msgid "Toggle Default Items:" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:102 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:103 #: usr/lib/linuxmint/mintMenu/plugins/system_management.py:134 msgid "Software Manager" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:103 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:104 #: usr/lib/linuxmint/mintMenu/plugins/system_management.py:141 msgid "Package Manager" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:104 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:105 #: usr/lib/linuxmint/mintMenu/plugins/system_management.py:148 msgid "Control Center" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:105 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:106 #: usr/lib/linuxmint/mintMenu/plugins/system_management.py:155 msgid "Terminal" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:106 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:107 #: usr/lib/linuxmint/mintMenu/plugins/system_management.py:162 msgid "Lock Screen" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:107 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:108 msgid "Log Out" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:108 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:109 #: usr/lib/linuxmint/mintMenu/plugins/system_management.py:176 msgid "Quit" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:110 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:111 msgid "Edit Place" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:111 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:112 msgid "New Place" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:112 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:113 msgid "Select a folder" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:114 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:115 msgid "Keyboard shortcut:" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:245 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:248 msgid "Name" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:246 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:249 msgid "Path" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:261 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:264 msgid "Desktop theme" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:396 -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:430 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:399 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:433 msgid "Name:" msgstr "" -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:397 -#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:431 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:400 +#: usr/lib/linuxmint/mintMenu/mintMenuConfig.py:434 msgid "Path:" msgstr "" @@ -510,27 +514,27 @@ msgstr "" msgid "Shutdown, restart, suspend or hibernate" msgstr "" -#: usr/lib/linuxmint/mintMenu/plugins/places.py:149 +#: usr/lib/linuxmint/mintMenu/plugins/places.py:152 msgid "" "Browse all local and remote disks and folders accessible from this computer" msgstr "" -#: usr/lib/linuxmint/mintMenu/plugins/places.py:156 +#: usr/lib/linuxmint/mintMenu/plugins/places.py:159 msgid "Open your personal folder" msgstr "" -#: usr/lib/linuxmint/mintMenu/plugins/places.py:163 +#: usr/lib/linuxmint/mintMenu/plugins/places.py:166 msgid "Browse bookmarked and local network locations" msgstr "" -#: usr/lib/linuxmint/mintMenu/plugins/places.py:183 +#: usr/lib/linuxmint/mintMenu/plugins/places.py:186 msgid "Browse items placed on the desktop" msgstr "" -#: usr/lib/linuxmint/mintMenu/plugins/places.py:192 +#: usr/lib/linuxmint/mintMenu/plugins/places.py:195 msgid "Browse deleted files" msgstr "" -#: usr/lib/linuxmint/mintMenu/plugins/places.py:207 +#: usr/lib/linuxmint/mintMenu/plugins/places.py:232 msgid "Empty trash" msgstr "" diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade index eaefe62..5cf80d9 100644 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.glade @@ -1095,6 +1095,18 @@ 2 + + + Show GTK bookmarks + True + True + False + True + + + 3 + + True diff --git a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py index b977195..e8a8e5d 100755 --- a/usr/lib/linuxmint/mintMenu/mintMenuConfig.py +++ b/usr/lib/linuxmint/mintMenu/mintMenuConfig.py @@ -86,6 +86,7 @@ class mintMenuConfig( object ): wTree.get_widget("placesLabel").set_text(_("Places")) wTree.get_widget("allowscrollbarcheckbutton").set_label(_("Allow Scrollbar")) + wTree.get_widget("showgtkbookmarkscheckbutton").set_label(_("Show GTK Bookmarks")) wTree.get_widget("placesHeightEntryLabel").set_text(_("Height:")) wTree.get_widget("defaultPlacesFrameLabel").set_text(_("Toggle Default Places:")) wTree.get_widget("computercheckbutton").set_label(_("Computer")) @@ -149,10 +150,11 @@ class mintMenuConfig( object ): self.trashtoggle = wTree.get_widget( "trashcheckbutton" ) self.customplacestree = wTree.get_widget( "customplacestree" ) self.allowPlacesScrollbarToggle = wTree.get_widget( "allowscrollbarcheckbutton" ) + self.showgtkbookmarksToggle = wTree.get_widget( "showgtkbookmarkscheckbutton" ) self.placesHeightButton = wTree.get_widget( "placesHeightSpinButton" ) if (self.allowPlacesScrollbarToggle.get_active() == False): self.placesHeightButton.set_sensitive(False) - self.allowPlacesScrollbarToggle.connect("toggled", self.togglePlacesHeightEnabled ) + self.allowPlacesScrollbarToggle.connect("toggled", self.togglePlacesHeightEnabled ) self.softwareManagerToggle = wTree.get_widget( "softwaremanagercheckbutton" ) self.packageManagerToggle = wTree.get_widget( "packagemanagercheckbutton" ) self.controlCenterToggle = wTree.get_widget( "controlcentercheckbutton" ) @@ -218,6 +220,7 @@ class mintMenuConfig( object ): self.bindGconfValueToWidget( self.gconfPlaces, "bool", "show_trash", self.trashtoggle, "toggled", self.trashtoggle.set_active, self.trashtoggle.get_active ) self.bindGconfValueToWidget( self.gconfPlaces, "int", "height", self.placesHeightButton, "value-changed", self.placesHeightButton.set_value, self.placesHeightButton.get_value_as_int ) self.bindGconfValueToWidget( self.gconfPlaces, "bool", "allowScrollbar", self.allowPlacesScrollbarToggle, "toggled", self.allowPlacesScrollbarToggle.set_active, self.allowPlacesScrollbarToggle.get_active ) + self.bindGconfValueToWidget( self.gconfPlaces, "bool", "show_gtk_bookmarks", self.showgtkbookmarksToggle, "toggled", self.showgtkbookmarksToggle.set_active, self.showgtkbookmarksToggle.get_active ) self.bindGconfValueToWidget( self.gconfSystem, "bool", "show_software_manager", self.softwareManagerToggle, "toggled", self.softwareManagerToggle.set_active, self.softwareManagerToggle.get_active ) self.bindGconfValueToWidget( self.gconfSystem, "bool", "show_package_manager", self.packageManagerToggle, "toggled", self.packageManagerToggle.set_active, self.packageManagerToggle.get_active ) diff --git a/usr/lib/linuxmint/mintMenu/plugins/places.py b/usr/lib/linuxmint/mintMenu/plugins/places.py index 5156016..5d4d660 100755 --- a/usr/lib/linuxmint/mintMenu/plugins/places.py +++ b/usr/lib/linuxmint/mintMenu/plugins/places.py @@ -57,6 +57,7 @@ class pluginclass( object ): self.gconf.notifyAdd( "custom_names", self.RegenPlugin ) self.gconf.notifyAdd( "custom_paths", self.RegenPlugin ) self.gconf.notifyAdd( "allowScrollbar", self.RegenPlugin ) + self.gconf.notifyAdd( "show_gtk_bookmarks", self.RegenPlugin ) self.gconf.notifyAdd( "height", self.changePluginSize ) self.gconf.notifyAdd( "width", self.changePluginSize ) self.gconf.bindGconfEntryToVar( "bool", "sticky", self, "sticky" ) @@ -73,7 +74,7 @@ class pluginclass( object ): self.gconf.notifyRemoveAll() def changePluginSize( self, client, connection_id, entry, args ): - self.allowScrollbar = self.gconf.get( "bool", "allowScrollbar", False) + self.allowScrollbar = self.gconf.get( "bool", "allowScrollbar", False) if entry.get_key() == self.gconf.gconfDir+"width": self.width = entry.get_value().get_int() elif entry.get_key() == self.gconf.gconfDir+"height": @@ -93,11 +94,13 @@ class pluginclass( object ): self.ClearAll() self.do_standard_places() self.do_custom_places() + self.do_gtk_bookmarks() def GetGconfEntries( self ): self.width = self.gconf.get( "int", "width", 200 ) - self.allowScrollbar = self.gconf.get( "bool", "allowScrollbar", False) + self.allowScrollbar = self.gconf.get( "bool", "allowScrollbar", True) + self.showGTKBookmarks = self.gconf.get( "bool", "show_gtk_bookmarks", False) self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC ) self.height = self.gconf.get( "int", "height", 180 ) self.content_holder.set_size_request( self.width, self.height ) @@ -201,6 +204,28 @@ class pluginclass( object ): currentbutton.show() self.placesBtnHolder.pack_start( currentbutton, False, False ) + def do_gtk_bookmarks( self ): + if self.showGTKBookmarks: + bookmarks = {} + with open(os.path.expanduser('~/.gtk-bookmarks'), 'r') as f: + for line in f: + line = line.replace('file://', '') + line = line.rstrip() + parts = line.split(' ') + + if len(parts) == 2: + bookmarks[parts[1]] = parts[0] + elif len(parts) == 1: + junk = os.path.split(parts[0]) + bookmarks[junk[len(junk) - 1]] = parts[0] + + for name, path in bookmarks.iteritems(): + command = ( "nautilus \"" + path + "\"") + currentbutton = easyButton( "folder", self.iconsize, [name], -1, -1 ) + currentbutton.connect( "clicked", self.ButtonClicked, command ) + currentbutton.show() + self.placesBtnHolder.pack_start( currentbutton, False, False ) + def trashPopup( self, widget, event ): if event.button == 3: trashMenu = gtk.Menu() @@ -225,6 +250,7 @@ class pluginclass( object ): def do_plugin( self ): self.do_standard_places() self.do_custom_places() + self.do_gtk_bookmarks() def refreshTrash (self): iconName = "user-trash"