1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
|
=== modified file 'src/music-player-bridge.vala'
--- old/src/music-player-bridge.vala 2012-03-30 18:08:19 +0000
+++ new/src/music-player-bridge.vala 2012-05-03 22:11:10 +0000
@@ -163,7 +163,6 @@
}
var mpris_key = determine_key ( desktop );
- // Are we sure clients will appear like this with the new registration method in place.
if ( this.registered_clients.has_key (mpris_key) == false ){
debug("New client has registered that we have not seen before: %s", dbus_name );
PlayerController ctrl = new PlayerController ( this.root_menu,
@@ -189,14 +188,14 @@
public void client_has_vanished ( string mpris_root_interface )
{
- debug("MusicPlayerBridge -> client with dbus interface %s has vanished",
+ debug("\n MusicPlayerBridge -> client with dbus interface %s has vanished",
mpris_root_interface );
if (root_menu != null){
- debug("attempt to remove %s", mpris_root_interface);
+ debug("\n attempt to remove %s", mpris_root_interface);
var mpris_key = determine_key ( mpris_root_interface );
if ( mpris_key != null && this.registered_clients.has_key(mpris_key)){
registered_clients[mpris_key].hibernate();
- debug("Successively offlined client %s", mpris_key);
+ debug("\n Successively offlined client %s", mpris_key);
}
}
}
@@ -279,15 +278,21 @@
*/
private static string? determine_key(owned string desktop_or_interface)
{
+ // handle the special case of amarok, (kde4-amarok desktop file name)
+ if (desktop_or_interface.contains("amarok")){
+ return "amarok";
+ }
+
var result = desktop_or_interface;
+
var tokens = desktop_or_interface.split( "." );
if (tokens != null && tokens.length > 1){
result = tokens[tokens.length - 1];
- }
+ }
var temp = result.split("-");
if (temp != null && temp.length > 1){
result = temp[0];
- }
+ }
return result;
}
=== modified file 'src/music-player-bridge.c'
--- old/src/music-player-bridge.c 2012-03-30 18:12:41 +0000
+++ new/src/music-player-bridge.c 2012-05-03 22:27:11 +0000
@@ -798,7 +798,7 @@
GAppInfo* _tmp43_;
const gchar* _tmp44_;
_tmp26_ = dbus_name;
- g_debug ("music-player-bridge.vala:168: New client has registered that we have n" \
+ g_debug ("music-player-bridge.vala:167: New client has registered that we have n" \
"ot seen before: %s", _tmp26_);
_tmp27_ = self->priv->root_menu;
_tmp28_ = app_info;
@@ -817,7 +817,7 @@
_tmp39_ = ctrl;
gee_abstract_map_set ((GeeAbstractMap*) _tmp37_, _tmp38_, _tmp39_);
_tmp40_ = desktop;
- g_debug ("music-player-bridge.vala:177: Have not seen this %s before, new contro" \
+ g_debug ("music-player-bridge.vala:176: Have not seen this %s before, new contro" \
"ller created.", _tmp40_);
_tmp41_ = self->priv->settings_manager;
_tmp42_ = desktop;
@@ -825,7 +825,7 @@
_tmp43_ = app_info;
_tmp44_ = mpris_key;
music_player_bridge_establish_file_monitoring (self, _tmp43_, _tmp44_);
- g_debug ("music-player-bridge.vala:180: application added to the interested list");
+ g_debug ("music-player-bridge.vala:179: application added to the interested list");
_g_object_unref0 (ctrl);
} else {
GeeHashMap* _tmp45_;
@@ -873,7 +873,7 @@
_tmp61_ = use_playlists;
_tmp62_ = bool_to_string (_tmp61_);
_tmp63_ = _tmp62_;
- g_debug ("music-player-bridge.vala:186: Application has already registered - awa" \
+ g_debug ("music-player-bridge.vala:185: Application has already registered - awa" \
"ken the hibernation: %s with playlists %s \n", _tmp60_, _tmp63_);
_g_free0 (_tmp63_);
}
@@ -888,8 +888,8 @@
g_return_if_fail (self != NULL);
g_return_if_fail (mpris_root_interface != NULL);
_tmp0_ = mpris_root_interface;
- g_debug ("music-player-bridge.vala:192: MusicPlayerBridge -> client with dbus in" \
-"terface %s has vanished", _tmp0_);
+ g_debug ("music-player-bridge.vala:191: \n" \
+" MusicPlayerBridge -> client with dbus interface %s has vanished", _tmp0_);
_tmp1_ = self->priv->root_menu;
if (_tmp1_ != NULL) {
const gchar* _tmp2_;
@@ -901,7 +901,7 @@
const gchar* _tmp7_;
gboolean _tmp11_;
_tmp2_ = mpris_root_interface;
- g_debug ("music-player-bridge.vala:195: attempt to remove %s", _tmp2_);
+ g_debug ("music-player-bridge.vala:194: \n attempt to remove %s", _tmp2_);
_tmp3_ = mpris_root_interface;
_tmp4_ = g_strdup (_tmp3_);
_tmp5_ = music_player_bridge_determine_key (_tmp4_);
@@ -932,7 +932,7 @@
player_controller_hibernate (_tmp15_);
_g_object_unref0 (_tmp15_);
_tmp16_ = mpris_key;
- g_debug ("music-player-bridge.vala:199: Successively offlined client %s", _tmp16_);
+ g_debug ("music-player-bridge.vala:198: \n Successively offlined client %s", _tmp16_);
}
_g_free0 (mpris_key);
}
@@ -998,7 +998,7 @@
if (_tmp5_ == FALSE) {
const gchar* _tmp6_;
_tmp6_ = desktop_id;
- g_warning ("music-player-bridge.vala:218: we don't have a client with desktop id %" \
+ g_warning ("music-player-bridge.vala:217: we don't have a client with desktop id %" \
"s registered", _tmp6_);
_g_free0 (mpris_key);
return;
@@ -1040,7 +1040,7 @@
if (_tmp5_ == FALSE) {
const gchar* _tmp6_;
_tmp6_ = desktop_id;
- g_warning ("music-player-bridge.vala:229: we don't have a client with desktop id %" \
+ g_warning ("music-player-bridge.vala:228: we don't have a client with desktop id %" \
"s registered", _tmp6_);
_g_free0 (mpris_key);
return;
@@ -1083,7 +1083,7 @@
if (_tmp5_) {
const gchar* _tmp6_;
_tmp6_ = desktop;
- g_warning ("music-player-bridge.vala:239: Could not create a desktopappinfo instan" \
+ g_warning ("music-player-bridge.vala:238: Could not create a desktopappinfo instan" \
"ce from app: %s", _tmp6_);
result = NULL;
_g_object_unref0 (info);
@@ -1147,7 +1147,7 @@
GError* _error_ = NULL;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:255: Error loading keyfile - FileError");
+ g_warning ("music-player-bridge.vala:254: Error loading keyfile - FileError");
result = NULL;
_g_error_free0 (_error_);
_g_key_file_free0 (desktop_keyfile);
@@ -1160,7 +1160,7 @@
GError* _error_ = NULL;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:259: Error loading keyfile - KeyFileError");
+ g_warning ("music-player-bridge.vala:258: Error loading keyfile - KeyFileError");
result = NULL;
_g_error_free0 (_error_);
_g_key_file_free0 (desktop_keyfile);
@@ -1203,7 +1203,7 @@
GError* _error_ = NULL;
_error_ = _inner_error_;
_inner_error_ = NULL;
- g_warning ("music-player-bridge.vala:268: Error trying to fetch the icon name from" \
+ g_warning ("music-player-bridge.vala:267: Error trying to fetch the icon name from" \
" the keyfile");
result = NULL;
_g_error_free0 (_error_);
@@ -1220,96 +1220,120 @@
}
+static gboolean string_contains (const gchar* self, const gchar* needle) {
+ gboolean result = FALSE;
+ const gchar* _tmp0_;
+ gchar* _tmp1_ = NULL;
+ g_return_val_if_fail (self != NULL, FALSE);
+ g_return_val_if_fail (needle != NULL, FALSE);
+ _tmp0_ = needle;
+ _tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
+ result = _tmp1_ != NULL;
+ return result;
+}
+
+
static gchar* music_player_bridge_determine_key (gchar* desktop_or_interface) {
gchar* result = NULL;
const gchar* _tmp0_;
- gchar* _tmp1_;
+ gboolean _tmp1_ = FALSE;
+ const gchar* _tmp3_;
+ gchar* _tmp4_;
gchar* _result_;
- const gchar* _tmp2_;
- gchar** _tmp3_;
- gchar** _tmp4_ = NULL;
+ const gchar* _tmp5_;
+ gchar** _tmp6_;
+ gchar** _tmp7_ = NULL;
gchar** tokens;
gint tokens_length1;
gint _tokens_size_;
- gboolean _tmp5_ = FALSE;
- gchar** _tmp6_;
- gint _tmp6__length1;
- gboolean _tmp8_;
- const gchar* _tmp13_;
- gchar** _tmp14_;
- gchar** _tmp15_ = NULL;
+ gboolean _tmp8_ = FALSE;
+ gchar** _tmp9_;
+ gint _tmp9__length1;
+ gboolean _tmp11_;
+ const gchar* _tmp16_;
+ gchar** _tmp17_;
+ gchar** _tmp18_ = NULL;
gchar** temp;
gint temp_length1;
gint _temp_size_;
- gboolean _tmp16_ = FALSE;
- gchar** _tmp17_;
- gint _tmp17__length1;
- gboolean _tmp19_;
+ gboolean _tmp19_ = FALSE;
+ gchar** _tmp20_;
+ gint _tmp20__length1;
+ gboolean _tmp22_;
g_return_val_if_fail (desktop_or_interface != NULL, NULL);
_tmp0_ = desktop_or_interface;
- _tmp1_ = g_strdup (_tmp0_);
- _result_ = _tmp1_;
- _tmp2_ = desktop_or_interface;
- _tmp4_ = _tmp3_ = g_strsplit (_tmp2_, ".", 0);
- tokens = _tmp4_;
- tokens_length1 = _vala_array_length (_tmp3_);
+ _tmp1_ = string_contains (_tmp0_, "amarok");
+ if (_tmp1_) {
+ gchar* _tmp2_;
+ _tmp2_ = g_strdup ("amarok");
+ result = _tmp2_;
+ _g_free0 (desktop_or_interface);
+ return result;
+ }
+ _tmp3_ = desktop_or_interface;
+ _tmp4_ = g_strdup (_tmp3_);
+ _result_ = _tmp4_;
+ _tmp5_ = desktop_or_interface;
+ _tmp7_ = _tmp6_ = g_strsplit (_tmp5_, ".", 0);
+ tokens = _tmp7_;
+ tokens_length1 = _vala_array_length (_tmp6_);
_tokens_size_ = tokens_length1;
- _tmp6_ = tokens;
- _tmp6__length1 = tokens_length1;
- if (_tmp6_ != NULL) {
- gchar** _tmp7_;
- gint _tmp7__length1;
- _tmp7_ = tokens;
- _tmp7__length1 = tokens_length1;
- _tmp5_ = _tmp7__length1 > 1;
- } else {
- _tmp5_ = FALSE;
- }
- _tmp8_ = _tmp5_;
- if (_tmp8_) {
- gchar** _tmp9_;
- gint _tmp9__length1;
+ _tmp9_ = tokens;
+ _tmp9__length1 = tokens_length1;
+ if (_tmp9_ != NULL) {
gchar** _tmp10_;
gint _tmp10__length1;
- const gchar* _tmp11_;
- gchar* _tmp12_;
- _tmp9_ = tokens;
- _tmp9__length1 = tokens_length1;
_tmp10_ = tokens;
_tmp10__length1 = tokens_length1;
- _tmp11_ = _tmp9_[_tmp10__length1 - 1];
- _tmp12_ = g_strdup (_tmp11_);
+ _tmp8_ = _tmp10__length1 > 1;
+ } else {
+ _tmp8_ = FALSE;
+ }
+ _tmp11_ = _tmp8_;
+ if (_tmp11_) {
+ gchar** _tmp12_;
+ gint _tmp12__length1;
+ gchar** _tmp13_;
+ gint _tmp13__length1;
+ const gchar* _tmp14_;
+ gchar* _tmp15_;
+ _tmp12_ = tokens;
+ _tmp12__length1 = tokens_length1;
+ _tmp13_ = tokens;
+ _tmp13__length1 = tokens_length1;
+ _tmp14_ = _tmp12_[_tmp13__length1 - 1];
+ _tmp15_ = g_strdup (_tmp14_);
_g_free0 (_result_);
- _result_ = _tmp12_;
+ _result_ = _tmp15_;
}
- _tmp13_ = _result_;
- _tmp15_ = _tmp14_ = g_strsplit (_tmp13_, "-", 0);
- temp = _tmp15_;
- temp_length1 = _vala_array_length (_tmp14_);
+ _tmp16_ = _result_;
+ _tmp18_ = _tmp17_ = g_strsplit (_tmp16_, "-", 0);
+ temp = _tmp18_;
+ temp_length1 = _vala_array_length (_tmp17_);
_temp_size_ = temp_length1;
- _tmp17_ = temp;
- _tmp17__length1 = temp_length1;
- if (_tmp17_ != NULL) {
- gchar** _tmp18_;
- gint _tmp18__length1;
- _tmp18_ = temp;
- _tmp18__length1 = temp_length1;
- _tmp16_ = _tmp18__length1 > 1;
+ _tmp20_ = temp;
+ _tmp20__length1 = temp_length1;
+ if (_tmp20_ != NULL) {
+ gchar** _tmp21_;
+ gint _tmp21__length1;
+ _tmp21_ = temp;
+ _tmp21__length1 = temp_length1;
+ _tmp19_ = _tmp21__length1 > 1;
} else {
- _tmp16_ = FALSE;
+ _tmp19_ = FALSE;
}
- _tmp19_ = _tmp16_;
- if (_tmp19_) {
- gchar** _tmp20_;
- gint _tmp20__length1;
- const gchar* _tmp21_;
- gchar* _tmp22_;
- _tmp20_ = temp;
- _tmp20__length1 = temp_length1;
- _tmp21_ = _tmp20_[0];
- _tmp22_ = g_strdup (_tmp21_);
+ _tmp22_ = _tmp19_;
+ if (_tmp22_) {
+ gchar** _tmp23_;
+ gint _tmp23__length1;
+ const gchar* _tmp24_;
+ gchar* _tmp25_;
+ _tmp23_ = temp;
+ _tmp23__length1 = temp_length1;
+ _tmp24_ = _tmp23_[0];
+ _tmp25_ = g_strdup (_tmp24_);
_g_free0 (_result_);
- _result_ = _tmp22_;
+ _result_ = _tmp25_;
}
result = _result_;
temp = (_vala_array_free (temp, temp_length1, (GDestroyNotify) g_free), NULL);
|