Started migrating places plugin..

This commit is contained in:
Clement Lefebvre 2013-03-04 16:50:14 +00:00
parent 3dbd270225
commit c940e3a735
5 changed files with 267 additions and 153 deletions

View File

@ -3,7 +3,7 @@
import gi
gi.require_version("Gtk", "2.0")
from gi.repository import Gtk, Gdk
from gi.repository import Gtk, GdkPixbuf, Gdk
from gi.repository import MatePanelApplet
from gi.repository import Gio
@ -21,14 +21,14 @@ except Exception, e:
print e
sys.exit( 1 )
#global mbindkey
global mbindkey
# Load the key binding lib (developped by deskbar-applet, copied into mintMenu so we don't end up with an unnecessary dependency)
#try:
# from deskbar.core.keybinder import tomboy_keybinder_bind as bind_key
#except Exception, cause:
# print "*********** Keybind Driver Load Failure **************"
# print "Error Report : ", str(cause)
# pass
try:
from deskbar.core.keybinder import tomboy_keybinder_bind as bind_key
except Exception, cause:
print "*********** Keybind Driver Load Failure **************"
print "Error Report : ", str(cause)
pass
# Rename the process
architecture = commands.getoutput("uname -a")
@ -58,8 +58,8 @@ if not windowManager:
windowManager = "MATE"
xdg.Config.setWindowManager( windowManager.upper() )
#from easybuttons import iconManager
#from execute import *
from easybuttons import iconManager
#from execute import * COMMENTED DURING MIGRATION
class MainWindow( object ):
"""This is the main class for the application"""
@ -76,12 +76,14 @@ class MainWindow( object ):
self.icon = "/usr/lib/linuxmint/mintMenu/visualisation-logo.png"
self.toggle = toggleButton
# Load glade file and extract widgets
gladefile = os.path.join( self.path, "mintMenu.glade" )
wTree = Gtk.glade.XML( gladefile, "mainWindow" )
self.window = wTree.get_widget( "mainWindow" )
self.paneholder = wTree.get_widget( "paneholder" )
self.border = wTree.get_widget( "border" )
# Load UI file and extract widgets
builder = Gtk.Builder()
builder.add_from_file(os.path.join( self.path, "mintMenu.ui" ))
self.window = builder.get_object( "mainWindow" )
self.paneholder = builder.get_object( "paneholder" )
self.border = builder.get_object( "border" )
builder.connect_signals(self)
self.panesToColor = [ ]
self.headingsToColor = [ ]
@ -98,9 +100,6 @@ class MainWindow( object ):
plugindir = os.path.join( os.path.expanduser( "~" ), ".linuxmint/mintMenu/plugins" )
sys.path.append( plugindir )
dic = {"on_window1_destroy" : self.quit_cb}
wTree.signal_autoconnect( dic )
self.getSetGconfEntries()
self.SetupMintMenuBorder()
self.SetupMintMenuOpacity()
@ -126,7 +125,7 @@ class MainWindow( object ):
self.settings.connect( "changed::border_width", self.toggleBorderWidth )
self.settings.connect( "changed::opacity", self.toggleOpacity )
def quit_cb (self):
def on_window1_destroy (self, widget, data=None):
Gtk.main_quit()
sys.exit(0)
@ -196,10 +195,11 @@ class MainWindow( object ):
self.globalEnableTooltips = mate_settings.get_boolean( "tooltips-enabled" )
def SetupMintMenuBorder( self ):
if self.usecustomcolor:
self.window.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.custombordercolor ) )
else:
self.window.modify_bg( Gtk.StateType.NORMAL, self.window.rc_get_style().bg[ Gtk.StateType.SELECTED ] )
# COMMENTED DURING MIGRATION
#if self.usecustomcolor:
# self.window.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.custombordercolor ) )
#else:
# self.window.modify_bg( Gtk.StateType.NORMAL, self.window.rc_get_style().bg[ Gtk.StateType.SELECTED ] )
self.border.set_padding( self.borderwidth, self.borderwidth, self.borderwidth, self.borderwidth )
def SetupMintMenuOpacity( self ):
@ -240,8 +240,6 @@ class MainWindow( object ):
self.plugins = {}
for plugin in self.pluginlist:
#Bypass
break
if plugin in self.plugins:
print u"Duplicate plugin in list: ", plugin
continue
@ -384,13 +382,13 @@ class MainWindow( object ):
for item in items:
if item not in self.panesToColor:
self.panesToColor.append( item )
if self.usecustomcolor:
for item in items:
item.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.customcolor ) )
else:
for item in items:
item.modify_bg( Gtk.StateType.NORMAL, self.paneholder.rc_get_style().bg[ Gtk.StateType.NORMAL ] )
#COMMENTED DURING MIGRATION
#if self.usecustomcolor:
# for item in items:
# item.modify_bg( Gtk.StateType.NORMAL, Gdk.color_parse( self.customcolor ) )
#else:
# for item in items:
# item.modify_bg( Gtk.StateType.NORMAL, self.paneholder.rc_get_style().bg[ Gtk.StateType.NORMAL ] )
def SetHeadingStyle( self, items ):
@ -466,7 +464,8 @@ class MainWindow( object ):
Gdk.keyboard_ungrab()
def onMap( self, widget, event ):
self.grab()
#self.grab() COMMENTED DURING MIGRATION
pass
def onShow( self, widget ):
for plugin in self.plugins.values():
@ -474,7 +473,7 @@ class MainWindow( object ):
plugin.onShowMenu()
def onUnmap( self, widget, event ):
self.ungrab()
#self.ungrab() COMMENTED DURING MIGRATION
for plugin in self.plugins.values():
if hasattr( plugin, "onHideMenu" ):
@ -520,7 +519,7 @@ class MainWindow( object ):
class MenuWin( object ):
def __init__( self, applet, iid ):
self.applet = applet
self.settings = Gio.Settings.new_with_path("com.linuxmint.mintmenu", self.applet.get_preferences_path())
self.settings = Gio.Settings.new("com.linuxmint.mintmenu")
self.settings.connect( "changed::applet_text", self.reloadSettings )
self.settings.connect( "changed::theme_name", self.changeTheme )
@ -550,7 +549,7 @@ class MenuWin( object ):
icon = iconManager.getIcon( self.mainwin.icon, 1 )
if icon:
Gtk.window_set_default_icon( icon )
Gtk.Window.set_default_icon( icon )
self.propxml = """
<popup name="button3">
@ -722,6 +721,7 @@ class MenuWin( object ):
self.button_icon.hide()
else:
self.button_icon.show()
# COMMENTED DURING MIGRATION
# This code calculates width and height for the button_box
# and takes the orientation in account
#if self.applet.get_orient() == MatePanelApplet.AppletOrient.UP or self.applet.get_orient() == MatePanelApplet.AppletOrient.DOWN:
@ -801,7 +801,7 @@ class MenuWin( object ):
ourHeight = self.mainwin.window.get_size()[1] + self.mainwin.offset
# Get the dimensions/position of the widgetToAlignWith
entryX, entryY = self.applet.window.get_origin()
entryX, entryY = self.applet.get_allocation().x, self.applet.get_allocation().y
entryWidth, entryHeight = self.applet.get_allocation().width, self.applet.get_allocation().height
entryHeight = entryHeight + self.mainwin.offset

View File

@ -0,0 +1,29 @@
<?xml version="1.0"?>
<interface>
<!-- interface-requires gtk+ 2.10 -->
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="mainWindow">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK</property>
<property name="type">popup</property>
<property name="resizable">False</property>
<property name="type_hint">menu</property>
<property name="skip_taskbar_hint">True</property>
<property name="skip_pager_hint">True</property>
<property name="decorated">False</property>
<property name="deletable">False</property>
<signal handler="gtk_widget_hide" name="key_press_event"/>
<child>
<object class="GtkAlignment" id="border">
<property name="visible">True</property>
<child>
<object class="GtkHBox" id="paneholder">
<property name="visible">True</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@ -1,40 +1,40 @@
#!/usr/bin/env python
import gtk
import pango
import matedesktop
import gobject
from gi.repository import Gtk, GdkPixbuf, Gdk
from gi.repository import Pango
#import matedesktop
from gi.repository import GObject
import os.path
import shutil
import re
from execute import *
#from execute import *
import xdg.DesktopEntry
import xdg.Menu
from filemonitor import monitor as filemonitor
import glib
class IconManager(gobject.GObject):
class IconManager(GObject.GObject):
__gsignals__ = {
"changed" : (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, () )
"changed" : (GObject.SignalFlags.RUN_LAST, None, () )
}
def __init__( self ):
gobject.GObject.__init__( self )
GObject.GObject.__init__( self )
self.icons = { }
self.count = 0
# Some apps don't put a default icon in the default theme folder, so we will search all themes
def createTheme( d ):
theme = gtk.IconTheme()
theme = Gtk.IconTheme()
theme.set_custom_theme( d )
return theme
# This takes to much time and there are only a very few applications that use icons from different themes
#self.themes = map( createTheme, [ d for d in os.listdir( "/usr/share/icons" ) if os.path.isdir( os.path.join( "/usr/share/icons", d ) ) ] )
defaultTheme = gtk.icon_theme_get_default()
defaultTheme = Gtk.IconTheme()
defaultKdeTheme = createTheme( "kde.default" )
# Themes with the same content as the default them aren't needed
@ -80,7 +80,7 @@ class IconManager(gobject.GObject):
iconFileName = ""
if iconFileName and os.path.exists( iconFileName ):
icon = gtk.gdk.pixbuf_new_from_file_at_size( iconFileName, iconSize, iconSize )
icon = GdkPixbuf.Pixbuf.new_from_file_at_size( iconFileName, iconSize, iconSize )
else:
icon = None
@ -88,9 +88,9 @@ class IconManager(gobject.GObject):
# if the actual icon size is to far from the desired size resize it
if icon and (( icon.get_width() - iconSize ) > 5 or ( icon.get_height() - iconSize ) > 5):
if icon.get_width() > icon.get_height():
newIcon = icon.scale_simple( iconSize, icon.get_height() * iconSize / icon.get_width(), gtk.gdk.INTERP_BILINEAR )
newIcon = icon.scale_simple( iconSize, icon.get_height() * iconSize / icon.get_width(), GdkPixbuf.InterpType.BILINEAR )
else:
newIcon = icon.scale_simple( icon.get_width() * iconSize / icon.get_height(), iconSize, gtk.gdk.INTERP_BILINEAR )
newIcon = icon.scale_simple( icon.get_width() * iconSize / icon.get_height(), iconSize, GdkPixbuf.InterpType.BILINEAR )
del icon
icon = newIcon
@ -108,26 +108,26 @@ class IconManager(gobject.GObject):
self.cache = { }
self.emit( "changed" )
gobject.type_register(IconManager)
GObject.type_register(IconManager)
class easyButton( gtk.Button ):
class easyButton( Gtk.Button ):
def __init__( self, iconName, iconSize, labels = None, buttonWidth = -1, buttonHeight = -1 ):
gtk.Button.__init__( self )
GObject.GObject.__init__( self )
self.connections = [ ]
self.iconName = iconName
self.iconSize = iconSize
self.showIcon = True
self.set_relief( gtk.RELIEF_NONE )
self.set_relief( Gtk.ReliefStyle.NONE )
self.set_size_request( buttonWidth, buttonHeight )
Align1 = gtk.Alignment( 0, 0.5, 1.0, 0 )
HBox1 = gtk.HBox()
self.labelBox = gtk.VBox( False, 2 )
Align1 = Gtk.Alignment.new( 0, 0.5, 1.0, 0 )
HBox1 = Gtk.HBox()
self.labelBox = Gtk.VBox( False, 2 )
self.buttonImage = gtk.Image()
self.buttonImage = Gtk.Image()
icon = self.getIcon( self.iconSize )
if icon:
self.buttonImage.set_from_pixbuf( icon )
@ -146,7 +146,7 @@ class easyButton( gtk.Button ):
self.addLabel( label[0], label[1] )
self.labelBox.show()
HBox1.pack_start( self.labelBox )
HBox1.pack_start( self.labelBox , True, True, 0)
HBox1.show()
Align1.add( HBox1 )
Align1.show()
@ -161,7 +161,7 @@ class easyButton( gtk.Button ):
self.connections.append( self.connect( event, callback ) )
def onRelease( self, widget ):
widget.set_state(gtk.STATE_NORMAL)
widget.set_state(Gtk.StateType.NORMAL)
def onDestroy( self, widget ):
self.buttonImage.clear()
@ -172,22 +172,22 @@ class easyButton( gtk.Button ):
def addLabel( self, text, styles = None ):
label = gtk.Label()
label = Gtk.Label()
if "<b>" in text:
label.set_markup(text) # don't remove our pango
else:
label.set_markup(glib.markup_escape_text(text))
if styles:
labelStyle = pango.AttrList()
labelStyle = Pango.AttrList()
for attr in styles:
labelStyle.insert( attr )
label.set_attributes( labelStyle )
label.set_ellipsize( pango.ELLIPSIZE_END )
label.set_ellipsize( Pango.EllipsizeMode.END )
label.set_alignment( 0.0, 1.0 )
label.show()
self.labelBox.pack_start( label )
self.labelBox.pack_start( label , True, True, 0)
def getIcon ( self, iconSize ):
@ -263,9 +263,9 @@ class ApplicationLauncher( easyButton ):
# Drag and Drop
self.connectSelf( "drag_data_get", self.dragDataGet )
self.drag_source_set( gtk.gdk.BUTTON1_MASK , [ ( "text/plain", 0, 100 ), ( "text/uri-list", 0, 101 ) ], gtk.gdk.ACTION_COPY )
self.drag_source_set( Gdk.ModifierType.BUTTON1_MASK , [ ( "text/plain", 0, 100 ), ( "text/uri-list", 0, 101 ) ], Gdk.DragAction.COPY )
icon = self.getIcon( gtk.ICON_SIZE_DND )
icon = self.getIcon( Gtk.IconSize.DND )
if icon:
self.drag_source_set_icon_pixbuf( icon )
del icon
@ -315,10 +315,10 @@ class ApplicationLauncher( easyButton ):
def onFocusIn( self, widget, event ):
self.set_relief( gtk.RELIEF_HALF )
self.set_relief( Gtk.ReliefStyle.HALF )
def onFocusOut( self, widget, event ):
self.set_relief( gtk.RELIEF_NONE )
self.set_relief( Gtk.ReliefStyle.NONE )
def onEnterNotify( self, widget, event ):
self.grab_focus()
@ -379,7 +379,7 @@ class ApplicationLauncher( easyButton ):
def iconChanged( self ):
easyButton.iconChanged( self )
icon = self.getIcon( gtk.ICON_SIZE_DND )
icon = self.getIcon( Gtk.IconSize.DND )
if icon:
self.drag_source_set_icon_pixbuf( icon )
del icon
@ -471,7 +471,7 @@ class MenuApplicationLauncher( ApplicationLauncher ):
appComment = self.appComment
if self.highlight:
try:
#color = self.labelBox.rc_get_style().fg[ gtk.STATE_SELECTED ].to_string()
#color = self.labelBox.rc_get_style().fg[ Gtk.StateType.SELECTED ].to_string()
#if len(color) > 0 and color[0] == "#":
#appName = "<span foreground=\"%s\"><b>%s</b></span>" % (color, appName);
#appComment = "<span foreground=\"%s\"><b>%s</b></span>" % (color, appComment);
@ -488,11 +488,11 @@ class MenuApplicationLauncher( ApplicationLauncher ):
if self.showComment and self.appComment != "":
if self.iconSize <= 2:
self.addLabel( appName, [ pango.AttrScale( pango.SCALE_SMALL, 0, -1 ) ] )
self.addLabel( appComment, [ pango.AttrScale( pango.SCALE_X_SMALL, 0, -1 ) ] )
self.addLabel( appName, [ Pango.AttrScale( Pango.SCALE_SMALL, 0, -1 ) ] )
self.addLabel( appComment, [ Pango.AttrScale( Pango.SCALE_X_SMALL, 0, -1 ) ] )
else:
self.addLabel( appName )
self.addLabel( appComment, [ pango.AttrScale( pango.SCALE_SMALL, 0, -1 ) ] )
self.addLabel( appComment, [ Pango.AttrScale( Pango.SCALE_SMALL, 0, -1 ) ] )
else:
self.addLabel( appName )
@ -520,13 +520,13 @@ class FavApplicationLauncher( ApplicationLauncher ):
def setupLabels( self ):
if self.appGenericName:
if self.swapGeneric:
self.addLabel( self.appName, [ pango.AttrWeight( pango.WEIGHT_BOLD, 0, -1 ) ] )
self.addLabel( self.appName, [ Pango.AttrWeight( Pango.Weight.BOLD, 0, -1 ) ] )
self.addLabel( self.appGenericName )
else:
self.addLabel( self.appGenericName, [ pango.AttrWeight( pango.WEIGHT_BOLD, 0, -1 ) ] )
self.addLabel( self.appGenericName, [ Pango.AttrWeight( Pango.Weight.BOLD, 0, -1 ) ] )
self.addLabel( self.appName )
else:
self.addLabel( self.appName, [ pango.AttrWeight( pango.WEIGHT_BOLD, 0, -1 ) ] )
self.addLabel( self.appName, [ Pango.AttrWeight( Pango.Weight.BOLD, 0, -1 ) ] )
if self.appComment != "":
self.addLabel( self.appComment )
else:

View File

@ -1,7 +1,6 @@
#!/usr/bin/env python
import gtk
import gtk.glade
from gi.repository import Gtk
import os
import string
import gettext
@ -10,7 +9,6 @@ import time
from easybuttons import *
from execute import Execute
from easygconf import EasyGConf
from user import home
from urllib import unquote
@ -25,44 +23,44 @@ class pluginclass( object ):
self.toggleButton = toggleButton
self.de = de
# Read GLADE file
gladefile = os.path.join( os.path.dirname( __file__ ), "places.glade" )
wTree = gtk.glade.XML( gladefile, "mainWindow" )
self.placesBtnHolder = wTree.get_widget( "places_button_holder" )
self.editableBtnHolder = wTree.get_widget( "editable_button_holder" )
self.scrolledWindow=wTree.get_widget("scrolledwindow2")
# Read UI file
builder = Gtk.Builder()
builder.add_from_file(os.path.join( os.path.dirname( __file__ ), "places.ui" ))
self.placesBtnHolder = builder.get_object( "places_button_holder" )
self.editableBtnHolder = builder.get_object( "editable_button_holder" )
self.scrolledWindow=builder.get_object("scrolledwindow2")
# These properties are NECESSARY to maintain consistency
# Set 'window' property for the plugin (Must be the root widget)
self.window = wTree.get_widget( "mainWindow" )
self.window = builder.get_object( "mainWindow" )
# Set 'heading' property for plugin
self.heading = _("Places")
# This should be the first item added to the window in glade
self.content_holder = wTree.get_widget( "Places" )
self.content_holder = builder.get_object( "Places" )
# Items to get custom colors
self.itemstocolor = [ wTree.get_widget( "viewport2" ) ]
self.itemstocolor = [ builder.get_object( "viewport2" ) ]
# Gconf stuff
self.gconf = EasyGConf( "/apps/mintMenu/plugins/places/" )
# Settings
self.settings = Gio.Settings.new("com.linuxmint.mintmenu")
self.gconf.notifyAdd( "icon_size", self.RegenPlugin )
self.gconf.notifyAdd( "show_computer", self.RegenPlugin )
self.gconf.notifyAdd( "show_desktop", self.RegenPlugin )
self.gconf.notifyAdd( "show_home_folder", self.RegenPlugin )
self.gconf.notifyAdd( "show_network", self.RegenPlugin )
self.gconf.notifyAdd( "show_trash", self.RegenPlugin )
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" )
self.settings.connect( "changed::places-icon-size", self.RegenPlugin )
self.settings.connect( "changed::places-show-computer", self.RegenPlugin )
self.settings.connect( "changed::places-show-desktop", self.RegenPlugin )
self.settings.connect( "changed::places-show-home_folder", self.RegenPlugin )
self.settings.connect( "changed::places-show-network", self.RegenPlugin )
self.settings.connect( "changed::places-show-trash", self.RegenPlugin )
self.settings.connect( "changed::places-custom-names", self.RegenPlugin )
self.settings.connect( "changed::places-custom-paths", self.RegenPlugin )
self.settings.connect( "changed::places-allow-scrollbar", self.RegenPlugin )
self.settings.connect( "changed::places-show-gtk-bookmarks", self.RegenPlugin )
self.settings.connect( "changed::places-height", self.changePluginSize )
self.settings.connect( "changed::places-width", self.changePluginSize )
self.GetGconfEntries()
self.loadSettings()
self.content_holder.set_size_request( self.width, self.height )
@ -71,69 +69,60 @@ class pluginclass( object ):
self.refreshTrash()
def destroy( self ):
self.gconf.notifyRemoveAll()
self.settings.disconnect_all()
def changePluginSize( self, client, connection_id, entry, args ):
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":
if (self.allowScrollbar == False):
self.height = -1
self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER )
else:
self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC )
self.height = entry.get_value().get_int()
self.allowScrollbar = self.settings.get_boolean( "places-allow-scrollbar" )
self.width = self.settings.get_int( "places-width" )
if (self.allowScrollbar == False):
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( "places-height" )
self.content_holder.set_size_request( self.width, self.height )
def RegenPlugin( self, *args, **kargs ):
self.GetGconfEntries()
self.loadSettings()
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.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 )
def loadSettings( self ):
self.width = self.settings.get_int( "places-width" )
self.allowScrollbar = self.settings.get_boolean( "places-allow-scrollbar" )
self.showGTKBookmarks = self.settings.get_boolean( "places-show-gtk-bookmarks" )
self.scrolledWindow.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC )
self.height = self.settings.get_int( "places-height" )
self.content_holder.set_size_request( self.width, self.height )
if (self.allowScrollbar == False):
self.height = -1
self.scrolledWindow.set_policy( gtk.POLICY_AUTOMATIC, gtk.POLICY_NEVER )
self.scrolledWindow.set_policy( Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.NEVER )
self.content_holder.set_size_request( self.width, self.height )
self.execapp = self.gconf.get( "string", "execute_app", "nautilus" )
self.iconsize = self.gconf.get( "int","icon_size", 16 )
self.iconsize = self.settings.get_int( "places-icon-size" )
# Check default items
self.showcomputer = self.gconf.get( "bool", "show_computer", True )
self.showhomefolder = self.gconf.get( "bool", "show_home_folder", True )
self.shownetwork = self.gconf.get( "bool", "show_network", True )
self.showdesktop = self.gconf.get( "bool", "show_desktop", True )
self.showtrash = self.gconf.get( "bool", "show_trash", True )
self.showcomputer = self.settings.get_boolean( "places-show_computer" )
self.showhomefolder = self.settings.get_boolean( "places-show-home-folder" )
self.shownetwork = self.settings.get_boolean( "places-show-network" )
self.showdesktop = self.settings.get_boolean( "places-show-desktop" )
self.showtrash = self.settings.get_boolean( "places-show-trash" )
# Get paths for custom items
self.custompaths = self.gconf.get( "list-string", "custom_paths", [ ] )
self.custompaths = self.settings.get_strv( "places-custom-paths" )
# Get names for custom items
self.customnames = self.gconf.get( "list-string", "custom_names", [ ] )
self.customnames = self.settings.get_strv( "places-custom-names" )
# Hide vertical dotted separator
self.hideseparator = self.gconf.get( "bool", "hide_separator", False )
self.hideseparator = self.settings.get_boolean( "places-hide-separator" )
# Plugin icon
self.icon = self.gconf.get( "string", 'icon', "mate-fs-directory.png" )
self.icon = self.settings_get_string( "places-icon" )
# Allow plugin to be minimized to the left plugin pane
self.sticky = self.gconf.get( "bool", "sticky", False )
self.minimized = self.gconf.get( "bool", "minimized", False )
self.sticky = self.settings.get_boolean( "places-sticky", False )
self.minimized = self.settings.get_boolean( "places-minimized", False )
def ClearAll(self):
for child in self.placesBtnHolder.get_children():
@ -165,8 +154,8 @@ class pluginclass( object ):
self.mintMenuWin.setTooltip( Button2, _("Open your personal folder") )
if ( self.shownetwork == True and self.de == "mate"):
gconftheme = EasyGConf( "/desktop/mate/interface/" )
icon_theme = gconftheme.get("string", "icon_theme", "Mint-X")
mate_settings = Gio.Settings.new("org.mate.interface")
icon_theme = mate_settings.get_string( "icon-theme" )
if "Mint-X" in icon_theme:
Button3 = easyButton( "notification-network-ethernet-connected", self.iconsize, [_("Network")], -1, -1)
else:
@ -260,8 +249,8 @@ class pluginclass( object ):
def trashPopup( self, widget, event ):
if event.button == 3:
trashMenu = gtk.Menu()
emptyTrashMenuItem = gtk.MenuItem(_("Empty trash"))
trashMenu = Gtk.Menu()
emptyTrashMenuItem = Gtk.MenuItem(_("Empty trash"))
trashMenu.append(emptyTrashMenuItem)
trashMenu.show_all()
emptyTrashMenuItem.connect ( "activate", self.emptyTrash, widget )

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<schemalist>
<schema id="com.linuxmint.mintmenu">
<schema id="com.linuxmint.mintmenu" path="/com/linuxmint/mintmenu/">
<key type="b" name="hide-applet-icon">
<default>false</default>
@ -98,5 +98,101 @@
<description></description>
</key>
<key type="b" name="places-sticky">
<default>false</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="places-minimized">
<default>false</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="places-allow-scrollbar">
<default>false</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="places-show-gtk-bookmarks">
<default>false</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="places-hide-separator">
<default>false</default>
<summary></summary>
<description></description>
</key>
<key type="i" name="places-height">
<default>180</default>
<summary></summary>
<description></description>
</key>
<key type="i" name="places-width">
<default>200</default>
<summary></summary>
<description></description>
</key>
<key type="i" name="places-icon-size">
<default>16</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="places-show-computer">
<default>true</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="places-show-home-folder">
<default>true</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="places-show-network">
<default>true</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="places-show-desktop">
<default>true</default>
<summary></summary>
<description></description>
</key>
<key type="b" name="places-show-trash">
<default>true</default>
<summary></summary>
<description></description>
</key>
<key type="as" name="places-custom-paths">
<default>[]</default>
<summary></summary>
<description></description>
</key>
<key type="as" name="places-custom-names">
<default>[]</default>
<summary></summary>
<description></description>
</key>
<key type="s" name="places-icon">
<default>"mate-fs-directory.png"</default>
<summary></summary>
<description></description>
</key>
</schema>
</schemalist>