[gnome-panel] [panel] Add back optional support for bonobo applets to gnome-panel-add



commit 79be3791b07dbda11be8b73116a31dbcb1118bff
Author: Vincent Untz <vuntz gnome org>
Date:   Tue Sep 7 00:54:04 2010 +0200

    [panel] Add back optional support for bonobo applets to gnome-panel-add
    
    The support for bonobo is found at runtime: we just check if we have the
    bonobo python bindings. If we don't have the bindings, then we just
    fail for bonobo applets.

 gnome-panel/gnome-panel-add.in          |   13 ++++++++++++-
 gnome-panel/panel-default-setup.entries |   12 ++++++------
 gnome-panel/panel-object.schemas.in     |    6 ++++--
 gnome-panel/panel-profile.c             |    4 +++-
 4 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/gnome-panel/gnome-panel-add.in b/gnome-panel/gnome-panel-add.in
index f5af10e..b93a027 100644
--- a/gnome-panel/gnome-panel-add.in
+++ b/gnome-panel/gnome-panel-add.in
@@ -28,6 +28,12 @@ import sys
 import urllib
 import ConfigParser
 
+try:
+    import bonobo
+    has_bonobo = True
+except ImportError:
+    has_bonobo = False
+
 import gconf
 
 PANEL_SCHEMAS_OBJECTS_DIR='/schemas/apps/panel/objects'
@@ -147,7 +153,12 @@ class PanelAdder:
 
         applets = self._get_applet_list ()
         if not applet_iid in applets:
-            raise PanelAddException('%s is not a valid applet' % applet_iid)
+            if has_bonobo:
+                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 ]:
+                    raise PanelAddException('%s is not a valid applet' % applet_iid)
+            else:
+                raise PanelAddException('%s is not a valid applet' % applet_iid)
 
         self.applet_iid = applet_iid
 
diff --git a/gnome-panel/panel-default-setup.entries b/gnome-panel/panel-default-setup.entries
index 3604957..182ba20 100644
--- a/gnome-panel/panel-default-setup.entries
+++ b/gnome-panel/panel-default-setup.entries
@@ -334,7 +334,7 @@
       <key>applets/window_menu/object_type</key>
       <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
       <value>
-        <string>bonobo-applet</string>
+        <string>external-applet</string>
       </value>
     </entry>
     <entry>
@@ -388,7 +388,7 @@
       <key>applets/clock/object_type</key>
       <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
       <value>
-        <string>bonobo-applet</string>
+        <string>external-applet</string>
       </value>
     </entry>
     <entry>
@@ -442,7 +442,7 @@
       <key>applets/notification_area/object_type</key>
       <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
       <value>
-        <string>bonobo-applet</string>
+        <string>external-applet</string>
       </value>
     </entry>
     <entry>
@@ -496,7 +496,7 @@
       <key>applets/show_desktop_button/object_type</key>
       <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
       <value>
-        <string>bonobo-applet</string>
+        <string>external-applet</string>
       </value>
     </entry>
     <entry>
@@ -550,7 +550,7 @@
       <key>applets/window_list/object_type</key>
       <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
       <value>
-        <string>bonobo-applet</string>
+        <string>external-applet</string>
       </value>
     </entry>
     <entry>
@@ -604,7 +604,7 @@
       <key>applets/workspace_switcher/object_type</key>
       <schema_key>/schemas/apps/panel/objects/object_type</schema_key>
       <value>
-        <string>bonobo-applet</string>
+        <string>external-applet</string>
       </value>
     </entry>
     <entry>
diff --git a/gnome-panel/panel-object.schemas.in b/gnome-panel/panel-object.schemas.in
index 00d718a..5a0943d 100644
--- a/gnome-panel/panel-object.schemas.in
+++ b/gnome-panel/panel-object.schemas.in
@@ -15,7 +15,8 @@
         <long>
           The type of this panel object. Possible values are
           "drawer-object", "menu-object", "launcher-object",
-          "bonobo-applet", "action-applet" and "menu-bar".
+          "external-applet", "action-applet", "menu-bar" and
+	  "separator".
         </long>
       </locale>
     </schema>
@@ -105,7 +106,8 @@
         <long>
           The implementation ID of the applet - e.g.
           "ClockAppletFactory::ClockApplet". This key is only
-          relevant if the object_type key is "bonobo-applet".
+          relevant if the object_type key is "external-applet"
+	  (or the deprecated "bonobo-applet").
         </long>
       </locale>
     </schema>
diff --git a/gnome-panel/panel-profile.c b/gnome-panel/panel-profile.c
index c3de4f1..27ce137 100644
--- a/gnome-panel/panel-profile.c
+++ b/gnome-panel/panel-profile.c
@@ -99,10 +99,12 @@ static GConfEnumStringPair panel_object_type_map [] = {
 	{ PANEL_OBJECT_DRAWER,    "drawer-object" },
 	{ PANEL_OBJECT_MENU,      "menu-object" },
 	{ PANEL_OBJECT_LAUNCHER,  "launcher-object" },
-	{ PANEL_OBJECT_APPLET,    "bonobo-applet" },
+	{ PANEL_OBJECT_APPLET,    "external-applet" },
 	{ PANEL_OBJECT_ACTION,    "action-applet" },
 	{ PANEL_OBJECT_MENU_BAR,  "menu-bar" },
 	{ PANEL_OBJECT_SEPARATOR, "separator" },
+	/* The following is for backwards compatibility with 2.30.x and earlier */
+	{ PANEL_OBJECT_APPLET,    "bonobo-applet" },
 	/* The following two are for backwards compatibility with 2.0.x */
 	{ PANEL_OBJECT_LOCK,      "lock-object" },
 	{ PANEL_OBJECT_LOGOUT,    "logout-object" },



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]