reviewed by: Bastien Nocera <hadess@hadess.net>
2006-01-11 Sebastien Bacher <seb128@debian.org> reviewed by: Bastien Nocera <hadess@hadess.net> * actions/acme-fb-level.c: (acme_fblevel_error_quark), (acme_fblevel_new): * actions/acme-fb-level.h: * gnome-settings-multimedia-keys.c: (gnome_settings_multimedia_keys_load): cleanup messages about pmu on powerbook, patch by Jeroen Zwartepoorte <jeroen.zwartepoorte@gmail.com> (Closes: #132655)
This commit is contained in:
parent
821ca6fcf2
commit
b62b47635a
4 changed files with 59 additions and 30 deletions
|
@ -1,3 +1,16 @@
|
||||||
|
2006-01-11 Sebastien Bacher <seb128@debian.org>
|
||||||
|
|
||||||
|
reviewed by: Bastien Nocera <hadess@hadess.net>
|
||||||
|
|
||||||
|
* actions/acme-fb-level.c: (acme_fblevel_error_quark),
|
||||||
|
(acme_fblevel_new):
|
||||||
|
* actions/acme-fb-level.h:
|
||||||
|
* gnome-settings-multimedia-keys.c:
|
||||||
|
(gnome_settings_multimedia_keys_load):
|
||||||
|
cleanup messages about pmu on powerbook,
|
||||||
|
patch by Jeroen Zwartepoorte <jeroen.zwartepoorte@gmail.com>
|
||||||
|
(Closes: #132655)
|
||||||
|
|
||||||
2006-01-11 Sebastien Bacher <seb128@debian.org>
|
2006-01-11 Sebastien Bacher <seb128@debian.org>
|
||||||
|
|
||||||
* actions/acme.h:
|
* actions/acme.h:
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include <linux/fb.h>
|
#include <linux/fb.h>
|
||||||
#include <linux/pmu.h>
|
#include <linux/pmu.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <libgnome/gnome-i18n.h>
|
||||||
|
|
||||||
#ifndef FBIOBLANK
|
#ifndef FBIOBLANK
|
||||||
#define FBIOBLANK 0x4611 /* 0 or vesa-level+1 */
|
#define FBIOBLANK 0x4611 /* 0 or vesa-level+1 */
|
||||||
|
@ -84,6 +85,17 @@ acme_fblevel_init (AcmeFblevel *fblevel)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GQuark
|
||||||
|
acme_fblevel_error_quark (void)
|
||||||
|
{
|
||||||
|
static GQuark quark = 0;
|
||||||
|
|
||||||
|
if (quark == 0)
|
||||||
|
quark = g_quark_from_string ("acme-fblevel-quark");
|
||||||
|
|
||||||
|
return quark;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
acme_fblevel_get_level (AcmeFblevel *self)
|
acme_fblevel_get_level (AcmeFblevel *self)
|
||||||
{
|
{
|
||||||
|
@ -126,16 +138,24 @@ acme_fblevel_set_dim (AcmeFblevel *self, gboolean val)
|
||||||
}
|
}
|
||||||
|
|
||||||
AcmeFblevel *
|
AcmeFblevel *
|
||||||
acme_fblevel_new (void)
|
acme_fblevel_new (GError **error)
|
||||||
{
|
{
|
||||||
AcmeFblevel *self;
|
AcmeFblevel *self;
|
||||||
int fd, foo;
|
int fd, foo;
|
||||||
|
|
||||||
if (g_file_test ("/dev/pmu", G_FILE_TEST_EXISTS) == 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;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (acme_fblevel_is_powerbook () == FALSE)
|
if (acme_fblevel_is_powerbook () == FALSE) {
|
||||||
|
*error = g_error_new_literal (ACME_FBLEVEL_ERROR,
|
||||||
|
ACME_FBLEVEL_ERROR_NO_POWERBOOK,
|
||||||
|
_("Not a powerbook"));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
self = ACME_FBLEVEL (g_object_new (ACME_TYPE_FBLEVEL, NULL));
|
self = ACME_FBLEVEL (g_object_new (ACME_TYPE_FBLEVEL, NULL));
|
||||||
/* This function switches the kernel backlight control off.
|
/* This function switches the kernel backlight control off.
|
||||||
|
@ -147,8 +167,12 @@ acme_fblevel_new (void)
|
||||||
* Notice nicked from pbbuttons*/
|
* Notice nicked from pbbuttons*/
|
||||||
fd = open ("/dev/pmu", O_RDWR);
|
fd = open ("/dev/pmu", O_RDWR);
|
||||||
/* We can't emit the signal yet, the signal isn't connected! */
|
/* 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,
|
||||||
|
_("Wrong permission for '/dev/pmu' device"));
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
foo = ioctl(fd, PMU_IOC_GRAB_BACKLIGHT, 0);
|
foo = ioctl(fd, PMU_IOC_GRAB_BACKLIGHT, 0);
|
||||||
self->_priv->pmu_fd = fd;
|
self->_priv->pmu_fd = fd;
|
||||||
|
|
|
@ -29,9 +29,12 @@
|
||||||
#define ACME_IS_FBLEVEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ACME_TYPE_FBLEVEL))
|
#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_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 AcmeFblevelPrivate AcmeFblevelPrivate;
|
||||||
typedef struct AcmeFblevel AcmeFblevel;
|
typedef struct AcmeFblevel AcmeFblevel;
|
||||||
typedef struct AcmeFblevelClass AcmeFblevelClass;
|
typedef struct AcmeFblevelClass AcmeFblevelClass;
|
||||||
|
typedef enum AcmeFblevelError AcmeFblevelError;
|
||||||
|
|
||||||
struct AcmeFblevel {
|
struct AcmeFblevel {
|
||||||
GObject parent;
|
GObject parent;
|
||||||
|
@ -44,12 +47,19 @@ struct AcmeFblevelClass {
|
||||||
GObjectClass parent;
|
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);
|
GType acme_fblevel_get_type (void);
|
||||||
|
GQuark acme_fblevel_error_quark (void);
|
||||||
int acme_fblevel_get_level (AcmeFblevel *self);
|
int acme_fblevel_get_level (AcmeFblevel *self);
|
||||||
void acme_fblevel_set_level (AcmeFblevel *self, int val);
|
void acme_fblevel_set_level (AcmeFblevel *self, int val);
|
||||||
gboolean acme_fblevel_get_dim (AcmeFblevel *self);
|
gboolean acme_fblevel_get_dim (AcmeFblevel *self);
|
||||||
void acme_fblevel_set_dim (AcmeFblevel *self,
|
void acme_fblevel_set_dim (AcmeFblevel *self,
|
||||||
gboolean val);
|
gboolean val);
|
||||||
AcmeFblevel *acme_fblevel_new (void);
|
AcmeFblevel *acme_fblevel_new (GError **error);
|
||||||
gboolean acme_fblevel_is_powerbook (void);
|
gboolean acme_fblevel_is_powerbook (void);
|
||||||
|
|
||||||
|
|
|
@ -148,26 +148,6 @@ do_sleep_action (char *cmd1, char *cmd2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#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[] = {
|
static char *images[] = {
|
||||||
PIXMAPSDIR "/gnome-speakernotes-muted.png",
|
PIXMAPSDIR "/gnome-speakernotes-muted.png",
|
||||||
PIXMAPSDIR "/gnome-speakernotes.png",
|
PIXMAPSDIR "/gnome-speakernotes.png",
|
||||||
|
@ -800,6 +780,7 @@ gnome_settings_multimedia_keys_load (GConfClient *client)
|
||||||
{
|
{
|
||||||
GSList *l;
|
GSList *l;
|
||||||
Acme *acme;
|
Acme *acme;
|
||||||
|
GError *err = NULL;
|
||||||
|
|
||||||
acme = g_new0 (Acme, 1);
|
acme = g_new0 (Acme, 1);
|
||||||
acme->xml = NULL;
|
acme->xml = NULL;
|
||||||
|
@ -819,11 +800,12 @@ gnome_settings_multimedia_keys_load (GConfClient *client)
|
||||||
|
|
||||||
#ifdef USE_FBLEVEL
|
#ifdef USE_FBLEVEL
|
||||||
/* initialise Frame Buffer level handler */
|
/* initialise Frame Buffer level handler */
|
||||||
if (acme_fblevel_is_powerbook () != FALSE)
|
acme->levobj = acme_fblevel_new (&err);
|
||||||
{
|
if (acme->levobj == NULL && err != NULL) {
|
||||||
acme->levobj = acme_fblevel_new();
|
if (!g_error_matches (err, ACME_FBLEVEL_ERROR,
|
||||||
if (acme->levobj == NULL)
|
ACME_FBLEVEL_ERROR_NO_POWERBOOK))
|
||||||
fblevel_problem_cb ();
|
acme_error (err->message);
|
||||||
|
g_error_free (err);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue