Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=ayatana.git;a=commitdiff;h=e9bf9b40b0b5452fa16a68e94022e063d1bfa945

commit e9bf9b40b0b5452fa16a68e94022e063d1bfa945
Author: Devil505 <devil505li...@gmail.com>
Date:   Wed Dec 1 14:53:28 2010 +0100

gnome-power-manager-2.32.0-2-i686
* added patch for notify-osd and appindicator support

diff --git a/source/gnome/gnome-power-manager/02-notify-osd-support.patch 
b/source/gnome/gnome-power-manager/02-notify-osd-support.patch
new file mode 100644
index 0000000..5287d1e
--- /dev/null
+++ b/source/gnome/gnome-power-manager/02-notify-osd-support.patch
@@ -0,0 +1,518 @@
+Description: Add support for synchronous brightness notifications using 
notify-osd.
+ The patch is based around gsd-osd-notification.[ch] which is shared with gsd
+Author: Chris Coulson <chris.coul...@canonical.com>
+Forwarded: no
+
+Index: gnome-power-manager-2.31.6/src/Makefile.am
+===================================================================
+--- gnome-power-manager-2.31.6.orig/src/Makefile.am    2010-08-06 
16:31:02.000000000 +0200
++++ gnome-power-manager-2.31.6/src/Makefile.am 2010-08-13 09:21:11.063803003 
+0200
+@@ -176,6 +176,8 @@
+       gsd-media-keys-window.c                         \
+       gpm-engine.h                                    \
+       gpm-engine.c                                    \
++      gsd-osd-notification.h                  \
++      gsd-osd-notification.c                  \
+       $(NULL)
+
+ gnome_power_manager_LDADD =                           \
+Index: gnome-power-manager-2.31.6/src/gsd-osd-notification.c
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gnome-power-manager-2.31.6/src/gsd-osd-notification.c      2010-08-13 
09:21:11.000000000 +0200
+@@ -0,0 +1,286 @@
++/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- */
++/*
++ * gsd-osd-notification.c
++ * Copyright (C) 2010 Chris Coulson <chrisccoul...@ubuntu.com>
++ * Copyright (C) 2009 Canonical Ltd
++ *
++ * gsd-osd-notification.c is free software: you can redistribute it and/or 
modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation, either version 3 of the License, or
++ * (at your option) any later version.
++ *
++ * gsd-osd-notification.c is distributed in the hope that it will be useful, 
but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++ * See the GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License along
++ * with this program.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#include <libnotify/notify.h>
++#include "gsd-osd-notification.h"
++
++struct _GsdOsdNotificationPrivate
++{
++        NotifyNotification *notification;
++        char **icon_names;
++        char *hint;
++        guint icon_array_size;
++};
++
++#define GSD_OSD_NOTIFICATION_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
GSD_TYPE_OSD_NOTIFICATION, GsdOsdNotificationPrivate))
++
++enum
++{
++      PROP_0,
++      PROP_ICON_NAMES,
++        PROP_HINT
++};
++
++#define NOTIFY_CAP_PRIVATE_SYNCHRONOUS "x-canonical-private-synchronous"
++#define NOTIFY_CAP_PRIVATE_ICON_ONLY "x-canonical-private-icon-only"
++#define NOTIFY_HINT_TRUE "true"
++
++G_DEFINE_TYPE (GsdOsdNotification, gsd_osd_notification, G_TYPE_OBJECT);
++
++static const char*
++_calculate_icon (GsdOsdNotification *notifier, guint value, gboolean muted)
++{
++        guint s;
++
++        s = (notifier->priv->icon_array_size -1) * value / 100 + 1;
++        s = MAX (s, 1);
++        s = MIN (s, notifier->priv->icon_array_size -1);
++        if (value <= 0)
++                s = 0;
++
++        return muted ? notifier->priv->icon_names[0] : 
notifier->priv->icon_names[s];
++}
++
++void
++gsd_osd_notification_set_icon_array (GsdOsdNotification *notifier, const char 
**icon_names)
++{
++        g_return_if_fail (GSD_IS_OSD_NOTIFICATION (notifier));
++
++        g_strfreev (notifier->priv->icon_names);
++        notifier->priv->icon_names = g_strdupv ((gchar **) icon_names);
++
++        notifier->priv->icon_array_size = g_strv_length ((gchar **) 
icon_names);
++}
++
++void
++gsd_osd_notification_set_hint (GsdOsdNotification *notifier, const char *hint)
++{
++        g_return_if_fail (GSD_IS_OSD_NOTIFICATION (notifier));
++
++        g_free (notifier->priv->hint);
++        notifier->priv->hint = g_strdup (hint);
++}
++
++gboolean
++gsd_osd_notification_is_supported (void)
++{
++        GList *caps;
++        gboolean has_cap;
++
++        caps = notify_get_server_caps ();
++        has_cap = (g_list_find_custom (caps, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, 
(GCompareFunc) g_strcmp0) != NULL);
++        g_list_foreach (caps, (GFunc) g_free, NULL);
++        g_list_free (caps);
++
++        return has_cap;
++}
++
++gboolean
++gsd_osd_notification_show_icon_only (const char *icon, const char *hint)
++{
++        NotifyNotification *notification;
++
++        g_return_val_if_fail (icon != NULL, FALSE);
++        g_return_val_if_fail (hint != NULL, FALSE);
++
++        if (!gsd_osd_notification_is_supported ())
++                return FALSE;
++
++        notification = notify_notification_new (" ", "", NULL, NULL);
++
++        if (notification != NULL) {
++                notify_notification_set_hint_string (notification, 
NOTIFY_CAP_PRIVATE_SYNCHRONOUS, hint);
++                notify_notification_set_hint_string (notification, 
NOTIFY_CAP_PRIVATE_ICON_ONLY, NOTIFY_HINT_TRUE);
++                notify_notification_update (notification, " ", "", icon);
++        } else {
++                return FALSE;
++        }
++
++        if (!notify_notification_show (notification, NULL)) {
++                g_object_unref (notification);
++                return FALSE;
++        }
++
++        g_object_unref (notification);
++
++        return TRUE;
++}
++
++gboolean
++gsd_osd_notification_show_value (GsdOsdNotification *notifier, gint value, 
gboolean muted)
++{
++        const char *icon;
++
++        g_return_val_if_fail (GSD_IS_OSD_NOTIFICATION (notifier), FALSE);
++        g_return_val_if_fail (notifier->priv->icon_names != NULL, FALSE);
++        g_return_val_if_fail (notifier->priv->hint != NULL, FALSE);
++
++        if (!gsd_osd_notification_is_supported ())
++                return FALSE;
++
++        if (notifier->priv->notification == NULL) {
++                notifier->priv->notification = notify_notification_new (" ", 
"", NULL, NULL);
++                notify_notification_set_hint_string 
(notifier->priv->notification, NOTIFY_CAP_PRIVATE_SYNCHRONOUS, 
notifier->priv->hint);
++}
++        if (notifier->priv->notification != NULL) {
++                value = MIN (value, 101);
++                value = MAX (value, -1);
++                icon = _calculate_icon (notifier, value, muted);
++                
notify_notification_set_hint_int32(notifier->priv->notification, "value", 
(muted && value > 0) ? 0 : value);
++                notify_notification_update (notifier->priv->notification, " 
", "", icon);
++        } else {
++                return FALSE;
++        }
++
++        if (!notify_notification_show (notifier->priv->notification, NULL))
++                return FALSE;
++
++        return TRUE;
++}
++
++gboolean
++gsd_osd_notification_show_overshoot (GsdOsdNotification *notifier, 
GsdOsdNotifierOvershootType type)
++{
++        gint value;
++        gboolean muted;
++
++        g_return_val_if_fail (type == GSD_OSD_NOTIFICATION_UNDERSHOOT || type 
== GSD_OSD_NOTIFICATION_OVERSHOOT, FALSE);
++
++        switch (type)
++        {
++        case GSD_OSD_NOTIFICATION_UNDERSHOOT:
++                value = -1;
++                muted = TRUE;
++                break;
++        case GSD_OSD_NOTIFICATION_OVERSHOOT:
++                value = 101;
++                muted = FALSE;
++                break;
++        default:
++                g_assert_not_reached ();
++                break;
++        }
++
++        return gsd_osd_notification_show_value (notifier, value, muted);
++}
++
++GsdOsdNotification*
++gsd_osd_notification_new (const char **icon_names, const char *hint)
++{
++        return (GsdOsdNotification *) g_object_new (GSD_TYPE_OSD_NOTIFICATION,
++                                                    "icon-names", icon_names,
++                                                    "hint", hint,
++                                                    NULL);
++}
++
++static void
++gsd_osd_notification_init (GsdOsdNotification *object)
++{
++        object->priv = GSD_OSD_NOTIFICATION_PRIVATE (object);
++
++        if (!notify_is_initted ())
++                notify_init (g_get_application_name ());
++
++        object->priv->hint = NULL;
++        object->priv->icon_names = NULL;
++        object->priv->notification = NULL;
++}
++
++static void
++gsd_osd_notification_finalize (GObject *object)
++{
++        GsdOsdNotification *notifier = GSD_OSD_NOTIFICATION (object);
++
++        g_strfreev (notifier->priv->icon_names);
++        g_free (notifier->priv->hint);
++
++        if (notifier->priv->notification)
++                g_object_unref (notifier->priv->notification);
++
++        G_OBJECT_CLASS (gsd_osd_notification_parent_class)->finalize (object);
++}
++
++static void
++gsd_osd_notification_set_property (GObject *object, guint prop_id, const 
GValue *value, GParamSpec *pspec)
++{
++      g_return_if_fail (GSD_IS_OSD_NOTIFICATION (object));
++        GsdOsdNotification *notifier = GSD_OSD_NOTIFICATION (object);
++
++      switch (prop_id)
++      {
++      case PROP_ICON_NAMES:
++              gsd_osd_notification_set_icon_array (notifier, (const char**) 
g_value_get_boxed (value));
++              break;
++        case PROP_HINT:
++                gsd_osd_notification_set_hint (notifier, (char**) 
g_value_get_string (value));
++                break;
++      default:
++              G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
++              break;
++      }
++}
++
++static void
++gsd_osd_notification_get_property (GObject *object, guint prop_id, GValue 
*value, GParamSpec *pspec)
++{
++      g_return_if_fail (GSD_IS_OSD_NOTIFICATION (object));
++        GsdOsdNotification *notifier = GSD_OSD_NOTIFICATION (object);
++
++      switch (prop_id)
++      {
++      case PROP_ICON_NAMES:
++              g_value_set_boxed (value, notifier->priv->icon_names);
++              break;
++        case PROP_HINT:
++                g_value_set_string (value, notifier->priv->hint);
++                break;
++      default:
++              G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
++              break;
++      }
++}
++
++static void
++gsd_osd_notification_class_init (GsdOsdNotificationClass *klass)
++{
++        GObjectClass* object_class = G_OBJECT_CLASS (klass);
++
++        object_class->finalize = gsd_osd_notification_finalize;
++      object_class->set_property = gsd_osd_notification_set_property;
++      object_class->get_property = gsd_osd_notification_get_property;
++
++      g_object_class_install_property (object_class,
++                                       PROP_ICON_NAMES,
++                                       g_param_spec_boxed ("icon-names",
++                                                           "Icon name array",
++                                                           "An array of icon 
names for the notification",
++                                                           G_TYPE_STRV,
++                                                           G_PARAM_WRITABLE | 
G_PARAM_CONSTRUCT));
++
++        g_object_class_install_property (object_class,
++                                       PROP_HINT,
++                                       g_param_spec_string ("hint",
++                                                           "Notification 
hint",
++                                                           "Hint for the 
notification",
++                                                           NULL,
++                                                           G_PARAM_WRITABLE | 
G_PARAM_CONSTRUCT));
++
++        g_type_class_add_private (klass, sizeof (GsdOsdNotificationPrivate));
++}
+Index: gnome-power-manager-2.31.6/src/gsd-osd-notification.h
+===================================================================
+--- /dev/null  1970-01-01 00:00:00.000000000 +0000
++++ gnome-power-manager-2.31.6/src/gsd-osd-notification.h      2010-08-13 
09:21:11.000000000 +0200
+@@ -0,0 +1,75 @@
++/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 8; tab-width: 8 -*- */
++/*
++ * gsd-osd-notification.c
++ * Copyright (C) 2010 Chris Coulson <chrisccoul...@ubuntu.com>
++ * Copyright (C) 2009 Canonical Ltd
++ *
++ * gsd-osd-notification.c is free software: you can redistribute it and/or 
modify it
++ * under the terms of the GNU General Public License as published by the
++ * Free Software Foundation, either version 3 of the License, or
++ * (at your option) any later version.
++ *
++ * gsd-osd-notification.c is distributed in the hope that it will be useful, 
but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
++ * See the GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License along
++ * with this program.  If not, see <http://www.gnu.org/licenses/>.
++ */
++
++#ifndef _GSD_OSD_NOTIFICATION_H_
++#define _GSD_OSD_NOTIFICATION_H_
++
++#include <glib-object.h>
++
++G_BEGIN_DECLS
++
++#define GSD_TYPE_OSD_NOTIFICATION             (gsd_osd_notification_get_type 
())
++#define GSD_OSD_NOTIFICATION(obj)             (G_TYPE_CHECK_INSTANCE_CAST 
((obj), GSD_TYPE_OSD_NOTIFICATION, GsdOsdNotification))
++#define GSD_OSD_NOTIFICATION_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST 
((klass), GSD_TYPE_OSD_NOTIFICATION, GsdOsdNotificationClass))
++#define GSD_IS_OSD_NOTIFICATION(obj)          (G_TYPE_CHECK_INSTANCE_TYPE 
((obj), GSD_TYPE_OSD_NOTIFICATION))
++#define GSD_IS_OSD_NOTIFICATION_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE 
((klass), GSD_TYPE_OSD_NOTIFICATION))
++#define GSD_OSD_NOTIFICATION_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS 
((obj), GSD_TYPE_OSD_NOTIFICATION, GsdOsdNotificationClass))
++
++typedef struct _GsdOsdNotificationClass GsdOsdNotificationClass;
++typedef struct _GsdOsdNotification GsdOsdNotification;
++typedef struct _GsdOsdNotificationPrivate GsdOsdNotificationPrivate;
++
++struct _GsdOsdNotificationClass
++{
++        GObjectClass parent_class;
++};
++
++struct _GsdOsdNotification
++{
++        GObject parent_instance;
++
++        GsdOsdNotificationPrivate *priv;
++};
++
++typedef enum {
++        GSD_OSD_NOTIFICATION_NO_OVERSHOOT = 0,
++        GSD_OSD_NOTIFICATION_UNDERSHOOT,
++        GSD_OSD_NOTIFICATION_OVERSHOOT,
++} GsdOsdNotifierOvershootType;
++
++GType                   gsd_osd_notification_get_type           (void) 
G_GNUC_CONST;
++GsdOsdNotification*     gsd_osd_notification_new                (const char   
              **icon_names,
++                                                                 const char   
               *hint);
