Merge lp:~ochosi/indicator-power/xfce4-powermanager-settings into lp:indicator-power/14.04

Proposed by Simon Steinbeiß
Status: Merged
Merged at revision: 222
Proposed branch: lp:~ochosi/indicator-power/xfce4-powermanager-settings
Merge into: lp:indicator-power/14.04
Diff against target: 25 lines (+10/-6)
1 file modified
src/service.c (+10/-6)
To merge this branch: bzr merge lp:~ochosi/indicator-power/xfce4-powermanager-settings
Reviewer Review Type Date Requested Status
Sebastien Bacher Needs Fixing
Lars Karlitski Pending
Review via email: mp+202514@code.launchpad.net

Description of the change

This tiny patch (along the lines of indicator-sound: http://bazaar.launchpad.net/~indicator-applet-developers/indicator-sound/trunk.14.04/view/head:/src/service.vala#L120) adds support for opening xfce4-powermanager-settings if indicator-power is in a Xubuntu session. It will also make it easier to add other desktops, e.g. if ubuntu-studio decide they want to use it as well.

This would be very useful, as we (Xubuntu team) plan to use indicator-power by default in 14.04.

(Rebased version of the patch on top of Robert's u-c-c branch that just got merged.)

To post a comment you must log in.
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thanks for the work there, that seems slightly buggy though, in the case where the session is not Unity you do

" gchar *path
...
 g_free (path);"

that's likely to lead to invalid frees since you don't init path to NULL

review: Needs Fixing
Revision history for this message
Lars Karlitski (larsu) wrote :

Thanks for the patch. I've fixed the free() and rearranged the logic a bit to have a proper fallback on non-unity sessions at lp:~larsu/indicator-power/xfce-control-center

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/service.c'
2--- src/service.c 2014-01-10 02:02:31 +0000
3+++ src/service.c 2014-01-21 17:44:49 +0000
4@@ -693,12 +693,16 @@
5 gpointer gself G_GNUC_UNUSED)
6 {
7 gchar *path;
8-
9- path = g_find_program_in_path ("unity-control-center");
10- if (path != NULL)
11- execute_command ("unity-control-center power");
12- else
13- execute_command ("gnome-control-center power");
14+ if (!g_strcmp0 (g_getenv ("XDG_CURRENT_DESKTOP"), "Unity"))
15+ {
16+ path = g_find_program_in_path ("unity-control-center");
17+ if (path != NULL)
18+ execute_command ("unity-control-center power");
19+ else
20+ execute_command ("gnome-control-center power");
21+ }
22+ else if (!g_strcmp0 (g_getenv ("DESKTOP_SESSION"), "xubuntu"))
23+ execute_command ("xfce4-power-manager-settings");
24 g_free (path);
25 }
26

Subscribers

People subscribed via source and target branches