~noskcaj/ubuntu/saucy/xfce4-power-manager/1.2.0-2ubuntu1

« back to all changes in this revision

Viewing changes to debian/patches/01_check-brightness-array-icon-index.patch

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc
  • Date: 2010-05-09 18:26:53 UTC
  • mfrom: (6.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100509182653-sjssv42yror533hz
Tags: 0.8.5-1ubuntu1
* Merge from Debian unstable, remaining Ubuntu changes:
  - debian/patches:
    + xubuntu-use-notification-icons.patch: use our notification-* icons
      for notification bubbles instead of the normal ones LP: #437374
    + xubuntu-assume-hal-is-available.patch: do not check for hal presence
      on the bus, it'll be spawned automatically on demand. lp: #507097
    + 10_pc.patch: added patched files to POTFILES.skip
    + series: created, with these two patches
  - debian/rules: add --with quilt
  - debian/control: build-depends on quilt (>= 0.46-7~)
  - debian/README.source: added.

* debian/patches/01_check-brightness-array-icon-index.patch,
  02_handle-weird-negative-brightness-level.patch: dropped, included
  upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From ae4f70d52bbc098c2cec5de1d1b979eb0bff87ac Mon Sep 17 00:00:00 2001
2
 
From: Ali Abdallah <aliov@xfce.org>
3
 
Date: Sun, 31 Jan 2010 14:38:47 +0000
4
 
Subject: Check brightness icon array index, to avoid a possible crash when weired brightness level
5
 
 
6
 
is reported by the backend.
7
 
 
8
 
This patch was edited for Xubuntu, to remove the unnecessary changes to the INSTALL file.
9
 
---
10
 
diff --git a/src/xfpm-brightness-widget.c b/src/xfpm-brightness-widget.c
11
 
index 6f90240..f4c1d19 100644
12
 
--- a/src/xfpm-brightness-widget.c
13
 
+++ b/src/xfpm-brightness-widget.c
14
 
@@ -104,7 +104,7 @@ xfpm_brightness_widget_server_is_notify_osd (void)
15
 
 static void
16
 
 xfpm_brightness_widget_display_notification (XfpmBrightnessWidget *widget)
17
 
 {
18
 
-    guint i;
19
 
+    guint brightness_icon_index;
20
 
     gfloat value = 0;
21
 
     
22
 
     static const char *display_icon_name[] = 
23
 
@@ -119,7 +119,10 @@ xfpm_brightness_widget_display_notification (XfpmBrightnessWidget *widget)
24
 
     
25
 
     value = (gfloat) 100 * widget->priv->level / widget->priv->max_level;
26
 
     
27
 
-    i = (gint)value / 25;
28
 
+    brightness_icon_index = (gint)value / 25;
29
 
+
30
 
+    g_return_if_fail (brightness_icon_index < 4);
31
 
+    g_return_if_fail (brightness_icon_index > 0);
32
 
     
33
 
     notify_notification_set_hint_int32 (widget->priv->n,
34
 
                                        "value",
35
 
@@ -132,7 +135,7 @@ xfpm_brightness_widget_display_notification (XfpmBrightnessWidget *widget)
36
 
     notify_notification_update (widget->priv->n,
37
 
                                " ",
38
 
                                "",
39
 
-                               display_icon_name[i]);
40
 
+                               display_icon_name[brightness_icon_index]);
41
 
                                
42
 
     notify_notification_show (widget->priv->n, NULL);
43
 
 }
44
 
--
45
 
cgit v0.8.2.1