diff -u gnome-panel-2.25.92/debian/changelog gnome-panel-2.25.92/debian/changelog --- gnome-panel-2.25.92/debian/changelog +++ gnome-panel-2.25.92/debian/changelog @@ -1,3 +1,9 @@ +gnome-panel (1:2.25.92-0ubuntu2) jaunty; urgency=low + + * auto add indicator applet on upgrade (LP: #340777) + + -- Michael Vogt Fri, 13 Mar 2009 13:56:42 +0100 + gnome-panel (1:2.25.92-0ubuntu1) jaunty; urgency=low * New upstream version: diff -u gnome-panel-2.25.92/debian/gnome-panel.install gnome-panel-2.25.92/debian/gnome-panel.install --- gnome-panel-2.25.92/debian/gnome-panel.install +++ gnome-panel-2.25.92/debian/gnome-panel.install @@ -6 +6,2 @@ - +debian/add-indicator-applet.py usr/share/gnome-panel +debian/indicator-applet.desktop etc/xdg/autostart diff -u gnome-panel-2.25.92/debian/gnome-panel.postinst gnome-panel-2.25.92/debian/gnome-panel.postinst --- gnome-panel-2.25.92/debian/gnome-panel.postinst +++ gnome-panel-2.25.92/debian/gnome-panel.postinst @@ -15,4 +15,11 @@ fi +# gconf default for the indicator applet +if [ "$1" = configure ] && dpkg --compare-versions "$2" le-nl "1:2.25.92-0ubuntu2"; +then + echo "/apps/panel/need_add_indicator_applet true" > /usr/share/gconf/defaults/25_gnome_panel_indicator_applet + update-gconf-defaults +fi + #DEBHELPER# only in patch2: unchanged: --- gnome-panel-2.25.92.orig/debian/add-indicator-applet.py +++ gnome-panel-2.25.92/debian/add-indicator-applet.py @@ -0,0 +1,95 @@ +#!/usr/bin/python + +import gconf +import os.path +import sys + +from gettext import gettext as _ +import gettext + +#FIXME: add checks here and run without UI if that fails to import +import pygtk +pygtk.require('2.0') +import gtk + +def error(primary, secondary): + d = gtk.MessageDialog(type=gtk.MESSAGE_ERROR, buttons=gtk.BUTTONS_OK) + d.set_markup("%s" % primary) + d.format_secondary_text(secondary) + d.run() + d.destroy() + +def info(primary, secondary): + d = gtk.MessageDialog(type=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_OK) + d.set_markup("%s" % primary) + d.format_secondary_text(secondary) + d.run() + d.destroy() + +def associate_schemas_in_dir(client, engine, profile_dir, schema_dir): + """ + helper that takes a gconf schema dir and creates a new profile dir + based on the schema, useful for e.g. adding a applet to the panel + """ + for e in client.all_entries(schema_dir): + schema_key = os.path.basename(e.get_key()) + key = os.path.join(profile_dir, schema_key) + engine.associate_schema(key, e.get_key()) + client.suggest_sync() + +if __name__ == "__main__": + gettext.bindtextdomain("gnome-panel") + + engine = gconf.engine_get_default() + client = gconf.client_get_for_engine(engine) + + # make sure this is auto-run only once + client.set_bool("/apps/panel/need_add_indicator_applet", False) + + # search for the notification area applet + applets = client.all_dirs("/apps/panel/applets") + notification_pos = None + notification_panel = None + for d in applets: + if (client.get_string(os.path.join(d,"bonobo_iid")) == "OAFIID:GNOME_IndicatorApplet"): + info(_("Already has a indicator applet"), + _("Your panel already has a indicator applet")) + sys.exit(0) + if (client.get_string(os.path.join(d,"bonobo_iid")) == "OAFIID:GNOME_NotificationAreaApplet"): + notification_pos = client.get_int(os.path.join(d,"position")) + notification_panel = client.get_string(os.path.join(d,"toplevel_id")) + # check if we found the notification area + if (notification_pos is None or + notification_pos == 0 or + notification_panel is None): + error(_("Could not find notification area"), + _("Please add the indicator applet manually")) + sys.exit(1) + + + print sys.argv[0] + print "New post: ", notification_pos + print "New panel: ", notification_panel + + # create a new indicator applet + applet_name = "applet_indicator_auto_added" + new_applet_name = os.path.join("/apps/panel/applets/",applet_name) + associate_schemas_in_dir(client, engine, new_applet_name, + "/schemas/apps/panel/objects") + client.set_string(os.path.join(new_applet_name, "bonobo_iid"), + "OAFIID:GNOME_IndicatorApplet") + client.set_string(os.path.join(new_applet_name, "toplevel_id"), + notification_panel) + client.set_string(os.path.join(new_applet_name, "object_type"), + "bonobo-applet") + client.set_int(os.path.join(new_applet_name, "position"), + notification_pos - 5) + l=client.get_list("/apps/panel/general/applet_id_list", gconf.VALUE_STRING) + l.append(applet_name) + client.set_list("/apps/panel/general/applet_id_list", gconf.VALUE_STRING, l) + client.suggest_sync() + + # show nice information + info(_("Configuration updated"), + _("Your panel configuration is updated. ")) + only in patch2: unchanged: --- gnome-panel-2.25.92.orig/debian/gnome-panel.dirs +++ gnome-panel-2.25.92/debian/gnome-panel.dirs @@ -0,0 +1 @@ +etc/xdg/autostart \ No newline at end of file only in patch2: unchanged: --- gnome-panel-2.25.92.orig/debian/indicator-applet.desktop +++ gnome-panel-2.25.92/debian/indicator-applet.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Type=Application +Name=Indicator applet +Exec=python /usr/share/gnome-panel/add-indicator-applet.py +OnlyShowIn=GNOME; +AutostartCondition=GNOME /apps/panel/need_add_indicator_applet +X-GNOME-Autostart-Phase=Initialization