Merge lp:~3v1n0/indicator-sound/launch-context into lp:indicator-sound/13.04

Proposed by Marco Trevisan (Treviño) on 2013-04-03
Status: Merged
Approved by: Mathieu Trudel-Lapierre on 2013-04-04
Approved revision: 345
Merged at revision: 345
Proposed branch: lp:~3v1n0/indicator-sound/launch-context
Merge into: lp:indicator-sound/13.04
Diff against target: 105 lines (+18/-8)
6 files modified
src/Makefile.am (+1/-0)
src/metadata-menu-item.vala (+6/-3)
src/mpris2-controller.vala (+1/-1)
src/player-controller.vala (+5/-2)
src/sound-service.c (+1/-1)
src/transport-menu-item.vala (+4/-1)
To merge this branch: bzr merge lp:~3v1n0/indicator-sound/launch-context
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration 2013-04-03 Approve on 2013-04-04
Mathieu Trudel-Lapierre 2013-04-03 Approve on 2013-04-04
Review via email: mp+156918@code.launchpad.net

Commit message

MenuItem: use GtkLaunchContext with proper event timeout to launch applications

Also discards non-activation events

Description of the change

Like all the launcher applications, also indicator-sound should properly use the GAppLaunchContext when launching an application. Changed the code to use the event timestamp of the click action with the GtkAppLaunchContext.

This will allow to make indicator-sound to work nicely with the compiz focus prevention mechanism.

In handle_event calls we also need to ignore the non-activation events.

To post a comment you must log in.
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Mathieu Trudel-Lapierre (cyphermox) wrote :

Looks fine, approved.

review: Approve
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Makefile.am'
2--- src/Makefile.am 2012-07-12 20:07:48 +0000
3+++ src/Makefile.am 2013-04-03 17:19:31 +0000
4@@ -81,6 +81,7 @@
5 --pkg config \
6 --pkg gio-2.0 \
7 --pkg gio-unix-2.0 \
8+ --pkg gdk-3.0 \
9 --pkg gdk-pixbuf-2.0 \
10 --pkg libxml-2.0
11
12
13=== modified file 'src/metadata-menu-item.vala'
14--- src/metadata-menu-item.vala 2012-03-16 17:30:21 +0000
15+++ src/metadata-menu-item.vala 2013-04-03 17:19:31 +0000
16@@ -168,13 +168,16 @@
17 public override void handle_event (string name,
18 Variant input_value,
19 uint timestamp)
20- {
21+ {
22+ if (name != Dbusmenu.MENUITEM_EVENT_ACTIVATED)
23+ return;
24+
25 if(this.owner.current_state == PlayerController.state.OFFLINE)
26 {
27- this.owner.instantiate();
28+ this.owner.instantiate(timestamp);
29 }
30 else if(this.owner.current_state == PlayerController.state.CONNECTED){
31- this.owner.mpris_bridge.expose();
32+ this.owner.mpris_bridge.expose(timestamp);
33 }
34 }
35
36
37=== modified file 'src/mpris2-controller.vala'
38--- src/mpris2-controller.vala 2012-03-21 09:47:53 +0000
39+++ src/mpris2-controller.vala 2013-04-03 17:19:31 +0000
40@@ -208,7 +208,7 @@
41 return (this.player != null && this.mpris2_root != null);
42 }
43
44- public void expose()
45+ public void expose(uint timestamp)
46 {
47 if(this.connected() == true){
48 this.mpris2_root.Raise.begin();
49
50=== modified file 'src/player-controller.vala'
51--- src/player-controller.vala 2012-06-21 16:45:16 +0000
52+++ src/player-controller.vala 2013-04-03 17:19:31 +0000
53@@ -98,11 +98,14 @@
54 There is a need to wait before the application is on DBus before attempting to access its mpris address
55 Hence only when the it has registered with us via libindicate do we attempt to kick off mpris communication
56 */
57- public void instantiate()
58+ public void instantiate(uint timestamp)
59 {
60 debug("instantiate in player controller for %s", this.app_info.get_name() );
61+
62 try{
63- this.app_info.launch(null, null);
64+ var context = Gdk.Display.get_default().get_app_launch_context();
65+ context.set_timestamp(timestamp);
66+ this.app_info.launch(null, context);
67 this.update_state(state.INSTANTIATING);
68 }
69 catch(GLib.Error error){
70
71=== modified file 'src/sound-service.c'
72--- src/sound-service.c 2011-08-10 12:51:49 +0000
73+++ src/sound-service.c 2013-04-03 17:19:31 +0000
74@@ -88,7 +88,7 @@
75 {
76 gboolean greeter_mode;
77
78- g_type_init();
79+ gdk_init(&argc, &argv);
80 textdomain (GETTEXT_PACKAGE);
81 bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
82 setlocale (LC_ALL, "");
83
84=== modified file 'src/transport-menu-item.vala'
85--- src/transport-menu-item.vala 2012-03-16 17:30:21 +0000
86+++ src/transport-menu-item.vala 2013-04-03 17:19:31 +0000
87@@ -70,6 +70,9 @@
88 Variant input_value,
89 uint timestamp)
90 {
91+ if (name != Dbusmenu.MENUITEM_EVENT_ACTIVATED)
92+ return;
93+
94 Variant v = input_value;
95 if ( input_value.is_of_type (VariantType.VARIANT)){
96 v = input_value.get_variant();
97@@ -82,7 +85,7 @@
98 }
99 else{
100 this.cached_action = (Transport.Action)input;
101- this.owner.instantiate();
102+ this.owner.instantiate(timestamp);
103 this.property_set_int (MENUITEM_PLAY_STATE, (int)Transport.State.LAUNCHING);
104 }
105 }

Subscribers

People subscribed via source and target branches