Fix Add to Panel launcher creation

This commit is contained in:
Michael Webster 2013-03-09 11:43:54 -05:00
parent 50d3bb0c65
commit 9895c54409
2 changed files with 28 additions and 41 deletions

View File

@ -118,18 +118,18 @@ class MainWindow( object ):
self.PopulatePlugins(); self.PopulatePlugins();
self.settings.connect( "changed::plugins_list", self.RegenPlugins ) self.settings.connect( "changed::plugins-list", self.RegenPlugins )
self.settings.connect( "changed::start_with_favorites", self.toggleStartWithFavorites ) self.settings.connect( "changed::start-with-favorites", self.toggleStartWithFavorites )
globalsettings = Gio.Settings.new("org.mate.panel") globalsettings = Gio.Settings.new("org.mate.panel")
globalsettings.connect( "changed::tooltips-enabled", self.toggleTooltipsEnabled ) globalsettings.connect( "changed::tooltips-enabled", self.toggleTooltipsEnabled )
self.settings.connect( "changed::tooltips_enabled", self.toggleTooltipsEnabled ) self.settings.connect( "changed::tooltips-enabled", self.toggleTooltipsEnabled )
self.settings.connect( "changed::use_custom_color", self.toggleUseCustomColor ) self.settings.connect( "changed::use-custom-color", self.toggleUseCustomColor )
self.settings.connect( "changed::custom_border_color", self.toggleCustomBorderColor ) self.settings.connect( "changed::custom-border-color", self.toggleCustomBorderColor )
self.settings.connect( "changed::custom_heading_color", self.toggleCustomHeadingColor ) self.settings.connect( "changed::custom-heading-color", self.toggleCustomHeadingColor )
self.settings.connect( "changed::custom_color", self.toggleCustomBackgroundColor ) self.settings.connect( "changed::custom-color", self.toggleCustomBackgroundColor )
self.settings.connect( "changed::border_width", self.toggleBorderWidth ) self.settings.connect( "changed::border-width", self.toggleBorderWidth )
self.settings.connect( "changed::opacity", self.toggleOpacity ) self.settings.connect( "changed::opacity", self.toggleOpacity )
def on_window1_destroy (self, widget, data=None): def on_window1_destroy (self, widget, data=None):

View File

@ -349,8 +349,8 @@ class pluginclass( object ):
os.system("/usr/lib/linuxmint/mintMenu/plugins/get_apt_cache.py > %s/.linuxmint/mintMenu/apt.cache &" % home) os.system("/usr/lib/linuxmint/mintMenu/plugins/get_apt_cache.py > %s/.linuxmint/mintMenu/apt.cache &" % home)
def get_panel(self): def get_panel(self):
self.panel = None self.panel = "top"
self.panel_position = 0 self.panel_position = -1
panelsettings = Gio.Settings.new("org.mate.panel") panelsettings = Gio.Settings.new("org.mate.panel")
applet_list = panelsettings.get_strv("object-id-list") applet_list = panelsettings.get_strv("object-id-list")
for applet in applet_list: for applet in applet_list:
@ -358,7 +358,7 @@ class pluginclass( object ):
keys = object_schema.list_keys() keys = object_schema.list_keys()
if "applet-iid" in keys: if "applet-iid" in keys:
iid = object_schema.get_string("applet-iid") iid = object_schema.get_string("applet-iid")
if iid is not None and iid.find("MintMenuApplet") > 0: if iid is not None and iid.find("MintMenu") != -1:
self.panel = object_schema.get_string("toplevel-id") self.panel = object_schema.get_string("toplevel-id")
self.panel_position = object_schema.get_int("position") + 1 self.panel_position = object_schema.get_int("position") + 1
@ -1171,38 +1171,25 @@ class pluginclass( object ):
print detail print detail
def add_to_panel(self, widget, desktopEntry): def add_to_panel(self, widget, desktopEntry):
import random i = 0
object_name = "mintmenu_"+''.join([random.choice('abcdefghijklmnopqrstuvwxyz0123456789') for x in xrange(8)]) panel_schema = Gio.Settings.new("org.mate.panel")
new_directory = home + "/.mate2/panel2.d/default/launchers/" applet_list = panel_schema.get_strv("object-id-list")
os.system("mkdir -p " + new_directory)
new_file = new_directory + object_name
# Copy the desktop file to the panels directory while True:
os.system("cp \"%s\" \"%s\"" % (desktopEntry.desktopFile, new_file)) test_obj = "object_%d" % (i)
os.system("chmod a+rx %s" % (new_file)) if test_obj in applet_list:
i += 1
else:
break
#FIX # Add to Gnome/GConf path = "/org/mate/panel/objects/%s/" % (test_obj)
# object_dir = "/apps/panel/objects/" new_schema = Gio.Settings.new_with_path("org.mate.panel.object", path)
# object_client = mateconf.client_get_default() new_schema.set_string("launcher-location", desktopEntry.desktopFile)
new_schema.set_string("object-type", "launcher")
# object_client.set_string(object_dir + object_name +"/"+ "menu_path", "applications:/") new_schema.set_string("toplevel-id", self.panel)
# object_client.set_bool(object_dir + object_name +"/"+ "locked", False) new_schema.set_int("position", self.panel_position)
# object_client.set_int(object_dir + object_name +"/"+ "position", self.panel_position) applet_list.append(test_obj)
# object_client.set_string(object_dir + object_name +"/"+ "object_type", "launcher-object") panel_schema.set_strv("object-id-list", applet_list)
# object_client.set_bool(object_dir + object_name +"/"+ "panel_right_stick", False)
# object_client.set_bool(object_dir + object_name +"/"+ "use_menu_path", False)
# object_client.set_string(object_dir + object_name +"/"+ "launcher_location", new_file)
# object_client.set_string(object_dir + object_name +"/"+ "custom_icon", "")
# object_client.set_string(object_dir + object_name +"/"+ "tooltip", "")
# object_client.set_string(object_dir + object_name +"/"+ "action_type", "lock")
# object_client.set_bool(object_dir + object_name +"/"+ "use_custom_icon", False)
# object_client.set_string(object_dir + object_name +"/"+ "attached_toplevel_id", "")
# object_client.set_string(object_dir + object_name +"/"+ "bonobo_iid", "")
# object_client.set_string(object_dir + object_name +"/"+ "toplevel_id", self.panel)
# launchers_list = object_client.get_list("/apps/panel/general/object_id_list", "string")
# launchers_list.append(object_name)
# object_client.set_list("/apps/panel/general/object_id_list", mateconf.VALUE_STRING, launchers_list)
def delete_from_menu(self, widget, desktopEntry): def delete_from_menu(self, widget, desktopEntry):
try: try: