actions.c 13.9 KB
Newer Older
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
1
2
/*
 *  Copyright (C) 2007 Savoir-Faire Linux inc.
3
 *  Author: Pierre-Luc Beaudoin <pierre-luc@squidy.info>
4
 *  Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
5
6
7
 *                                                                              
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
8
 *  the Free Software Foundation; either version 3 of the License, or
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
9
10
11
12
13
14
15
16
17
18
19
 *  (at your option) any later version.
 *                                                                                
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *                                                                              
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
20

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
21
#include <actions.h>
22
23
#include <calltree.h>
#include <dbus.h>
24
#include <mainwindow.h>
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
25
#include <menus.h>
26
27
#include <screen.h>
#include <statusicon.h>
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
28

29
30
31
32
#include <gtk/gtk.h>
#include <string.h>
#include <glib/gprintf.h>
#include <stdlib.h>
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
33
34
35
#include <sys/types.h>
#include <unistd.h>

36
#define ALSA_ERROR  0
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
37

38
	void
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
39
40
sflphone_notify_voice_mail (guint count)
{
41
42
43
	if(count > 0)
	{
		gchar * message = g_new0(gchar, 50);
44
45
46
47
		if( count > 1)
		  g_sprintf(message, _("%d new voice mails"), count);
		else
		  g_sprintf(message, _("%d new voice mail"), count);	  
48
49
50
51
52
53
54
		status_bar_message(message);
		g_free(message);
	}
	else
	{
		status_bar_message("");
	}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
55
56
}

57
	gboolean
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
58
59
sflphone_quit ()
{
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
	gboolean quit = FALSE;
	guint count = call_list_get_size();
	if(count > 0){
		quit = main_window_ask_quit();
	}
	else{
		quit = TRUE;
	}

	if (quit)
	{
		dbus_unregister(getpid());
		dbus_clean ();
		//call_list_clean(); TODO
		//account_list_clean()
		gtk_main_quit ();
	}
	return quit;
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
78
79
}

80
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
81
82
sflphone_hold(call_t * c )
{
83
84
85
	c->state = CALL_STATE_HOLD;
	update_call_tree(c);
	update_menus();
86
	//screen_clear();
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
87
88
}

89
	void 
90
91
sflphone_ringing(call_t * c )
{
92
93
94
	c->state = CALL_STATE_RINGING;
	update_call_tree(c);
	update_menus();
95
}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
96

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
97
/** Internal to actions: Fill account list */
98
	void
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
99
100
sflphone_fill_account_list()
{
101
102
103
104
105
	account_list_clear ( );

	gchar ** array = (gchar **)dbus_account_list();
	gchar ** accountID;
	for (accountID = array; *accountID; accountID++)
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
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
		account_t * a = g_new0(account_t,1);
		a->accountID = g_strdup(*accountID);
		account_list_add(a);
	}
	g_strfreev (array);

	int i;
	for( i = 0; i < account_list_get_size(); i++)
	{
		account_t  * a = account_list_get_nth (i);
		GHashTable * details = (GHashTable *) dbus_account_details(a->accountID);
		a->properties = details;

		gchar * status = g_hash_table_lookup(details, "Status");
		if(strcmp(status, "REGISTERED") == 0)
		{
			a->state = ACCOUNT_STATE_REGISTERED;
		}
		else if(strcmp(status, "UNREGISTERED") == 0)
		{
			a->state = ACCOUNT_STATE_UNREGISTERED;
		}
		else if(strcmp(status, "TRYING") == 0)
		{
			a->state = ACCOUNT_STATE_TRYING;
		}
		else if(strcmp(status, "ERROR") == 0)
		{
			a->state = ACCOUNT_STATE_ERROR;
		}
		else
		{
			a->state = ACCOUNT_STATE_INVALID;
		}

	}

144
	toolbar_update_buttons();
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
145
146
}

