[Goodies-commits] r6988 - in xfce4-power-manager/trunk: . libxfpm src
Ali Abdallah
aliov at xfce.org
Tue Mar 24 16:18:29 CET 2009
Author: aliov
Date: 2009-03-24 15:18:29 +0000 (Tue, 24 Mar 2009)
New Revision: 6988
Modified:
xfce4-power-manager/trunk/ChangeLog
xfce4-power-manager/trunk/libxfpm/xfpm-notify.c
xfce4-power-manager/trunk/libxfpm/xfpm-notify.h
xfce4-power-manager/trunk/src/xfpm-adapter.h
xfce4-power-manager/trunk/src/xfpm-backlight.h
xfce4-power-manager/trunk/src/xfpm-brightness-hal.h
xfce4-power-manager/trunk/src/xfpm-inhibit.c
xfce4-power-manager/trunk/src/xfpm-tray-icon.h
Log:
Generate random cookie on the inhibit+some optimizations
Modified: xfce4-power-manager/trunk/ChangeLog
===================================================================
--- xfce4-power-manager/trunk/ChangeLog 2009-03-24 15:09:26 UTC (rev 6987)
+++ xfce4-power-manager/trunk/ChangeLog 2009-03-24 15:18:29 UTC (rev 6988)
@@ -1,4 +1,7 @@
+2009-03-24 16:18 Ali aliov at xfce.org
+ * : Generate random cookie on the inhibit+some optimizations
+
2009-03-24 16:09 Ali aliov at xfce.org
* : Fix a crash in the brightness plugin when no device found
Modified: xfce4-power-manager/trunk/libxfpm/xfpm-notify.c
===================================================================
--- xfce4-power-manager/trunk/libxfpm/xfpm-notify.c 2009-03-24 15:09:26 UTC (rev 6987)
+++ xfce4-power-manager/trunk/libxfpm/xfpm-notify.c 2009-03-24 15:18:29 UTC (rev 6988)
@@ -50,6 +50,14 @@
static void xfpm_notify_init (XfpmNotify *notify);
static void xfpm_notify_finalize (GObject *object);
+static NotifyNotification * xfpm_notify_new_notification_internal (XfpmNotify *notify,
+ const gchar *title,
+ const gchar *message,
+ const gchar *icon_name,
+ guint timeout,
+ XfpmNotifyUrgency urgency,
+ GtkStatusIcon *icon) G_GNUC_MALLOC;
+
#define XFPM_NOTIFY_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), XFPM_TYPE_NOTIFY, XfpmNotifyPrivate))
@@ -200,6 +208,9 @@
g_return_if_fail (XFPM_IS_NOTIFY(notify));
if ( !simple )
+ xfpm_notify_close_notification (notify);
+
+ if ( !simple )
{
g_signal_connect (G_OBJECT(n),"closed",
G_CALLBACK(xfpm_notify_closed_cb), notify);
Modified: xfce4-power-manager/trunk/libxfpm/xfpm-notify.h
===================================================================
--- xfce4-power-manager/trunk/libxfpm/xfpm-notify.h 2009-03-24 15:09:26 UTC (rev 6987)
+++ xfce4-power-manager/trunk/libxfpm/xfpm-notify.h 2009-03-24 15:18:29 UTC (rev 6988)
@@ -73,7 +73,7 @@
const gchar *icon_name,
guint timeout,
XfpmNotifyUrgency urgency,
- GtkStatusIcon *icon);
+ GtkStatusIcon *icon) G_GNUC_MALLOC;
void xfpm_notify_add_action_to_notification (XfpmNotify *notify,
NotifyNotification *n,
Modified: xfce4-power-manager/trunk/src/xfpm-adapter.h
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-adapter.h 2009-03-24 15:09:26 UTC (rev 6987)
+++ xfce4-power-manager/trunk/src/xfpm-adapter.h 2009-03-24 15:18:29 UTC (rev 6988)
@@ -50,9 +50,9 @@
GType xfpm_adapter_get_type (void) G_GNUC_CONST;
XfpmAdapter *xfpm_adapter_new (void);
-gboolean xfpm_adapter_get_present (XfpmAdapter *adapter);
+gboolean xfpm_adapter_get_present (XfpmAdapter *adapter) G_GNUC_PURE;
-gboolean xfpm_adapter_has_hw (XfpmAdapter *adapter);
+gboolean xfpm_adapter_has_hw (XfpmAdapter *adapter) G_GNUC_PURE;
G_END_DECLS
Modified: xfce4-power-manager/trunk/src/xfpm-backlight.h
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-backlight.h 2009-03-24 15:09:26 UTC (rev 6987)
+++ xfce4-power-manager/trunk/src/xfpm-backlight.h 2009-03-24 15:18:29 UTC (rev 6988)
@@ -47,7 +47,7 @@
GType xfpm_backlight_get_type (void) G_GNUC_CONST;
XfpmBacklight *xfpm_backlight_new (void);
-gboolean xfpm_backlight_has_hw (XfpmBacklight *bk);
+gboolean xfpm_backlight_has_hw (XfpmBacklight *bk) G_GNUC_PURE;
G_END_DECLS
Modified: xfce4-power-manager/trunk/src/xfpm-brightness-hal.h
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-brightness-hal.h 2009-03-24 15:09:26 UTC (rev 6987)
+++ xfce4-power-manager/trunk/src/xfpm-brightness-hal.h 2009-03-24 15:18:29 UTC (rev 6988)
@@ -47,7 +47,7 @@
GType xfpm_brightness_hal_get_type (void) G_GNUC_CONST;
XfpmBrightnessHal *xfpm_brightness_hal_new (void);
-gboolean xfpm_brightness_hal_has_hw (XfpmBrightnessHal *brg);
+gboolean xfpm_brightness_hal_has_hw (XfpmBrightnessHal *brg) G_GNUC_PURE;
void xfpm_brightness_hal_update_level (XfpmBrightnessHal *brg,
guint level);
G_END_DECLS
Modified: xfce4-power-manager/trunk/src/xfpm-inhibit.c
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-inhibit.c 2009-03-24 15:09:26 UTC (rev 6987)
+++ xfce4-power-manager/trunk/src/xfpm-inhibit.c 2009-03-24 15:18:29 UTC (rev 6988)
@@ -180,7 +180,11 @@
if ( list )
g_list_free (list);
- cookie = max + 1;
+ /*
+ * Should work in all the cases as we will not have thounsands of applications inhibiting us
+ */
+ cookie = (guint) g_random_int_range ( max + 1, max + 40);
+
return cookie;
}
@@ -265,8 +269,11 @@
TRACE("Inhibit send application name=%s reason=%s", IN_appname, IN_reason);
- inhibit->priv->inhibited = TRUE;
- g_signal_emit (G_OBJECT(inhibit), signals[HAS_INHIBIT_CHANGED], 0, inhibit->priv->inhibited);
+ if ( !inhibit->priv->inhibited )
+ {
+ inhibit->priv->inhibited = TRUE;
+ g_signal_emit (G_OBJECT(inhibit), signals[HAS_INHIBIT_CHANGED], 0, inhibit->priv->inhibited);
+ }
*OUT_cookie = cookie;
Modified: xfce4-power-manager/trunk/src/xfpm-tray-icon.h
===================================================================
--- xfce4-power-manager/trunk/src/xfpm-tray-icon.h 2009-03-24 15:09:26 UTC (rev 6987)
+++ xfce4-power-manager/trunk/src/xfpm-tray-icon.h 2009-03-24 15:18:29 UTC (rev 6988)
@@ -59,9 +59,9 @@
gboolean xfpm_tray_icon_get_visible (XfpmTrayIcon *icon);
-GtkStatusIcon *xfpm_tray_icon_get_tray_icon (XfpmTrayIcon *icon);
+GtkStatusIcon *xfpm_tray_icon_get_tray_icon (XfpmTrayIcon *icon) G_GNUC_PURE;
-const gchar *xfpm_tray_icon_get_icon_name (XfpmTrayIcon *icon);
+const gchar *xfpm_tray_icon_get_icon_name (XfpmTrayIcon *icon) G_GNUC_PURE;
G_END_DECLS
More information about the Goodies-commits
mailing list