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
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2012-07-12 20:07:48 +0000
+++ src/Makefile.am 2013-04-03 17:19:31 +0000
@@ -81,6 +81,7 @@
81 --pkg config \81 --pkg config \
82 --pkg gio-2.0 \82 --pkg gio-2.0 \
83 --pkg gio-unix-2.0 \83 --pkg gio-unix-2.0 \
84 --pkg gdk-3.0 \
84 --pkg gdk-pixbuf-2.0 \85 --pkg gdk-pixbuf-2.0 \
85 --pkg libxml-2.086 --pkg libxml-2.0
8687
8788
=== modified file 'src/metadata-menu-item.vala'
--- src/metadata-menu-item.vala 2012-03-16 17:30:21 +0000
+++ src/metadata-menu-item.vala 2013-04-03 17:19:31 +0000
@@ -168,13 +168,16 @@
168 public override void handle_event (string name,168 public override void handle_event (string name,
169 Variant input_value,169 Variant input_value,
170 uint timestamp)170 uint timestamp)
171 { 171 {
172 if (name != Dbusmenu.MENUITEM_EVENT_ACTIVATED)
173 return;
174
172 if(this.owner.current_state == PlayerController.state.OFFLINE)175 if(this.owner.current_state == PlayerController.state.OFFLINE)
173 {176 {
174 this.owner.instantiate();177 this.owner.instantiate(timestamp);
175 }178 }
176 else if(this.owner.current_state == PlayerController.state.CONNECTED){179 else if(this.owner.current_state == PlayerController.state.CONNECTED){
177 this.owner.mpris_bridge.expose();180 this.owner.mpris_bridge.expose(timestamp);
178 }181 }
179 }182 }
180 183
181184
=== modified file 'src/mpris2-controller.vala'
--- src/mpris2-controller.vala 2012-03-21 09:47:53 +0000
+++ src/mpris2-controller.vala 2013-04-03 17:19:31 +0000
@@ -208,7 +208,7 @@
208 return (this.player != null && this.mpris2_root != null);208 return (this.player != null && this.mpris2_root != null);
209 }209 }
210210
211 public void expose()211 public void expose(uint timestamp)
212 {212 {
213 if(this.connected() == true){213 if(this.connected() == true){
214 this.mpris2_root.Raise.begin();214 this.mpris2_root.Raise.begin();
215215
=== modified file 'src/player-controller.vala'
--- src/player-controller.vala 2012-06-21 16:45:16 +0000
+++ src/player-controller.vala 2013-04-03 17:19:31 +0000
@@ -98,11 +98,14 @@
98 There is a need to wait before the application is on DBus before attempting to access its mpris address98 There is a need to wait before the application is on DBus before attempting to access its mpris address
99 Hence only when the it has registered with us via libindicate do we attempt to kick off mpris communication99 Hence only when the it has registered with us via libindicate do we attempt to kick off mpris communication
100 */100 */
101 public void instantiate()101 public void instantiate(uint timestamp)
102 {102 {
103 debug("instantiate in player controller for %s", this.app_info.get_name() );103 debug("instantiate in player controller for %s", this.app_info.get_name() );
104
104 try{105 try{
105 this.app_info.launch(null, null);106 var context = Gdk.Display.get_default().get_app_launch_context();
107 context.set_timestamp(timestamp);
108 this.app_info.launch(null, context);
106 this.update_state(state.INSTANTIATING);109 this.update_state(state.INSTANTIATING);
107 }110 }
108 catch(GLib.Error error){111 catch(GLib.Error error){
109112
=== modified file 'src/sound-service.c'
--- src/sound-service.c 2011-08-10 12:51:49 +0000
+++ src/sound-service.c 2013-04-03 17:19:31 +0000
@@ -88,7 +88,7 @@
88{88{
89 gboolean greeter_mode;89 gboolean greeter_mode;
90 90
91 g_type_init();91 gdk_init(&argc, &argv);
92 textdomain (GETTEXT_PACKAGE);92 textdomain (GETTEXT_PACKAGE);
93 bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);93 bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
94 setlocale (LC_ALL, "");94 setlocale (LC_ALL, "");
9595
=== modified file 'src/transport-menu-item.vala'
--- src/transport-menu-item.vala 2012-03-16 17:30:21 +0000
+++ src/transport-menu-item.vala 2013-04-03 17:19:31 +0000
@@ -70,6 +70,9 @@
70 Variant input_value,70 Variant input_value,
71 uint timestamp)71 uint timestamp)
72 {72 {
73 if (name != Dbusmenu.MENUITEM_EVENT_ACTIVATED)
74 return;
75
73 Variant v = input_value;76 Variant v = input_value;
74 if ( input_value.is_of_type (VariantType.VARIANT)){77 if ( input_value.is_of_type (VariantType.VARIANT)){
75 v = input_value.get_variant();78 v = input_value.get_variant();
@@ -82,7 +85,7 @@
82 }85 }
83 else{86 else{
84 this.cached_action = (Transport.Action)input;87 this.cached_action = (Transport.Action)input;
85 this.owner.instantiate();88 this.owner.instantiate(timestamp);
86 this.property_set_int (MENUITEM_PLAY_STATE, (int)Transport.State.LAUNCHING);89 this.property_set_int (MENUITEM_PLAY_STATE, (int)Transport.State.LAUNCHING);
87 }90 }
88 } 91 }

Subscribers

People subscribed via source and target branches