147
	gboolean
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
148
149
sflphone_init()
{
150
151
	call_list_init ();
	account_list_init ();
152
        codec_list_init();
153
154
155
156
157
158
159
160
161
162
	if(!dbus_connect ())
	{
		main_window_error_message("Unable to connect to the SFLphone server.\nMake sure the daemon is running.");
		return FALSE;
	}
	else 
	{
		dbus_register(getpid(), "Gtk+ Client");
		sflphone_fill_account_list();
		sflphone_set_default_account();
163
		sflphone_fill_codec_list();
164
165
		return TRUE;
	}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
166
167
}

168
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
169
sflphone_hang_up()
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
170
{
171
	call_t * selectedCall = call_get_selected();
Emmanuel Milou's avatar
Emmanuel Milou committed
172
	//main_window_callinfo(FALSE, selectedCall);
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
	if(selectedCall)
	{
		switch(selectedCall->state)
		{
			case CALL_STATE_CURRENT:
			case CALL_STATE_HOLD:
			case CALL_STATE_DIALING:
			case CALL_STATE_RINGING:
			case CALL_STATE_BUSY:
			case CALL_STATE_FAILURE:
				dbus_hang_up (selectedCall);
				break;
			case CALL_STATE_INCOMING:  
				dbus_refuse (selectedCall);
				break;
			case CALL_STATE_TRANSFERT:  
				dbus_hang_up (selectedCall);
				break;
			default:
				g_warning("Should not happen in sflphone_hang_up()!");
				break;
		}
	}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
196
197
198
}


199
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
200
201
sflphone_pick_up()
{
202
	call_t * selectedCall = call_get_selected();
203
        //printf("full name: %s\n",g_hash_table_lookup(selectedCall->properties, ACCOUNT_IAX_FULL_NAME));
Emmanuel Milou's avatar
Emmanuel Milou committed
204
	//main_window_callinfo(TRUE, selectedCall);
205
206
207
208
209
210
	if(selectedCall)
	{
		switch(selectedCall->state)
		{
			case CALL_STATE_DIALING:
				sflphone_place_call (selectedCall);
Emmanuel Milou's avatar
Emmanuel Milou committed
211
        			//printf("accountID=%s\n",selectedCall->accountID);
212
213
				break;
			case CALL_STATE_INCOMING:
Emmanuel Milou's avatar
Emmanuel Milou committed
214
				//printf("CALL ID = %s\n", selectedCall->callID);
215
216
217
				dbus_accept (selectedCall);
				break;
			case CALL_STATE_HOLD:
218
				sflphone_new_call();
219
220
221
222
				break;
			case CALL_STATE_TRANSFERT:
				dbus_transfert (selectedCall);
				break;
223
224
225
			case CALL_STATE_CURRENT:
				sflphone_new_call();
				break;
226
227
228
			case CALL_STATE_RINGING:
				sflphone_new_call();
				break;
229
230
231
232
233
			default:
				g_warning("Should not happen in sflphone_pick_up()!");
				break;
		}
	}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
234
235
}

236
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
237
238
sflphone_on_hold ()
{
239
240
241
242
243
244
245
246
247
248
249
250
251
	call_t * selectedCall = call_get_selected();
	if(selectedCall)
	{
		switch(selectedCall->state)
		{
			case CALL_STATE_CURRENT:
				dbus_hold (selectedCall);
				break;
			default:
				g_warning("Should not happen in sflphone_on_hold!");
				break;
		}
	}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
252
253
}

254
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
255
256
sflphone_off_hold ()
{
257
258
259
260
261
262
263
264
265
266
267
268
269
	call_t * selectedCall = call_get_selected();
	if(selectedCall)
	{
		switch(selectedCall->state)
		{
			case CALL_STATE_HOLD:
				dbus_unhold (selectedCall);
				break;
			default:
				g_warning("Should not happen in sflphone_off_hold ()!");
				break;
		}
	}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
270
271
272
}


