Patchwork matchbox-panel: silence some pointless warnings

login
register
mail settings
Submitter Ross Burton
Date Sept. 26, 2013, 4:06 p.m.
Message ID <1380211596-18381-1-git-send-email-ross.burton@intel.com>
Download mbox | patch
Permalink /patch/59041/
State Accepted
Commit 4e2b86787ed7a44ad88aa1431207d049c2cb444a
Headers show

Comments

Ross Burton - Sept. 26, 2013, 4:06 p.m.
The battery applet emits a warning if the hardware doesn't have a battery (it
shouldn't) and the parser emits a warning if two separators are used in a row
(which happens if the hardware has a keyboard).  Silence these with a patch from
upstream.

[ YOCTO #4061 ]

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 .../matchbox-panel-2/files/silence-warnings.patch  |   64 ++++++++++++++++++++
 .../matchbox-panel-2/matchbox-panel-2_git.bb       |    3 +-
 2 files changed, 66 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-sato/matchbox-panel-2/files/silence-warnings.patch

Patch

diff --git a/meta/recipes-sato/matchbox-panel-2/files/silence-warnings.patch b/meta/recipes-sato/matchbox-panel-2/files/silence-warnings.patch
new file mode 100644
index 0000000..45ba9a0
--- /dev/null
+++ b/meta/recipes-sato/matchbox-panel-2/files/silence-warnings.patch
@@ -0,0 +1,64 @@ 
+Don't warn if the machine doesn't actually have a battery, or if the applets
+string contains consecutive separators.
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@intel.com>
+
+diff --git a/applets/battery/battery-acpi.c b/applets/battery/battery-acpi.c
+index 6515cb0..c44dd12 100644
+--- a/applets/battery/battery-acpi.c
++++ b/applets/battery/battery-acpi.c
+@@ -14,8 +14,6 @@ int batt_state, ac_state;
+ int pm_support(void)
+ {
+ 	if(check_acpi_support() == NOT_SUPPORTED){
+-		g_warning("No ACPI support\n");
+-
+ 		return 0;
+ 	}
+ 
+@@ -32,8 +30,9 @@ const char* pm_battery_icon(void)
+ 	const char *icon;
+ 	battery_t *binfo;
+ 
++        /* No battery available (not present, disabled, or something
++           else. Silently do nothing. */
+ 	if (batt_state != SUCCESS) {
+-		g_warning("Couldnt initialize ACPI battery\n");
+ 		return NULL;
+ 	}
+ 
+diff --git a/applets/battery/battery-apm.c b/applets/battery/battery-apm.c
+index 5467438..2f39cb6 100644
+--- a/applets/battery/battery-apm.c
++++ b/applets/battery/battery-apm.c
+@@ -10,8 +10,6 @@
+ int pm_support(void)
+ {
+ 	if (1 == apm_exists ()) {
+-                g_warning ("No APM support");
+-
+                 return 0;
+         }
+ 
+diff --git a/matchbox-panel/mb-panel.c b/matchbox-panel/mb-panel.c
+index 2d8cafd..828a36d 100644
+--- a/matchbox-panel/mb-panel.c
++++ b/matchbox-panel/mb-panel.c
+@@ -110,10 +110,15 @@ load_applets (const char    *applets_desc,
+         applets = g_strsplit (applets_desc, ",", -1);
+ 
+         for (i = 0; applets[i]; i++) {
++                char *s;
+                 char **bits;
+                 GtkWidget *applet;
+ 
+-                bits = g_strsplit (applets[i], ":", 2);
++                s = applets[i];
++                if (s == NULL || s[0] == '\0')
++                        continue;
++
++                bits = g_strsplit (s, ":", 2);
+ 
+                 applet = load_applet (bits[0],
+                                       bits[1],
diff --git a/meta/recipes-sato/matchbox-panel-2/matchbox-panel-2_git.bb b/meta/recipes-sato/matchbox-panel-2/matchbox-panel-2_git.bb
index 1e2a7ae..eff20f0 100644
--- a/meta/recipes-sato/matchbox-panel-2/matchbox-panel-2_git.bb
+++ b/meta/recipes-sato/matchbox-panel-2/matchbox-panel-2_git.bb
@@ -19,7 +19,8 @@  RPROVIDES_${PN} = "matchbox-panel"
 RREPLACES_${PN} = "matchbox-panel"
 RCONFLICTS_${PN} = "matchbox-panel"
 
-SRC_URI = "git://git.yoctoproject.org/${BPN}"
+SRC_URI = "git://git.yoctoproject.org/${BPN} \
+           file://silence-warnings.patch"
 
 EXTRA_OECONF = "--enable-startup-notification --enable-dbus"
 EXTRA_OECONF += " ${@base_contains("MACHINE_FEATURES", "acpi", "--with-battery=acpi", "",d)}"