Bug#281952: patch to remove warning dialogs on pmu errors
Sjoerd Simons
Sjoerd Simons <sjoerd@luon.net>, 281952@bugs.debian.org
Tue, 11 Jan 2005 10:45:26 +0100
This is a multi-part MIME message sent by reportbug.
--===============1552816532==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Package: capplets
Version: 1:2.8.1-3.0.1
Followup-For: Bug #281952
Hi,
Attached are an update 08_pmu_fix.patch and an interdiff between the current
version and the updated one. This cause the error dialogs that are shown on
an pmu error to be replaced by a message in .xsession-errors.
This solve various bug reports about excessive dialog blah caused by pmu
errors.
Sjoerd
-- System Information:
Debian Release: 3.1
APT prefers unstable
APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: powerpc (ppc)
Kernel: Linux 2.6.9-spring
Locale: LANG=C, LC_CTYPE=nl_NL@euro (charmap=ISO-8859-15)
Versions of packages capplets depends on:
ii capplets-data 1:2.8.1-3.0.1 configuration applets for GNOME 2
ii gnome-control-center 1:2.8.1-3.0.1 The GNOME Control Center for GNOME
ii gnome-desktop-data 2.8.1-2 Common files for GNOME 2 desktop a
ii gnome-icon-theme 2.8.0-1 GNOME Desktop icon theme
ii gnome-panel 2.8.2-1 Launcher and docking facility for
ii gnome-session 2.8.1-5 The GNOME 2 Session Manager
ii libart-2.0-2 2.3.16-6 Library of functions for 2D graphi
ii libasound2 1.0.7-4 ALSA library
ii libatk1.0-0 1.8.0-4 The ATK accessibility toolkit
ii libaudiofile0 0.2.6-5 Open-source version of SGI's audio
ii libbonobo2-0 2.8.0-4 Bonobo CORBA interfaces library
ii libbonoboui2-0 2.8.0-2 The Bonobo UI library
ii libc6 2.3.2.ds1-20 GNU C Library: Shared libraries an
ii libeel2-2 2.8.2-1 Eazel Extensions Library (for GNOM
ii libesd-alsa0 [libesd0 0.2.35-2 Enlightened Sound Daemon (ALSA) -
ii libfontconfig1 2.2.3-4 generic font configuration library
ii libfreetype6 2.1.7-2.3 FreeType 2 font engine, shared lib
ii libgail-common 1.8.2-1 GNOME Accessibility Implementation
ii libgail17 1.8.2-1 GNOME Accessibility Implementation
ii libgconf2-4 2.8.1-4 GNOME configuration database syste
ii libgcrypt11 1.2.0-11 LGPL Crypto library - runtime libr
ii libglade2-0 1:2.4.1-1 Library to load .glade files at ru
ii libglib2.0-0 2.4.8-1 The GLib library of C routines
ii libgnome-desktop-2 2.8.1-2 Utility library for loading .deskt
ii libgnome-keyring0 0.4.0-2 GNOME keyring services library
ii libgnome2-0 2.8.0-6 The GNOME 2 library - runtime file
ii libgnomecanvas2-0 2.8.0-1 A powerful object-oriented display
ii libgnomeui-0 2.8.0-3 The GNOME 2 libraries (User Interf
ii libgnomevfs2-0 2.8.3-8 The GNOME virtual file-system libr
ii libgnutls11 1.0.16-13 GNU TLS library - runtime library
ii libgpg-error0 1.0-1 library for common error values an
ii libgstreamer-plugins0 0.8.7-2 Various GStreamer libraries and li
ii libgstreamer0.8-0 0.8.8-1 Core GStreamer libraries, plugins,
ii libgtk2.0-0 2.4.14-2 The GTK+ graphical user interface
ii libhowl0 0.9.8-2 Library for Zeroconf service disco
ii libice6 6.8.1-1ubuntu9.0.1 Inter-Client Exchange library
ii libjpeg62 6b-9 The Independent JPEG Group's JPEG
ii libmetacity0 1:2.8.8-1 Common library of lightweight GTK2
ii libnautilus2-2 2.8.2-2 libraries for nautilus components
ii liborbit2 1:2.10.2-1.1 libraries for ORBit2 - a CORBA ORB
ii libpango1.0-0 1.6.0-3 Layout and rendering of internatio
ii libpopt0 1.7-5 lib for parsing cmdline parameters
ii libsm6 6.8.1-1ubuntu9.0.1 X Window System Session Management
ii libstartup-notificati 0.7-1 library for program launch feedbac
ii libtasn1-2 0.2.10-4 Manage ASN.1 structures (runtime)
ii libx11-6 6.8.1-1ubuntu9.0.1 X Window System protocol client li
ii libxext6 6.8.1-1ubuntu9.0.1 X Window System miscellaneous exte
ii libxft2 2.1.2-6 FreeType-based font drawing librar
ii libxklavier8 1.03-1 X Keyboard Extension high-level AP
ii libxml2 2.6.11-5 GNOME XML library
ii libxrandr2 6.8.1-1ubuntu9.0.1 X Window System Resize, Rotate and
ii libxrender1 0.9.0-0ubuntu3 X Rendering Extension client libra
ii libxss1 6.8.1-1ubuntu9.0.1 X Screen Saver client-side library
ii libxxf86misc1 6.8.1-1ubuntu9.0.1 X miscellaneous extensions library
ii nautilus 2.8.2-2 file manager and graphical shell f
ii xlibs 6.8.1-1ubuntu9.0.1 X Window System client libraries m
ii zlib1g 1:1.2.2-4 compression library - runtime
-- no debconf information
--===============1552816532==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="08_pmu_fix.patch"
diff -ur gnome-settings-daemon.orig/actions/acme-fb-level.c gnome-settings-daemon/actions/acme-fb-level.c
--- gnome-settings-daemon.orig/actions/acme-fb-level.c 2004-10-08 11:50:42.000000000 +0200
+++ gnome-settings-daemon/actions/acme-fb-level.c 2004-10-08 11:57:44.000000000 +0200
@@ -31,6 +31,7 @@
#include <linux/fb.h>
#include <linux/pmu.h>
#include <errno.h>
+#include <libgnome/gnome-i18n.h>
#ifndef FBIOBLANK
#define FBIOBLANK 0x4611 /* 0 or vesa-level+1 */
@@ -104,6 +105,17 @@
return type;
}
+GQuark
+acme_fblevel_error_quark (void)
+{
+ static GQuark quark = 0;
+
+ if (quark == 0)
+ quark = g_quark_from_string ("acme-fblevel-quark");
+
+ return quark;
+}
+
int
acme_fblevel_get_level (AcmeFblevel *self)
{
@@ -146,16 +158,23 @@
}
AcmeFblevel *
-acme_fblevel_new (void)
+acme_fblevel_new (GError **error)
{
AcmeFblevel *self;
int fd, foo;
- if (g_file_test ("/dev/pmu", G_FILE_TEST_EXISTS) == FALSE)
+ if (acme_fblevel_is_powerbook () == FALSE) {
return NULL;
+ }
+
- if (acme_fblevel_is_powerbook () == FALSE)
+ if (g_file_test ("/dev/pmu", G_FILE_TEST_EXISTS) == FALSE) {
+ *error = g_error_new_literal (ACME_FBLEVEL_ERROR,
+ ACME_FBLEVEL_ERROR_NO_PMU_DEVICE,
+ _("No '/dev/pmu' device found"));
return NULL;
+ }
+
self = ACME_FBLEVEL (g_object_new (ACME_TYPE_FBLEVEL, NULL));
/* This function switches the kernel backlight control off.
@@ -167,8 +186,12 @@
* Notice nicked from pbbuttons*/
fd = open ("/dev/pmu", O_RDWR);
/* We can't emit the signal yet, the signal isn't connected! */
- if (fd < 0)
+ if (fd < 0) {
+ *error = g_error_new_literal (ACME_FBLEVEL_ERROR,
+ ACME_FBLEVEL_ERROR_WRONG_PERMS,
+ _("No permission to open '/dev/pmu' device"));
return NULL;
+ }
foo = ioctl(fd, PMU_IOC_GRAB_BACKLIGHT, 0);
self->_priv->pmu_fd = fd;
@@ -186,7 +209,7 @@
while (!feof (fd) && found == FALSE)
{
fread (str, 1, 2048, fd);
- if (strstr (str, "PowerBook") != NULL)
+ if (strstr (str, "NewWorld") != NULL)
found = TRUE;
}
diff -ur gnome-settings-daemon.orig/actions/acme-fb-level.h gnome-settings-daemon/actions/acme-fb-level.h
--- gnome-settings-daemon.orig/actions/acme-fb-level.h 2004-10-08 11:50:42.000000000 +0200
+++ gnome-settings-daemon/actions/acme-fb-level.h 2004-10-08 11:51:11.000000000 +0200
@@ -29,9 +29,12 @@
#define ACME_IS_FBLEVEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_FBLEVEL))
#define ACME_FBLEVEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ACME_TYPE_FBLEVEL, AcmeFblevelClass))
+#define ACME_FBLEVEL_ERROR (acme_fblevel_error_quark ())
+
typedef struct AcmeFblevelPrivate AcmeFblevelPrivate;
typedef struct AcmeFblevel AcmeFblevel;
typedef struct AcmeFblevelClass AcmeFblevelClass;
+typedef enum AcmeFblevelError AcmeFblevelError;
struct AcmeFblevel {
GObject parent;
@@ -44,12 +47,19 @@
GObjectClass parent;
};
+enum AcmeFblevelError {
+ ACME_FBLEVEL_ERROR_NO_PMU_DEVICE,
+ ACME_FBLEVEL_ERROR_NO_POWERBOOK,
+ ACME_FBLEVEL_ERROR_WRONG_PERMS
+};
+
GType acme_fblevel_get_type (void);
+GQuark acme_fblevel_error_quark (void);
int acme_fblevel_get_level (AcmeFblevel *self);
void acme_fblevel_set_level (AcmeFblevel *self, int val);
gboolean acme_fblevel_get_dim (AcmeFblevel *self);
void acme_fblevel_set_dim (AcmeFblevel *self,
gboolean val);
-AcmeFblevel *acme_fblevel_new (void);
+AcmeFblevel *acme_fblevel_new (GError **error);
gboolean acme_fblevel_is_powerbook (void);
diff -ur gnome-settings-daemon.orig/gnome-settings-multimedia-keys.c gnome-settings-daemon/gnome-settings-multimedia-keys.c
--- gnome-settings-daemon.orig/gnome-settings-multimedia-keys.c 2004-10-08 11:50:42.000000000 +0200
+++ gnome-settings-daemon/gnome-settings-multimedia-keys.c 2004-10-08 11:51:11.000000000 +0200
@@ -133,26 +133,6 @@
}
}
-#ifdef USE_FBLEVEL
-static char*
-permission_problem_string (const char *file)
-{
- return g_strdup_printf (_("Permissions on the file %s are broken\n"), file);
-}
-
-static void
-fblevel_problem_cb (void)
-{
- char *msg;
-
- msg = permission_problem_string ("/dev/pmu");
- acme_error (msg);
- g_free (msg);
-
- return;
-}
-#endif
-
static char *images[] = {
PIXMAPSDIR "/gnome-speakernotes-muted.png",
PIXMAPSDIR "/gnome-speakernotes.png",
@@ -915,6 +895,7 @@
{
GSList *l;
Acme *acme;
+ GError *err = NULL;
acme = g_new0 (Acme, 1);
acme->xml = NULL;
@@ -934,11 +915,10 @@
#ifdef USE_FBLEVEL
/* initialise Frame Buffer level handler */
- if (acme_fblevel_is_powerbook () != FALSE)
- {
- acme->levobj = acme_fblevel_new();
- if (acme->levobj == NULL)
- fblevel_problem_cb ();
+ acme->levobj = acme_fblevel_new (&err);
+ if (acme->levobj == NULL && err != NULL) {
+ g_critical(err->message);
+ g_error_free (err);
}
#endif
--===============1552816532==
Content-Type: text/x-c; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="pmu_fix_interdiff.diff"
diff -u gnome-settings-daemon/actions/acme-fb-level.c gnome-settings-daemon/actions/acme-fb-level.c
--- gnome-settings-daemon/actions/acme-fb-level.c 2004-10-08 11:57:44.000000000 +0200
+++ gnome-settings-daemon/actions/acme-fb-level.c 2004-10-08 11:57:44.000000000 +0200
@@ -189,7 +189,7 @@
if (fd < 0) {
*error = g_error_new_literal (ACME_FBLEVEL_ERROR,
ACME_FBLEVEL_ERROR_WRONG_PERMS,
- _("Wrong permission for '/dev/pmu' device"));
+ _("No permission to open '/dev/pmu' device"));
return NULL;
}
diff -u gnome-settings-daemon/gnome-settings-multimedia-keys.c gnome-settings-daemon/gnome-settings-multimedia-keys.c
--- gnome-settings-daemon/gnome-settings-multimedia-keys.c 2004-10-08 11:51:11.000000000 +0200
+++ gnome-settings-daemon/gnome-settings-multimedia-keys.c 2004-10-08 11:51:11.000000000 +0200
@@ -917,9 +917,7 @@
/* initialise Frame Buffer level handler */
acme->levobj = acme_fblevel_new (&err);
if (acme->levobj == NULL && err != NULL) {
- if (!g_error_matches (err, ACME_FBLEVEL_ERROR,
- ACME_FBLEVEL_ERROR_NO_POWERBOOK))
- acme_error (err->message);
+ g_critical(err->message);
g_error_free (err);
}
#endif
--===============1552816532==--