[gnome-panel/bonobo-less] Remove bonobo from gnome-panel-add script too
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel/bonobo-less] Remove bonobo from gnome-panel-add script too
- Date: Fri, 26 Feb 2010 17:08:40 +0000 (UTC)
commit 9a93e1fda49a9c4e6e9fbfbe5fb6fcb5d18f65bf
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Fri Feb 26 18:07:52 2010 +0100
Remove bonobo from gnome-panel-add script too
gnome-panel/Makefile.am | 5 +++-
gnome-panel/gnome-panel-add.in | 42 ++++++++++++++++++++++++++++++++++++---
2 files changed, 42 insertions(+), 5 deletions(-)
---
diff --git a/gnome-panel/Makefile.am b/gnome-panel/Makefile.am
index e8b8ec6..b847691 100644
--- a/gnome-panel/Makefile.am
+++ b/gnome-panel/Makefile.am
@@ -197,7 +197,10 @@ ui_DATA = \
libexec_SCRIPTS = gnome-panel-add
gnome-panel-add: gnome-panel-add.in Makefile
- $(AM_V_GEN)sed -e s!\ PYTHON\@! PYTHON@! < $< > $@
+ $(AM_V_GEN)sed \
+ -e s!\ PYTHON\@! PYTHON@! \
+ -e s!\ PANEL_APPLETS_DIR\@!$(appletsdir)! \
+ < $< > $@
$(AM_V_at)chmod a+x $@
EXTRA_DIST = \
diff --git a/gnome-panel/gnome-panel-add.in b/gnome-panel/gnome-panel-add.in
index f549732..0709b6f 100644
--- a/gnome-panel/gnome-panel-add.in
+++ b/gnome-panel/gnome-panel-add.in
@@ -26,8 +26,8 @@ import os
import shutil
import sys
import urllib
+import ConfigParser
-import bonobo
import gconf
PANEL_SCHEMAS_OBJECTS_DIR='/schemas/apps/panel/objects'
@@ -45,6 +45,10 @@ PANEL_TYPE_NONE = 0
PANEL_TYPE_APPLET = 1
PANEL_TYPE_LAUNCHER = 2
+PANEL_APPLETS_EXTENSION='.panel-applet'
+PANEL_APPLETS_PATH='@PANEL_APPLETS_DIR@'
+PANEL_APPLET_FACTORY_GROUP='Applet Factory'
+
class PanelAddException(Exception):
pass
@@ -106,12 +110,42 @@ class PanelAdder:
raise PanelAddException('Cannot find a panel identifier')
+ def _get_applet_list(self):
+ dirs = os.getenv('PANEL_APPLETS_DIR')
+ if not dirs:
+ dirs = PANEL_APPLETS_PATH
+
+ retval = dups = []
+ for path in dirs.split(":"):
+ if not os.path.isdir(path):
+ continue
+
+ if path in dups:
+ continue
+
+ dups.append(path)
+
+ for f in os.listdir(path):
+ if not f.endswith(PANEL_APPLETS_EXTENSION):
+ continue
+
+ config = ConfigParser.RawConfigParser()
+ try:
+ config.read(os.path.join(path, f))
+ except ConfigParser.ParsingError:
+ continue
+
+ fid = config.get(PANEL_APPLET_FACTORY_GROUP, 'Id')
+ retval.extend(["%s::%s" % (fid, s) for s in config.sections() if s != PANEL_APPLET_FACTORY_GROUP])
+
+ return retval
+
def _set_applet_iid(self, applet_iid):
if not applet_iid:
raise PanelAddException('No applet specified')
- applets = bonobo.activation.query ("has_all (repo_ids, ['IDL:Bonobo/Control:1.0', 'IDL:GNOME/Vertigo/PanelAppletShell:1.0'])")
- if not applet_iid in [ a.iid for a in applets ]:
+ applets = self._get_applet_list ()
+ if not applet_iid in applets:
raise PanelAddException('%s is not a valid applet' % applet_iid)
self.applet_iid = applet_iid
@@ -216,7 +250,7 @@ class PanelAdder:
if self.type == PANEL_TYPE_APPLET:
self.client.set_string(os.path.join(dir, 'object_type'), 'bonobo-applet')
- self.client.set_string(os.path.join(dir, 'bonobo_iid'), self.applet_iid)
+ self.client.set_string(os.path.join(dir, 'applet_iid'), self.applet_iid)
id_list = self._panel_get_list(PANEL_APPLETS_KEY)
id_list.append(id)
self.client.set_list(PANEL_APPLETS_KEY, gconf.VALUE_STRING, id_list)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]