273
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
274
275
sflphone_fail( call_t * c )
{
276
277
278
	c->state = CALL_STATE_FAILURE;
	update_call_tree(c);
	update_menus();
Emmanuel Milou's avatar
Emmanuel Milou committed
279
	//main_window_callinfo(FALSE, c);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
280
281
}

282
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
283
284
sflphone_busy( call_t * c )
{
285
286
287
	c->state = CALL_STATE_BUSY;
	update_call_tree(c);
	update_menus();
288
	//screen_set_call(c);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
289
290
}

291
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
292
293
sflphone_current( call_t * c )
{
294
295
296
	c->state = CALL_STATE_CURRENT;
	update_call_tree(c);
	update_menus();
297
	//screen_set_call(c);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
298
299
}

300
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
301
sflphone_set_transfert()
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
302
{
303
304
305
306
307
	call_t * c = call_get_selected();
	if(c)
	{
		c->state = CALL_STATE_TRANSFERT;
		c->to = g_strdup("");
308
		//screen_set_call(c);
309
310
311
312
		update_call_tree(c);
		update_menus();
	}
	toolbar_update_buttons();
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
313
314
}

315
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
316
317
sflphone_unset_transfert()
{
318
319
320
321
322
	call_t * c = call_get_selected();
	if(c)
	{
		c->state = CALL_STATE_CURRENT;
		c->to = g_strdup("");
323
		//screen_set_call(c);
324
325
326
327
		update_call_tree(c);
		update_menus();
	}
	toolbar_update_buttons();
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
328
}
329
	void
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
330
331
sflphone_incoming_call (call_t * c) 
{
332
333
334
335
	call_list_add ( c );
	status_icon_unminimize();
	update_call_tree_add(c);
	update_menus();
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
336
}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
337

338
	void 
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
339
340
sflphone_hung_up (call_t * c )
{
341
342
343
	call_list_remove(c->callID);
	update_call_tree_remove(c);
	update_menus();
Emmanuel Milou's avatar
Emmanuel Milou committed
344
	//main_window_callinfo(FALSE, c);
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
345
346
}

347
void process_dialing(call_t * c, guint keyval, gchar * key)
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
348
{
349
350
351
352
353
354
355
356
357
358
359
360
	switch (keyval)
	{
		case 65293: /* ENTER */
		case 65421: /* ENTER numpad */
			sflphone_place_call(c);
			break;
		case 65307: /* ESCAPE */
			dbus_hang_up(c);
			break;
		case 65288: /* BACKSPACE */
			{  /* Brackets mandatory because of local vars */
				gchar * before = c->to;
361
				if(strlen(c->to) >= 1){
362
363
364
365
366
367
368
369
370
					c->to = g_strndup(c->to, strlen(c->to) -1);
					g_free(before);
					g_print("TO: %s\n", c->to);

					if(c->state == CALL_STATE_DIALING)
					{
						g_free(c->from);
						c->from = g_strconcat("\"\" <", c->to, ">", NULL);
					}
371
					//screen_set_call(c);
372
373
					update_call_tree(c);
				} 
374
				else if(strlen(c->to) == 0)
375
				{
376
				  if(c->state != CALL_STATE_TRANSFERT)
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
					dbus_hang_up(c);
				}
			}
			break;
		case 65289: /* TAB */
		case 65513: /* ALT */
		case 65507: /* CTRL */
		case 65515: /* SUPER */
		case 65509: /* CAPS */
			break;
		default:
			if (keyval < 255 || (keyval >65453 && keyval < 65466))
			{ 
				gchar * before = c->to;
				c->to = g_strconcat(c->to, key, NULL);
				g_free(before);
				g_print("TO: %s\n", c->to);

				if(c->state == CALL_STATE_DIALING)
				{
					g_free(c->from);
					c->from = g_strconcat("\"\" <", c->to, ">", NULL);
				}
400
				//screen_set_call(c);
401
402
403
404
405
				update_call_tree(c);
			}
			break;
	}

406
407
}

Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
408
409
410