++void                    gsd_osd_notification_set_icon_array     
(GsdOsdNotification          *notifier,
++                                                                 const char   
              **icon_names);
++void                    gsd_osd_notification_set_hint           
(GsdOsdNotification          *notifier,
++                                                                 const char   
               *hint);
++gboolean                gsd_osd_notification_is_supported       (void);
++gboolean                gsd_osd_notification_show_value         
(GsdOsdNotification          *notifier,
++                                                                 gint         
               value,
++                                                                 gboolean     
                muted);
++gboolean                gsd_osd_notification_show_overshoot     
(GsdOsdNotification          *notifier,
++                                                                 
GsdOsdNotifierOvershootType  type);
++gboolean                gsd_osd_notification_show_icon_only     (const char   
               *icon,
++                                                                 const char   
               *hint);
++
++G_END_DECLS
++
++#endif /* _GSD_OSD_NOTIFICATION_H_ */
+Index: gnome-power-manager-2.31.6/src/gpm-backlight.c
+===================================================================
+--- gnome-power-manager-2.31.6.orig/src/gpm-backlight.c        2010-08-06 
16:28:52.000000000 +0200
++++ gnome-power-manager-2.31.6/src/gpm-backlight.c     2010-08-13 
09:21:11.063803003 +0200
+@@ -55,6 +55,7 @@
+ #include "gpm-stock-icons.h"
+ #include "gpm-prefs-server.h"
+ #include "egg-console-kit.h"
++#include "gsd-osd-notification.h"
+
+ #define GPM_BACKLIGHT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), 
GPM_TYPE_BACKLIGHT, GpmBacklightPrivate))
+
+@@ -69,6 +70,7 @@
+       GpmDpms                 *dpms;
+       GpmIdle                 *idle;
+       EggConsoleKit           *consolekit;
++      GsdOsdNotification      *notifier;
+       gboolean                 can_dim;
+       gboolean                 system_is_idle;
+       GTimer                  *idle_timer;
+@@ -83,6 +85,15 @@
+
+ static guint signals [LAST_SIGNAL] = { 0 };
+
++static const char *backlight_icons[] = {
++        "notification-display-brightness-off",
++      "notification-display-brightness-low",
++      "notification-display-brightness-medium",
++      "notification-display-brightness-high",
++      "notification-display-brightness-full",
++      NULL
++};
++
+ G_DEFINE_TYPE (GpmBacklight, gpm_backlight, G_TYPE_OBJECT)
+
+ /**
+@@ -349,10 +360,12 @@
+
+       /* only show dialog if interactive */
+       if (interactive) {
+-              gpm_backlight_dialog_init (backlight);
+-              gsd_media_keys_window_set_volume_level (GSD_MEDIA_KEYS_WINDOW 
(backlight->priv->popup),
+-                                                      round (brightness));
+-              gpm_backlight_dialog_show (backlight);
++              if (!gsd_osd_notification_show_value 
(backlight->priv->notifier, round (brightness), FALSE)) {
++                      gpm_backlight_dialog_init (backlight);
++                      gsd_media_keys_window_set_volume_level 
(GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup),
++                                                              round 
(brightness));
++                      gpm_backlight_dialog_show (backlight);
++              }
+       }
+
+       ret = gpm_brightness_set (backlight->priv->brightness, value, 
&hw_changed);
+@@ -433,8 +446,14 @@
+       GError *error = NULL;
+       guint percentage;
+       gboolean hw_changed;
++      gboolean brightness_at_0;
++      gboolean brightness_at_100;
+       egg_debug ("Button press event type=%s", type);
+
++      gpm_brightness_get (backlight->priv->brightness, &percentage);
++      brightness_at_100 = percentage == 100 ? TRUE : FALSE;
++      brightness_at_0 = percentage == 0 ? TRUE : FALSE;
++
+       if (strcmp (type, GPM_BUTTON_BRIGHT_UP) == 0) {
+               /* go up one step */
+               ret = gpm_brightness_up (backlight->priv->brightness, 
&hw_changed);
+@@ -442,10 +461,17 @@
+               /* show the new value */
+               if (ret) {
+                       gpm_brightness_get (backlight->priv->brightness, 
&percentage);
+-                      gpm_backlight_dialog_init (backlight);
+-                      gsd_media_keys_window_set_volume_level 
(GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup),
+-                                                              percentage);
+-                      gpm_backlight_dialog_show (backlight);
++                      if (brightness_at_100) {
++                              ret = gsd_osd_notification_show_overshoot 
(backlight->priv->notifier, GSD_OSD_NOTIFICATION_OVERSHOOT);
++                      } else {
++                              ret = gsd_osd_notification_show_value 
(backlight->priv->notifier, percentage, FALSE);
++                      }
++                      if (!ret) {
++                              gpm_backlight_dialog_init (backlight);
++                              gsd_media_keys_window_set_volume_level 
(GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup),
++                                                                      
percentage);
++                              gpm_backlight_dialog_show (backlight);
++                      }
+                       /* save the new percentage */
+                       backlight->priv->master_percentage = percentage;
+               }
+@@ -461,10 +487,17 @@
+               /* show the new value */
+               if (ret) {
+                       gpm_brightness_get (backlight->priv->brightness, 
&percentage);
+-                      gpm_backlight_dialog_init (backlight);
+-                      gsd_media_keys_window_set_volume_level 
(GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup),
+-                                                              percentage);
+-                      gpm_backlight_dialog_show (backlight);
++                      if (brightness_at_0) {
++                              ret = gsd_osd_notification_show_overshoot 
(backlight->priv->notifier, GSD_OSD_NOTIFICATION_UNDERSHOOT);
++                      } else {
++                              ret = gsd_osd_notification_show_value 
(backlight->priv->notifier, percentage, FALSE);
++                      }
++                      if (!ret) {
++                              gpm_backlight_dialog_init (backlight);
++                              gsd_media_keys_window_set_volume_level 
(GSD_MEDIA_KEYS_WINDOW (backlight->priv->popup),
++                                                                      
percentage);
++                              gpm_backlight_dialog_show (backlight);
++                      }
+                       /* save the new percentage */
+                       backlight->priv->master_percentage = percentage;
+               }
+@@ -687,6 +720,7 @@
+       g_object_unref (backlight->priv->idle);
+       g_object_unref (backlight->priv->brightness);
+       g_object_unref (backlight->priv->consolekit);
++      g_object_unref (backlight->priv->notifier);
+
+       g_return_if_fail (backlight->priv != NULL);
+       G_OBJECT_CLASS (gpm_backlight_parent_class)->finalize (object);
+@@ -793,6 +827,8 @@
+                                                TRUE);
+         gtk_window_set_position (GTK_WINDOW (backlight->priv->popup), 
GTK_WIN_POS_NONE);
+
++      backlight->priv->notifier = gsd_osd_notification_new (backlight_icons, 
"brightness");
++
+       /* DPMS mode poll class */
+       backlight->priv->dpms = gpm_dpms_new ();
+
diff --git a/source/gnome/gnome-power-manager/12-add-appindicators.patch 
b/source/gnome/gnome-power-manager/12-add-appindicators.patch
new file mode 100644
index 0000000..69b36c7
--- /dev/null
+++ b/source/gnome/gnome-power-manager/12-add-appindicators.patch
@@ -0,0 +1,423 @@
+Description: Add support for application indicators
+Authors: Jan Arne Petersen <jpeter...@jpetersen.org>
+         Karl Lattimer <karl.latti...@codethink.co.uk>
+Bug: https://bugzilla.gnome.org/show_bug.cgi?id=609654
+Bug-Ubuntu: 
https://bugs.launchpad.net/ubuntu/+source/gnome-power-manager/+bug/497870
+
+diff -uNr -x .pc gnome-power-manager-2.31.90.orig/configure.ac 
gnome-power-manager-2.31.90/configure.ac
+--- gnome-power-manager-2.31.90.orig/configure.ac      2010-08-24 
09:56:25.245912000 +0100
++++ gnome-power-manager-2.31.90/configure.ac   2010-08-24 09:56:54.420492001 
+0100
+@@ -122,6 +122,7 @@
+ XRANDR_REQUIRED=1.2.0
+ CANBERRA_REQUIRED=0.10
+ UPOWER_REQUIRED=0.9.1
++APPINDICATOR_REQUIRED=0.0.10
+
+ dnl 
---------------------------------------------------------------------------
+ dnl - Check library dependencies
+@@ -162,6 +163,27 @@
+
+ PKG_CHECK_MODULES(UPOWER, upower-glib >= $UPOWER_REQUIRED)
+
++AC_ARG_ENABLE([appindicator],
++ AS_HELP_STRING([--enable-appindicator[=@<:@no/auto/yes@:>@]],[Build support 
for application indicators]),
++ [enable_appindicator=$enableval],
++ [enable_appindicator="auto"])
++
++if test x$enable_appindicator = xauto ; then
++  PKG_CHECK_EXISTS([appindicator-0.1 >= $APPINDICATOR_REQUIRED],
++    [enable_appindicator="yes"],
++    [enable_appindicator="no"])
++fi
++
++if test x$enable_appindicator = xyes ; then
++  PKG_CHECK_EXISTS([appindicator-0.1 >= $APPINDICATOR_REQUIRED],
++    [AC_DEFINE(HAVE_APP_INDICATOR, 1, [Have AppIndicator])
++     PKG_CHECK_MODULES(APP_INDICATOR, [appindicator-0.1 >= 
$APPINDICATOR_REQUIRED])],
++    [AC_MSG_ERROR([appindicator-0.1 is not installed])])
++fi
++AM_CONDITIONAL(HAVE_APP_INDICATOR, [test x$enable_appindicator = xyes])
++AC_SUBST(APP_INDICATOR_CFLAGS)
++AC_SUBST(APP_INDICATOR_LIBS)
++
+ AC_PATH_PROG(GCONFTOOL, gconftool-2)
+ AM_GCONF_SOURCE_2
+
+@@ -362,6 +384,7 @@
+         Self test support:         ${have_tests}
+         GConf default support:     ${have_gconfdefaults}
+         Docbook support:           ${enable_docbook_docs}
++        App indicator support:     ${enable_appindicator}
+         documentation dir:         $DOCDIR
+         dbus-1 services dir:       $DBUS_SERVICES_DIR
+         gconf-schema dir:          $GCONF_SCHEMA_FILE_DIR
+diff -uNr -x .pc gnome-power-manager-2.31.90.orig/src/gpm-common.c 
gnome-power-manager-2.31.90/src/gpm-common.c
+--- gnome-power-manager-2.31.90.orig/src/gpm-common.c  2010-08-17 
15:30:31.000000000 +0100
++++ gnome-power-manager-2.31.90/src/gpm-common.c       2010-08-25 
15:56:34.711183080 +0100
+@@ -55,15 +55,22 @@
+       }
+
+       if (minutes < 60) {
++#ifdef HAVE_APP_INDICATOR
++              timestring = g_strdup_printf ("0:%02d", minutes);
++#else
+               timestring = g_strdup_printf (ngettext ("%i minute",
+                                                       "%i minutes",
+                                                       minutes), minutes);
++#endif
+               return timestring;
+       }
+
+       hours = minutes / 60;
+       minutes = minutes % 60;
+
++#ifdef HAVE_APP_INDICATOR
++      timestring = g_strdup_printf ("%d:%02d", hours, minutes);
++#else
+       if (minutes == 0)
+               timestring = g_strdup_printf (ngettext (
+                               "%i hour",
+@@ -75,6 +82,7 @@
+               timestring = g_strdup_printf (_("%i %s %i %s"),
+                               hours, ngettext ("hour", "hours", hours),
+                               minutes, ngettext ("minute", "minutes", 
minutes));
++#endif
+       return timestring;
+ }
+
+diff -uNr -x .pc gnome-power-manager-2.31.90.orig/src/gpm-manager.c 
gnome-power-manager-2.31.90/src/gpm-manager.c
+--- gnome-power-manager-2.31.90.orig/src/gpm-manager.c 2010-08-24 
09:56:25.225902000 +0100
++++ gnome-power-manager-2.31.90/src/gpm-manager.c      2010-08-24 
09:56:54.420492001 +0100
+@@ -2086,7 +2086,8 @@
+       g_object_unref (manager->priv->backlight);
+       g_object_unref (manager->priv->console);
+       g_object_unref (manager->priv->client);
+-      g_object_unref (manager->priv->status_icon);
++      if (manager->priv->status_icon)
++              g_object_unref (manager->priv->status_icon);
+
+       G_OBJECT_CLASS (gpm_manager_parent_class)->finalize (object);
+ }
+diff -uNr -x .pc gnome-power-manager-2.31.90.orig/src/gpm-tray-icon.c 
gnome-power-manager-2.31.90/src/gpm-tray-icon.c
+--- gnome-power-manager-2.31.90.orig/src/gpm-tray-icon.c       2010-08-24 
09:56:25.185882000 +0100
++++ gnome-power-manager-2.31.90/src/gpm-tray-icon.c    2010-08-24 
09:56:54.420492001 +0100
+@@ -41,6 +41,10 @@
+ #include <gconf/gconf-client.h>
+ #include <libupower-glib/upower.h>
+
++#ifdef HAVE_APP_INDICATOR
++#include <libappindicator/app-indicator.h>
++#endif
++
+ #include "egg-debug.h"
+
+ #include "gpm-upower.h"
+@@ -57,7 +61,11 @@
+ {
+       GConfClient             *conf;
+       GpmEngine               *engine;
++#ifdef HAVE_APP_INDICATOR
++      AppIndicator            *app_indicator;
++#else
+       GtkStatusIcon           *status_icon;
++#endif
+       gboolean                 show_actions;
+ };
+
+@@ -81,7 +89,16 @@
+ gpm_tray_icon_show (GpmTrayIcon *icon, gboolean enabled)
+ {
+       g_return_if_fail (GPM_IS_TRAY_ICON (icon));
++#ifdef HAVE_APP_INDICATOR
++      if (enabled)
++              app_indicator_set_status (icon->priv->app_indicator,
++                                        APP_INDICATOR_STATUS_ACTIVE);
++      else
++              app_indicator_set_status (icon->priv->app_indicator,
++                                        APP_INDICATOR_STATUS_PASSIVE);
++#else
+       gtk_status_icon_set_visible (icon->priv->status_icon, enabled);
++#endif
+ }
+
+ /**
+@@ -95,11 +112,13 @@
+       g_return_val_if_fail (GPM_IS_TRAY_ICON (icon), FALSE);
+       g_return_val_if_fail (tooltip != NULL, FALSE);
+
++#ifndef HAVE_APP_INDICATOR
+ #if GTK_CHECK_VERSION(2,15,0)
+       gtk_status_icon_set_tooltip_text (icon->priv->status_icon, tooltip);
+ #else
+       gtk_status_icon_set_tooltip (icon->priv->status_icon, tooltip);
+ #endif
++#endif
+       return TRUE;
+ }
+
+@@ -110,7 +129,11 @@
+ gpm_tray_icon_get_status_icon (GpmTrayIcon *icon)
+ {
+       g_return_val_if_fail (GPM_IS_TRAY_ICON (icon), NULL);
++#ifdef HAVE_APP_INDICATOR
++      return NULL;
++#else
+       return g_object_ref (icon->priv->status_icon);
++#endif
+ }
+
+ /**
+@@ -127,7 +150,11 @@
+
+       if (filename != NULL) {
+               egg_debug ("Setting icon to %s", filename);
++#ifdef HAVE_APP_INDICATOR
++              app_indicator_set_icon (icon->priv->app_indicator, filename);
++#else
+               gtk_status_icon_set_from_icon_name (icon->priv->status_icon, 
filename);
++#endif
+
+               /* make sure that we are visible */
+               gpm_tray_icon_show (icon, TRUE);
+@@ -208,7 +235,9 @@
+       gchar *icon_name;
+       gchar *label;
+       GtkWidget *item;
++#ifndef HAVE_APP_INDICATOR
+       GtkWidget *image;
++#endif
+       const gchar *object_path;
+       const gchar *desc;
+       UpDevice *device;
+@@ -233,6 +262,11 @@
+               added++;
+
+               /* generate the label */
++#ifdef HAVE_APP_INDICATOR
++              desc = gpm_upower_get_device_summary (device);
++              item = gtk_menu_item_new_with_label (desc);
++              label = NULL;
++#else
+               desc = gpm_device_kind_to_localised_text (kind, 1);
+               label = g_strdup_printf ("%s (%.1f%%)", desc, percentage);
+               item = gtk_image_menu_item_new_with_label (label);
+@@ -242,6 +276,7 @@
+               image = gtk_image_new_from_icon_name (icon_name, 
GTK_ICON_SIZE_MENU);
+               gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), 
image);
+               gtk_image_menu_item_set_always_show_image (GTK_IMAGE_MENU_ITEM 
(item), TRUE);
++#endif
+
+               /* callback and add the the menu */
+               g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK 
(gpm_tray_icon_show_info_cb), icon);
+@@ -264,7 +299,9 @@
+ {
+       GtkMenu *menu = (GtkMenu*) gtk_menu_new ();
+       GtkWidget *item;
++#ifndef HAVE_APP_INDICATOR
+       GtkWidget *image;
++#endif
+       guint dev_cnt = 0;
+       GPtrArray *array;
+
+@@ -294,9 +331,13 @@
+       }
+
+       /* preferences */
++#ifdef HAVE_APP_INDICATOR
++      item = gtk_menu_item_new_with_mnemonic (_("_Preferences"));
++#else
+       item = gtk_image_menu_item_new_with_mnemonic (_("_Preferences"));
+       image = gtk_image_new_from_icon_name (GTK_STOCK_PREFERENCES, 
GTK_ICON_SIZE_MENU);
+       gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
++#endif
+       g_signal_connect (G_OBJECT (item), "activate",
+                         G_CALLBACK (gpm_tray_icon_show_preferences_cb), icon);
+       gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+@@ -304,14 +345,30 @@
+ skip_prefs:
+       /* show the menu */
+       gtk_widget_show_all (GTK_WIDGET (menu));
++#ifdef HAVE_APP_INDICATOR
++      app_indicator_set_menu (icon->priv->app_indicator, menu);
++#else
+       gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
+                       gtk_status_icon_position_menu, icon->priv->status_icon,
+                       1, timestamp);
++#endif
+
+       g_signal_connect (GTK_WIDGET (menu), "hide",
+                         G_CALLBACK (gpm_tray_icon_popup_cleared_cd), icon);
+ }
+
++#ifdef HAVE_APP_INDICATOR
++/**
++ * gpm_tray_icon_devices_changed_cb:
++ *
++ * Callback when devices are changed and menu has to be recreated
++ **/
++static void
++gpm_tray_icon_devices_changed_cb (GpmEngine *engine, GpmTrayIcon *icon)
++{
++      gpm_tray_icon_create_menu (icon, gtk_get_current_event_time());
++}
++#else
+ /**
+  * gpm_tray_icon_popup_menu_cb:
+  *
+@@ -337,6 +394,7 @@
+       egg_debug ("icon left clicked");
+       gpm_tray_icon_create_menu (icon, gtk_get_current_event_time());
+ }
++#endif
+
+ /**
+  * gpm_conf_gconf_key_changed_cb:
+@@ -381,6 +439,17 @@
+                                (GConfClientNotifyFunc) 
gpm_conf_gconf_key_changed_cb,
+                                icon, NULL, NULL);
+
++#ifdef HAVE_APP_INDICATOR
++      icon->priv->app_indicator = app_indicator_new_with_path 
("gnome-power-manager",
++                                                               
"gnome-power-manager",
++                                                               
APP_INDICATOR_CATEGORY_HARDWARE,
++                                                               GPM_DATA 
G_DIR_SEPARATOR_S "icons");
++
++      gpm_tray_icon_create_menu (icon, gtk_get_current_event_time());
++      g_signal_connect_object (G_OBJECT (icon->priv->engine), 
"devices-changed",
++                               G_CALLBACK (gpm_tray_icon_devices_changed_cb),
++                               icon, 0);
++#else
+       icon->priv->status_icon = gtk_status_icon_new ();
+       g_signal_connect_object (G_OBJECT (icon->priv->status_icon),
+                                "popup_menu",
+@@ -390,6 +459,7 @@
+                                "activate",
+                                G_CALLBACK (gpm_tray_icon_activate_cb),
+                                icon, 0);
++#endif
+
+       allowed_in_menu = gconf_client_get_bool (icon->priv->conf, 
GPM_CONF_UI_SHOW_ACTIONS, NULL);
+       gpm_tray_icon_enable_actions (icon, allowed_in_menu);
+@@ -409,7 +479,11 @@
+
+       tray_icon = GPM_TRAY_ICON (object);
+
++#ifdef HAVE_APP_INDICATOR
++      g_object_unref (tray_icon->priv->app_indicator);
++#else
+       g_object_unref (tray_icon->priv->status_icon);
++#endif
+       g_object_unref (tray_icon->priv->engine);
+       g_return_if_fail (tray_icon->priv != NULL);
+
+diff -uNr -x .pc gnome-power-manager-2.31.90.orig/src/gpm-upower.c 
gnome-power-manager-2.31.90/src/gpm-upower.c
+--- gnome-power-manager-2.31.90.orig/src/gpm-upower.c  2010-08-17 
15:30:31.000000000 +0100
++++ gnome-power-manager-2.31.90/src/gpm-upower.c       2010-08-25 
14:54:19.291183081 +0100
+@@ -229,7 +229,10 @@
+
+       /* we always display "Laptop battery 16 minutes remaining" as we need 
to clarify what device we are refering to */
+       if (state == UP_DEVICE_STATE_FULLY_CHARGED) {
+-
++#ifdef HAVE_APP_INDICATOR
++              /* TRANSLATORS: the device is fully charged */
++              description = g_strdup_printf (_("%s is charged"), kind_desc);
++#else
+               if (kind == UP_DEVICE_KIND_BATTERY && time_to_empty_round > 
GPM_UP_TEXT_MIN_TIME) {
+                       time_to_empty_str = gpm_get_timestring 
(time_to_empty_round);
+                       /* TRANSLATORS: The laptop battery is fully charged, 
and we know a time */
+@@ -240,9 +243,22 @@
+                       /* TRANSLATORS: the device is fully charged */
+                       description = g_strdup_printf (_("%s is fully 
charged"), kind_desc);
+               }
+-
++#endif
+       } else if (state == UP_DEVICE_STATE_DISCHARGING) {
+-
++#ifdef HAVE_APP_INDICATOR
++              if (time_to_empty_round <= GPM_UP_TEXT_MIN_TIME) {
++                      /* TRANSLATORS: the device is discharging and we don't 
have a time remaining yet */
++                      description = g_strdup_printf (_("%s (estimating...)"), 
kind_desc);
++              } else if (time_to_empty_round <= 12*60*60)  {
++                      time_to_empty_str = gpm_get_timestring 
(time_to_empty_round);
++                      /* TRANSLATORS: the device is discharging, and we have 
a time remaining */
++                      description = g_strdup_printf (_("%s %s left"), 
kind_desc, time_to_empty_str);
++                      g_free (time_to_empty_str);
++              } else { /* larger than 12 hours remaining */
++                      /* TRANSLATORS: the device is discharging */
++                      description = g_strdup_printf (_("%s"), kind_desc);
++              }
++#else
+               if (time_to_empty_round > GPM_UP_TEXT_MIN_TIME) {
+                       time_to_empty_str = gpm_get_timestring 
(time_to_empty_round);
+                       /* TRANSLATORS: the device is discharging, and we have 
a time remaining */
+@@ -254,9 +270,20 @@
+                       description = g_strdup_printf (_("%s discharging 
(%.1f%%)"),
+                                                       kind_desc, percentage);
+               }
+-
++#endif
+       } else if (state == UP_DEVICE_STATE_CHARGING) {
+-
++#ifdef HAVE_APP_INDICATOR
++              if (time_to_full_round > GPM_UP_TEXT_MIN_TIME) {
++                      time_to_full_str = gpm_get_timestring 
(time_to_full_round);
++                      /* TRANSLATORS: the device is charging */
++                      description = g_strdup_printf (_("%s %s until 
charged"), kind_desc, time_to_full_str);
++                      g_free (time_to_full_str);
++              } else {
++                      /* TRANSLATORS: device is charging, but we only have a 
percentage */
++                      description = g_strdup_printf (_("%s (estimating...)"),
++                                              kind_desc, percentage);
++              }
++#else
+               if (time_to_full_round > GPM_UP_TEXT_MIN_TIME &&
+                   time_to_empty_round > GPM_UP_TEXT_MIN_TIME) {
+
+@@ -285,18 +312,23 @@
+                       description = g_strdup_printf (_("%s charging 
(%.1f%%)"),
+                                               kind_desc, percentage);
+               }
+-
++#endif
+       } else if (state == UP_DEVICE_STATE_PENDING_DISCHARGE) {
+-
+               /* TRANSLATORS: this is only shown for laptops with multiple 
batteries */
++#ifdef HAVE_APP_INDICATOR
++              description = g_strdup_printf (_("%s waiting to discharge"),
++                                              kind_desc);
++#else
+               description = g_strdup_printf (_("%s waiting to discharge 
(%.1f%%)"),
+                                               kind_desc, percentage);
+-
++#endif
+       } else if (state == UP_DEVICE_STATE_PENDING_CHARGE) {
+-
+               /* TRANSLATORS: this is only shown for laptops with multiple 
batteries */
++#ifdef HAVE_APP_INDICATOR
++              description = g_strdup_printf (_("%s waiting to charge"), 
kind_desc);
++#else
+               description = g_strdup_printf (_("%s waiting to charge 
(%.1f%%)"), kind_desc, percentage);
+-
++#endif
+       } else {
+               egg_warning ("in an undefined state we are not charging or "
+                            "discharging and the batteries are also not 
charged");
+diff -uNr -x .pc gnome-power-manager-2.31.90.orig/src/Makefile.am 
gnome-power-manager-2.31.90/src/Makefile.am
+--- gnome-power-manager-2.31.90.orig/src/Makefile.am   2010-08-24 
09:56:25.205892000 +0100
++++ gnome-power-manager-2.31.90/src/Makefile.am        2010-08-24 
09:56:54.420492001 +0100
+@@ -20,6 +20,7 @@
+       $(GSTREAMER_CFLAGS)                             \
+       -DI_KNOW_THE_DEVICEKIT_POWER_API_IS_SUBJECT_TO_CHANGE \
+       $(UPOWER_CFLAGS)                                \
++      $(APP_INDICATOR_CFLAGS)                         \
+       -DBINDIR=\"$(bindir)\"                          \
+       -DSBINDIR=\"$(sbindir)\"                         \
+       -DGNOMELOCALEDIR=\""$(datadir)/locale"\"        \
+@@ -186,6 +187,7 @@
+       $(X11_LIBS)                             \
+       $(GSTREAMER_LIBS)                               \
+       $(GNOME_LIBS)                                   \
++      $(APP_INDICATOR_LIBS)                           \
+       $(DBUS_LIBS)                                    \
+       $(X11_LIBS)                                             \
+       $(CANBERRA_LIBS)                                \
diff --git a/source/gnome/gnome-power-manager/FrugalBuild 
b/source/gnome/gnome-power-manager/FrugalBuild
index 5246607..1e284dc 100644
--- a/source/gnome/gnome-power-manager/FrugalBuild
+++ b/source/gnome/gnome-power-manager/FrugalBuild
@@ -3,7 +3,7 @@

pkgname=gnome-power-manager
pkgver=2.32.0
-pkgrel=1
+pkgrel=2
pkgdesc="GNOME Power Management tool"
url="http://www.gnome.org/";
depends=('libnotify>=0.4.4' 'hal>=0.5.11' 'dbus-glib>=0.80' 'xextproto' 
'libgnome>=2.30.0' \
@@ -18,7 +18,10 @@ _F_gnome_desktop=y
_F_gnome_iconcache=y
Finclude gnome gnome-scriptlet
Fconfopts="$Fconfopts --enable-applets --enable-keyring --enable-policykit"
-sha1sums=('829d65addba1dc3a7e91ebb871525dc16223a082')
+source=($source 02-notify-osd-support.patch 12-add-appindicators.patch)
+sha1sums=('829d65addba1dc3a7e91ebb871525dc16223a082' \
+          'ae37fb712e47a2582c661cc2d5298a7e7490cd91' \
+          '6e9b3e713ebeaad62a9883bac96aca5c3cea4c38')

build() {
Fcd
_______________________________________________
Frugalware-git mailing list
Frugalware-git@frugalware.org
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to