Package: paprefs
Version: 0.9.9-2
Severity: minor
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu lucid ubuntu-patch


In Ubuntu, we've applied the attached patch to achieve the following:

  * debian/patches/0004-Show-install-only-with-active-packagekit.patch
    + Show the install buttons only when PackageKit is running.  Otherwise
      these buttons silently fail (LP: #489531).  A functionally-equivalent
      patch is in upstream git; this can be dropped in the next upstream 
      version.

We thought you might be interested in doing the same.


-- System Information:
Debian Release: squeeze/sid
  APT prefers lucid-security
  APT policy: (500, 'lucid-security'), (500, 'lucid')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-generic (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
diff -u paprefs-0.9.9/debian/patches/series paprefs-0.9.9/debian/patches/series
--- paprefs-0.9.9/debian/patches/series
+++ paprefs-0.9.9/debian/patches/series
@@ -3,0 +4 @@
+0004-Show-install-only-with-active-packagekit.patch
only in patch2:
unchanged:
--- paprefs-0.9.9.orig/debian/patches/0004-Show-install-only-with-active-packagekit.patch
+++ paprefs-0.9.9/debian/patches/0004-Show-install-only-with-active-packagekit.patch
@@ -0,0 +1,105 @@
+Description: Only show "Install" buttons when PackageKit is available
+  Check for an owner of the org.freedesktop.PackageKit name on the session
+  bus at startup.  Show the install buttons iff there's an owner of that name.
+Author: Christopher James Halse Rogers <r...@ubuntu.com>
+Bug-Ubuntu: https://bugs.edge.launchpad.net/ubuntu/+source/paprefs/+bug/489531
+Bug: http://pulseaudio.org/ticket/732
+
+Index: paprefs-0.9.9/src/paprefs.cc
+===================================================================
+--- paprefs-0.9.9.orig/src/paprefs.cc	2009-11-30 10:36:32.263971250 +1100
++++ paprefs-0.9.9/src/paprefs.cc	2009-11-30 10:39:01.932708465 +1100
+@@ -30,6 +30,7 @@
+ #include <gconfmm.h>
+ #include <libintl.h>
+ #include <dbus/dbus-glib.h>
++#include <dbus/dbus.h>
+ #include <gdk/gdkx.h>
+ 
+ #include <pulse/version.h>
+@@ -108,6 +109,9 @@
+ 
+     void onGConfChange(const Glib::ustring& key, const Gnome::Conf::Value& value);
+ 
++    void checkForPackageKit();
++    bool packageKitAvailable;
++
+     void installFiles(const char *a, const char *b);
+     void installModules(const char *a, const char *b);
+ 
+@@ -153,6 +157,7 @@
+     x->get_widget("rtpNullSinkRadioButton", rtpNullSinkRadioButton);
+ 
+     checkForModules();
++    checkForPackageKit();
+ 
+     gconf = Gnome::Conf::Client::get_default_client();
+     gconf->set_error_handling(Gnome::Conf::CLIENT_HANDLE_ALL);
+@@ -225,37 +230,37 @@
+     upnpMediaServerCheckButton->set_sensitive(upnpAvailable);
+     upnpNullSinkCheckButton->set_sensitive(upnpAvailable && upnpMediaServerCheckButton->get_active());
+ 
+-    if (zeroconfDiscoverAvailable)
++    if (zeroconfDiscoverAvailable || !packageKitAvailable)
+         zeroconfDiscoverInstallButton->hide();
+     else
+         zeroconfDiscoverInstallButton->show();
+ 
+-    if (zeroconfRaopDiscoverAvailable)
++    if (zeroconfRaopDiscoverAvailable || !packageKitAvailable)
+         zeroconfRaopDiscoverInstallButton->hide();
+     else
+         zeroconfRaopDiscoverInstallButton->show();
+ 
+-    if (remoteAvailable)
++    if (remoteAvailable || !packageKitAvailable)
+         remoteInstallButton->hide();
+     else
+         remoteInstallButton->show();
+ 
+-    if (zeroconfPublishAvailable)
++    if (zeroconfPublishAvailable || !packageKitAvailable)
+         zeroconfPublishInstallButton->hide();
+     else
+         zeroconfPublishInstallButton->show();
+ 
+-    if (upnpAvailable)
++    if (upnpAvailable || !packageKitAvailable)
+         upnpInstallButton->hide();
+     else
+         upnpInstallButton->show();
+ 
+-    if (rtpRecvAvailable)
++    if (rtpRecvAvailable || !packageKitAvailable)
+         rtpRecvInstallButton->hide();
+     else
+         rtpRecvInstallButton->show();
+ 
+-    if (rtpSendAvailable)
++    if (rtpSendAvailable || !packageKitAvailable)
+         rtpSendInstallButton->hide();
+     else
+         rtpSendInstallButton->show();
+@@ -700,6 +705,22 @@
+         g_find_program_in_path("rygel");
+ }
+ 
++void MainWindow::checkForPackageKit() {
++
++    DBusError err;
++    dbus_error_init(&err);
++    DBusConnection *sessionBus = dbus_bus_get(DBUS_BUS_SESSION, &err);
++
++    if(dbus_error_is_set(&err)) {
++        g_warning("Error connecting to DBus: %s", err.message);
++        packageKitAvailable = FALSE;
++    } else {
++        packageKitAvailable = dbus_bus_name_has_owner(sessionBus, "org.freedesktop.PackageKit", NULL);
++        dbus_connection_unref(sessionBus);
++    }
++    dbus_error_free(&err);
++}
++
+ int main(int argc, char *argv[]) {
+ 
+     /* Initialize the i18n stuff */

Reply via email to