call_t * sflphone_new_call()
{
411
412
413
414
415
416
417
418
419
420
	call_t * c = g_new0 (call_t, 1);
	c->state = CALL_STATE_DIALING;
	c->from = g_strconcat("\"\" <>", NULL);

	c->callID = g_new0(gchar, 30);
	g_sprintf(c->callID, "%d", rand()); 

	c->to = g_strdup("");

	call_list_add(c);
421
	//screen_set_call(c);
422
423
424
425
	update_call_tree_add(c);  
	update_menus();

	return c;
426
427
}

428
	void 
429
430
sflphone_keypad( guint keyval, gchar * key)
{
Emmanuel Milou's avatar
Emmanuel Milou committed
431
	dbus_play_dtmf(key);
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
	call_t * c = call_get_selected();
	if(c)
	{

		switch(c->state) 
		{
			case CALL_STATE_DIALING: // Currently dialing => edit number
				process_dialing(c, keyval, key);
				break;
			case CALL_STATE_CURRENT:
				switch (keyval)
				{
					case 65307: /* ESCAPE */
						dbus_hang_up(c);
						break;
					default:  // TODO should this be here?
						dbus_play_dtmf(key);
						if (keyval < 255 || (keyval >65453 && keyval < 65466))
						{ 
							gchar * temp = g_strconcat(call_get_number(c), key, NULL);
							gchar * before = c->from;
							c->from = g_strconcat("\"",call_get_name(c) ,"\" <", temp, ">", NULL);
							g_free(before);
							g_free(temp);
456
							//screen_set_call(c);
Emmanuel Milou's avatar
Emmanuel Milou committed
457
							//update_call_tree(c);
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
						}
						break;
				}
				break;
			case CALL_STATE_INCOMING:
				switch (keyval)
				{
					case 65293: /* ENTER */
					case 65421: /* ENTER numpad */
						dbus_accept(c);
						break;
					case 65307: /* ESCAPE */
						dbus_refuse(c);
						break;
				}
				break;
			case CALL_STATE_TRANSFERT:
				switch (keyval)
				{
					case 65293: /* ENTER */
					case 65421: /* ENTER numpad */
						dbus_transfert(c);
						break;
					case 65307: /* ESCAPE */
						sflphone_hang_up(c); 
						break;
					default: // When a call is on transfert, typing new numbers will add it to c->to
						process_dialing(c, keyval, key);
						break;
				}
				break;
			case CALL_STATE_HOLD:
				switch (keyval)
				{
					case 65293: /* ENTER */
					case 65421: /* ENTER numpad */
						dbus_unhold(c);
						break;
					case 65307: /* ESCAPE */
						dbus_hang_up(c);
						break;
					default: // When a call is on hold, typing new numbers will create a new call
						process_dialing(sflphone_new_call(), keyval, key);
						break;
				}
				break;
			case CALL_STATE_RINGING:
			case CALL_STATE_BUSY:
			case CALL_STATE_FAILURE:
				switch (keyval)
				{
					case 65307: /* ESCAPE */
Emmanuel Milou's avatar
Emmanuel Milou committed
510
511
						//dbus_hang_up(c);
						sflphone_hang_up(c);
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
						break;
				}
				break;
			default:
				break;
		} 
	}
	else 
	{ // Not in a call, not dialing, create a new call 
		switch (keyval)
		{
			case 65293: /* ENTER */
			case 65421: /* ENTER numpad */
			case 65307: /* ESCAPE */
				break;
			default:
				process_dialing(sflphone_new_call(), keyval, key);
				break;
		}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
531

532

533
534
535
536
537
538
539
540
541
	}
} 

