annotate src/lirc/lirc_cfg.c @ 2345:0405c29fecf7

branch merge
author Yoshiki Yazawa <yaz@cc.rim.or.jp>
date Sun, 03 Feb 2008 00:06:33 +0900
parents 738914331374
children 194c2f8c2a92 fea021087241
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2279
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
1 #include <config.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
2
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
3 #include <gtk/gtk.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
4 #include <audacious/i18n.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
5 #include <audacious/plugin.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
6 #include <audacious/configdb.h>
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
7
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
8 #include "common.h"
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
9
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
10 GtkWidget *lirc_cfg = NULL;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
11
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
12 gint b_enable_reconnect;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
13 gint reconnect_timeout;
2305
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2279
diff changeset
14 gchar *aosd_font = NULL;
2279
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
15
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
16 void load_cfg(void)
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
17 {
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
18 ConfigDb *db;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
19 db = aud_cfg_db_open();
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
20 aud_cfg_db_get_int(db, "lirc", "enable_reconnect", &b_enable_reconnect);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
21 aud_cfg_db_get_int(db, "lirc", "reconnect_timeout", &reconnect_timeout);
2305
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2279
diff changeset
22 if (!aud_cfg_db_get_string(db, "aosd", "text_fonts_name_0", &aosd_font))
738914331374 Add ability to enter track number using remote. (Bugzilla #115)
Andrew O. Shadoura <bugzilla@tut.by>
parents: 2279
diff changeset
23 aosd_font = g_strdup("Sans 26");
2279
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
24 if (!reconnect_timeout) reconnect_timeout = 5;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
25 aud_cfg_db_close(db);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
26 }
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
27
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
28 void save_cfg(void)
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
29 {
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
30 ConfigDb *db;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
31 db = aud_cfg_db_open();
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
32 aud_cfg_db_set_int(db, "lirc", "enable_reconnect", b_enable_reconnect);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
33 aud_cfg_db_set_int(db, "lirc", "reconnect_timeout", reconnect_timeout);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
34 aud_cfg_db_close(db);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
35 }
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
36
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
37 void configure(void)
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
38 {
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
39 if (lirc_cfg)
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
40 {
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
41 gtk_window_present(GTK_WINDOW(lirc_cfg));
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
42 return;
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
43 }
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
44 load_cfg();
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
45 lirc_cfg = create_lirc_cfg();
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
46 gtk_widget_show_all(lirc_cfg);
90d9e13d2e18 Add missing files.
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
47 }