/*
 * Place a call with the default account.
 * If there is no default account selected, place a call with the first 
 * registered account of the account list
 * Else, popup an error message
 */
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
542
543
544
void 
sflphone_place_call ( call_t * c )
{
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
	if(c->state == CALL_STATE_DIALING)
	{
		account_t * account;
		gchar * default_account =  account_list_get_default();
		account = account_list_get_by_id(default_account);
		
		if(account)
		{
			if(strcmp(g_hash_table_lookup(account->properties, "Status"),"REGISTERED")==0)
			{
				c->accountID = default_account;
				dbus_place_call(c);
			}
			else
			{
				main_window_error_message("The account selected as default is not registered.");
			}
			
		}
		else{
			account = account_list_get_by_state (ACCOUNT_STATE_REGISTERED);
			if(account)
			{
				c->accountID = account->accountID;
				dbus_place_call(c);
			}
			else
			{
				main_window_error_message("There are no registered accounts to make this call with.");
			}

		}
	}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
578
579
}

Emmanuel Milou's avatar
Emmanuel Milou committed
580
/* Internal to action - set the DEFAULT_ACCOUNT variable */
581
	void
Emmanuel Milou's avatar
Emmanuel Milou committed
582
583
584
585
586
sflphone_set_default_account( )
{
	gchar* default_id = strdup(dbus_get_default_account());
	account_list_set_default(default_id);	
}
Pierre-Luc Beaudoin's avatar
Pierre-Luc Beaudoin committed
587

588
589
590
591
592
593
594
595
596
597
598
599
600
601
void
sflphone_throw_exception( gchar* msg , int err )
{
  gchar* markup = malloc(1000);
  switch( err ){
    case ALSA_ERROR:
      sprintf( markup , "<b>ALSA notification</b>\n\n");
      break;
  }
  sprintf( markup , "%s%s" , markup , msg );
  main_window_error_message( markup );  
  free( markup );
}

602
603

/* Internal to action - get the codec list */
604
605
void	
sflphone_fill_codec_list()
606
{
607
608
609

  codec_list_clear();
    
610
  gchar** codecs = (gchar**)dbus_codec_list();
611
  gchar** order = (gchar**)dbus_get_active_codec_list();
612
613
  gchar** details;
  gchar** pl;
Emmanuel Milou's avatar
nothing    
Emmanuel Milou committed
614

615
  for(pl=order; *order; order++)
616
617
  {
    codec_t * c = g_new0(codec_t, 1);
618
    c->_payload = atoi(*order);
619
    details = (gchar **)dbus_codec_details(c->_payload);
620
    //printf("Codec details: %s / %s / %s / %s\n",details[0],details[1],details[2],details[3]);
621
    c->name = details[0];
622
    c->is_active = TRUE;
623
    c->sample_rate = atoi(details[1]);
Emmanuel Milou's avatar
Emmanuel Milou committed
624
625
626
    c->_bitrate = atof(details[2]);
    c->_bandwidth = atof(details[3]);
    codec_list_add(c);
627
  }
Emmanuel Milou's avatar
nothing    
Emmanuel Milou committed
628
 
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
  for(pl=codecs; *codecs; codecs++)
  {
    details = (gchar **)dbus_codec_details(atoi(*codecs));
    if(codec_list_get(details[0])!=NULL){
      // does nothing - the codec is already in the list, so is active.
    }
    else{
      codec_t* c = g_new0(codec_t, 1);
      c->_payload = atoi(*codecs);
      c->name = details[0];
      c->is_active = FALSE;
      c->sample_rate = atoi(details[1]);
      c->_bitrate = atof(details[2]);
      c->_bandwidth = atof(details[3]);
      codec_list_add(c);
    }
  }
646
647
648
649
650
651
652
653
  if( codec_list_get_size() == 0) {
    gchar* markup = malloc(1000);
    sprintf(markup , "<b>Error: No audio codecs found.\n\n</b> SFL audio codecs have to be placed in <i>%s</i> or in the <b>.sflphone</b> directory in your home( <i>%s</i> )", CODECS_DIR , g_get_home_dir());
    main_window_error_message( markup );
    g_free( markup );
    dbus_unregister(getpid());
    exit(0);
  }
654
}