Mercurial > audlegacy-plugins
annotate src/scrobbler/configure.c @ 3191:a65f440cbed3
alsa-ng: Fix possible race conditions, sluggish pause and seek.
author | John Lindgren <john.lindgren@tds.net> |
---|---|
date | Mon, 22 Jun 2009 16:05:57 -0400 |
parents | 062f42c3737e |
children |
rev | line source |
---|---|
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
1 #include "settings.h" |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
2 |
2599
19fb7d7dcf4e
Use the md5 routines in libaudutil.
Matti Hamalainen <ccr@tnsp.org>
parents:
2576
diff
changeset
|
3 #include "config.h" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
4 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
5 #include <sys/types.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
6 #include <sys/stat.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
7 #include <unistd.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
8 #include <string.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
9 #include <stdio.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
10 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
11 #include <glib.h> |
2971
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2946
diff
changeset
|
12 #include <audlegacy/plugin.h> |
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2946
diff
changeset
|
13 #include <audlegacy/audutil.h> |
3134a0987162
- changed include path from audacious to audlegacy.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
2946
diff
changeset
|
14 #include <audlegacy/i18n.h> |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
15 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
16 #include <gdk/gdkkeysyms.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
17 #include <gtk/gtk.h> |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
18 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
19 #include "configure.h" |
2318
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
20 #include "plugin.h" |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
21 |
3109
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
22 GtkWidget *entry1, *entry2, *entry3, *ge_entry1, *ge_entry2, *cfgdlg; |
2943
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
23 static GdkColor disabled_color; |
2318
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
24 guint apply_timeout = 0; /* ID of timeout to save new config */ |
2319
146381a317df
stop plugin when user starts to type new details into configuration window, and start it when he finishes
Tomasz Mon <desowin@gmail.com>
parents:
2318
diff
changeset
|
25 gboolean running = TRUE; /* if plugin threads are running */ |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
26 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
27 static char *hexify(char *pass, int len) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
28 { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
29 static char buf[33]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
30 char *bp = buf; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
31 char hexchars[] = "0123456789abcdef"; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
32 int i; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
33 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
34 memset(buf, 0, sizeof(buf)); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
35 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
36 for(i = 0; i < len; i++) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
37 *(bp++) = hexchars[(pass[i] >> 4) & 0x0f]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
38 *(bp++) = hexchars[pass[i] & 0x0f]; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
39 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
40 *bp = 0; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
41 return buf; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
42 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
43 |
2943
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
44 static char *pwd = NULL; |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
45 static char *ge_pwd = NULL; |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
46 |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
47 static void saveconfig(void) |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
48 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2496
diff
changeset
|
49 mcs_handle_t *cfgfile; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
50 |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
51 const char *uid = gtk_entry_get_text(GTK_ENTRY(entry1)); |
3109
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
52 const char *url = gtk_entry_get_text(GTK_ENTRY(entry3)); |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
53 const char *ge_uid = gtk_entry_get_text(GTK_ENTRY(ge_entry1)); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
54 |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
55 if ((cfgfile = aud_cfg_db_open())) { |
2599
19fb7d7dcf4e
Use the md5 routines in libaudutil.
Matti Hamalainen <ccr@tnsp.org>
parents:
2576
diff
changeset
|
56 aud_md5state_t md5state; |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
57 unsigned char md5pword[16], ge_md5pword[16]; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
58 |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
59 if (uid != NULL && uid[0] != '\0' && strlen(uid) && |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
60 pwd != NULL && pwd[0] != '\0' && strlen(pwd)) |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
61 { |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
62 aud_cfg_db_set_string(cfgfile, "audioscrobbler", "username", (char *)uid); |
2599
19fb7d7dcf4e
Use the md5 routines in libaudutil.
Matti Hamalainen <ccr@tnsp.org>
parents:
2576
diff
changeset
|
63 aud_md5_init(&md5state); |
19fb7d7dcf4e
Use the md5 routines in libaudutil.
Matti Hamalainen <ccr@tnsp.org>
parents:
2576
diff
changeset
|
64 aud_md5_append(&md5state, (unsigned const char *)pwd, strlen(pwd)); |
19fb7d7dcf4e
Use the md5 routines in libaudutil.
Matti Hamalainen <ccr@tnsp.org>
parents:
2576
diff
changeset
|
65 aud_md5_finish(&md5state, md5pword); |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
66 aud_cfg_db_set_string(cfgfile, "audioscrobbler", "password", |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
67 hexify((char*)md5pword, sizeof(md5pword))); |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
68 } else if (!uid || uid[0] == '\0') { |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
69 aud_cfg_db_set_string(cfgfile, "audioscrobbler", "username", ""); |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
70 aud_cfg_db_set_string(cfgfile, "audioscrobbler", "password", ""); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
71 } |
3109
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
72 |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
73 if (url != NULL && url[0] != '\0' && strlen(url)) |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
74 aud_cfg_db_set_string(cfgfile, "audioscrobbler", "sc_url", (char *)url); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
75 else if (!url || url[0] == '\0') |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
76 aud_cfg_db_set_string(cfgfile, "audioscrobbler", "sc_url", LASTFM_HS_URL); |
2318
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
77 |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
78 if (ge_uid != NULL && ge_uid[0] != '\0' && strlen(ge_uid) && |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
79 ge_pwd != NULL && ge_pwd[0] != '\0' && strlen(ge_pwd)) |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
80 { |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
81 aud_cfg_db_set_string(cfgfile, "audioscrobbler", "ge_username", (char *)ge_uid); |
2599
19fb7d7dcf4e
Use the md5 routines in libaudutil.
Matti Hamalainen <ccr@tnsp.org>
parents:
2576
diff
changeset
|
82 aud_md5_init(&md5state); |
19fb7d7dcf4e
Use the md5 routines in libaudutil.
Matti Hamalainen <ccr@tnsp.org>
parents:
2576
diff
changeset
|
83 aud_md5_append(&md5state, (unsigned const char *)ge_pwd, strlen(ge_pwd)); |
19fb7d7dcf4e
Use the md5 routines in libaudutil.
Matti Hamalainen <ccr@tnsp.org>
parents:
2576
diff
changeset
|
84 aud_md5_finish(&md5state, ge_md5pword); |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
85 aud_cfg_db_set_string(cfgfile, "audioscrobbler", "ge_password", |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
86 hexify((char*)ge_md5pword, sizeof(ge_md5pword))); |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
87 } else if (!ge_uid || ge_uid[0] == '\0') { |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
88 aud_cfg_db_set_string(cfgfile, "audioscrobbler", "ge_username", ""); |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
89 aud_cfg_db_set_string(cfgfile, "audioscrobbler", "ge_password", ""); |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
90 } |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
91 |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
92 aud_cfg_db_close(cfgfile); |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
93 } |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
94 } |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
95 |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
96 static gboolean apply_config_changes(gpointer data) { |
2318
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
97 apply_timeout = 0; |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
98 saveconfig(); |
2318
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
99 start(); |
2319
146381a317df
stop plugin when user starts to type new details into configuration window, and start it when he finishes
Tomasz Mon <desowin@gmail.com>
parents:
2318
diff
changeset
|
100 running = TRUE; |
2318
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
101 return FALSE; |
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
102 } |
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
103 |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
104 void configure_cleanup(void) { |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
105 if (apply_timeout) { /* config has been changed, but wasn't saved yet */ |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
106 g_source_remove(apply_timeout); |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
107 apply_timeout = 0; |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
108 saveconfig(); |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
109 } |
2943
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
110 g_free(pwd); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
111 g_free(ge_pwd); |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
112 } |
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
113 |
2318
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
114 static void |
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
115 entry_changed(GtkWidget *widget, gpointer data) |
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
116 { |
2319
146381a317df
stop plugin when user starts to type new details into configuration window, and start it when he finishes
Tomasz Mon <desowin@gmail.com>
parents:
2318
diff
changeset
|
117 if (running) { |
146381a317df
stop plugin when user starts to type new details into configuration window, and start it when he finishes
Tomasz Mon <desowin@gmail.com>
parents:
2318
diff
changeset
|
118 stop(); |
146381a317df
stop plugin when user starts to type new details into configuration window, and start it when he finishes
Tomasz Mon <desowin@gmail.com>
parents:
2318
diff
changeset
|
119 running = FALSE; |
146381a317df
stop plugin when user starts to type new details into configuration window, and start it when he finishes
Tomasz Mon <desowin@gmail.com>
parents:
2318
diff
changeset
|
120 } |
146381a317df
stop plugin when user starts to type new details into configuration window, and start it when he finishes
Tomasz Mon <desowin@gmail.com>
parents:
2318
diff
changeset
|
121 |
2318
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
122 if (apply_timeout) |
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
123 g_source_remove(apply_timeout); |
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
124 |
2328
224727e6c73d
if apply_timeout hasn't passed before cleanup, save password during cleanup; minor changes to saveconfig()
Tomasz Mon <desowin@gmail.com>
parents:
2319
diff
changeset
|
125 apply_timeout = g_timeout_add_seconds(10, (GSourceFunc) apply_config_changes, NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
126 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
127 |
2943
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
128 static void entry_focus_in(GtkWidget *widget, gpointer data) |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
129 { |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
130 gtk_entry_set_text(GTK_ENTRY(widget), ""); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
131 gtk_entry_set_visibility(GTK_ENTRY(widget), FALSE); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
132 gtk_widget_modify_text(widget, GTK_STATE_NORMAL, NULL); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
133 } |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
134 |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
135 static void entry_focus_out(GtkWidget *widget, gpointer data) |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
136 { |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
137 if (widget == entry2) |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
138 { |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
139 g_free(pwd); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
140 pwd = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry2))); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
141 } |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
142 if (widget == ge_entry2) |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
143 { |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
144 g_free(ge_pwd); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
145 ge_pwd = g_strdup(gtk_entry_get_text(GTK_ENTRY(ge_entry2))); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
146 } |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
147 entry_changed(widget, data); |
2946
a8fce81bcd40
make prompt translatable
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2944
diff
changeset
|
148 gtk_entry_set_text(GTK_ENTRY(widget), _("Change password")); |
2943
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
149 gtk_widget_modify_text(widget, GTK_STATE_NORMAL, &disabled_color); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
150 gtk_entry_set_visibility(GTK_ENTRY(widget), TRUE); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
151 } |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
152 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
153 /* Generated by glade, sorta. */ |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
154 GtkWidget * |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
155 create_cfgdlg(void) |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
156 { |
2523
769e17da93dd
Replaced s/ConfigDb/mcs_handle_t/g, as per changes in the core.
Matti Hamalainen <ccr@tnsp.org>
parents:
2496
diff
changeset
|
157 mcs_handle_t *db; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
158 GtkWidget *vbox2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
159 GtkWidget *table1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
160 GtkWidget *label3; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
161 GtkWidget *label1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
162 GtkWidget *label2; |
3109
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
163 GtkWidget *label4; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
164 GtkWidget *himage1; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
165 GtkWidget *align1; |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
166 GtkWidget *notebook1; |
2943
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
167 GtkStyle *style; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
168 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
169 vbox2 = gtk_vbox_new (FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
170 |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
171 label1 = gtk_label_new (_("<b>Services</b>")); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
172 gtk_widget_show (label1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
173 gtk_label_set_use_markup (GTK_LABEL (label1), TRUE); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
174 gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
175 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
176 gtk_box_pack_start (GTK_BOX (vbox2), label1, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
177 |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
178 notebook1 = gtk_notebook_new(); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
179 gtk_widget_show (notebook1); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
180 |
354 | 181 |
182 // last fm | |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
183 align1 = gtk_alignment_new(0, 0, 0, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
184 gtk_widget_show (align1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
185 gtk_alignment_set_padding(GTK_ALIGNMENT(align1), 0, 0, 12, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
186 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
187 table1 = gtk_table_new (2, 2, FALSE); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
188 gtk_widget_show (table1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
189 gtk_container_add(GTK_CONTAINER(align1), table1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
190 gtk_table_set_row_spacings (GTK_TABLE(table1), 6); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
191 gtk_table_set_col_spacings (GTK_TABLE(table1), 6); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
192 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
193 label2 = gtk_label_new (_("Username:")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
194 gtk_widget_show (label2); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
195 gtk_table_attach_defaults (GTK_TABLE (table1), label2, 0, 1, 2, 3); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
196 gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_RIGHT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
197 gtk_misc_set_alignment (GTK_MISC (label2), 1, 0.5); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
198 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
199 label3 = gtk_label_new (_("Password:")); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
200 gtk_widget_show (label3); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
201 gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 3, 4, |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
202 (GtkAttachOptions) (GTK_FILL), |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
203 (GtkAttachOptions) (0), 0, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
204 gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_RIGHT); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
205 gtk_misc_set_alignment (GTK_MISC (label3), 1, 0.5); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
206 |
3109
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
207 label4 = gtk_label_new (_("Scrobbler URL:")); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
208 gtk_widget_show (label4); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
209 gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 4, 5, |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
210 (GtkAttachOptions) (GTK_FILL), |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
211 (GtkAttachOptions) (0), 0, 0); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
212 gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_RIGHT); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
213 gtk_misc_set_alignment (GTK_MISC (label4), 1, 0.5); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
214 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
215 entry1 = gtk_entry_new (); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
216 gtk_widget_show (entry1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
217 gtk_table_attach_defaults (GTK_TABLE (table1), entry1, 1, 2, 2, 3); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
218 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
219 entry2 = gtk_entry_new (); |
2943
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
220 |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
221 style = gtk_widget_get_style(entry2); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
222 memcpy(&disabled_color, &(style->text[GTK_STATE_INSENSITIVE]), sizeof(GdkColor)); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
223 gtk_widget_modify_text(entry2, GTK_STATE_NORMAL, &disabled_color); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
224 |
2946
a8fce81bcd40
make prompt translatable
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2944
diff
changeset
|
225 gtk_entry_set_text(GTK_ENTRY(entry2), _("Change password")); |
2943
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
226 g_signal_connect(G_OBJECT(entry2), "focus-in-event", |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
227 G_CALLBACK(entry_focus_in), |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
228 NULL); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
229 g_signal_connect(G_OBJECT(entry2), "focus-out-event", |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
230 G_CALLBACK(entry_focus_out), |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
231 NULL); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
232 gtk_widget_show (entry2); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
233 gtk_table_attach_defaults (GTK_TABLE (table1), entry2, 1, 2, 3, 4); |
3109
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
234 |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
235 entry3 = gtk_entry_new (); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
236 gtk_widget_show (entry3); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
237 gtk_table_attach_defaults (GTK_TABLE (table1), entry3, 1, 2, 4, 5); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
238 |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
239 label1 = gtk_label_new (_("<b>Last.FM</b>")); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
240 gtk_label_set_use_markup (GTK_LABEL (label1), TRUE); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
241 gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), GTK_WIDGET(align1), label1); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
242 |
354 | 243 |
244 // gerpok | |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
245 align1 = gtk_alignment_new(0, 0, 0, 0); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
246 gtk_widget_show (align1); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
247 gtk_alignment_set_padding(GTK_ALIGNMENT(align1), 0, 0, 12, 0); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
248 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
249 table1 = gtk_table_new (2, 2, FALSE); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
250 gtk_widget_show (table1); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
251 gtk_container_add(GTK_CONTAINER(align1), table1); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
252 gtk_table_set_row_spacings (GTK_TABLE(table1), 6); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
253 gtk_table_set_col_spacings (GTK_TABLE(table1), 6); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
254 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
255 label2 = gtk_label_new (_("Username:")); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
256 gtk_widget_show (label2); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
257 gtk_table_attach_defaults (GTK_TABLE (table1), label2, 0, 1, 2, 3); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
258 gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_RIGHT); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
259 gtk_misc_set_alignment (GTK_MISC (label2), 1, 0.5); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
260 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
261 label3 = gtk_label_new (_("Password:")); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
262 gtk_widget_show (label3); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
263 gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 3, 4, |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
264 (GtkAttachOptions) (GTK_FILL), |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
265 (GtkAttachOptions) (0), 0, 0); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
266 gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_RIGHT); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
267 gtk_misc_set_alignment (GTK_MISC (label3), 1, 0.5); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
268 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
269 ge_entry1 = gtk_entry_new (); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
270 gtk_widget_show (ge_entry1); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
271 gtk_table_attach_defaults (GTK_TABLE (table1), ge_entry1, 1, 2, 2, 3); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
272 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
273 ge_entry2 = gtk_entry_new (); |
2943
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
274 gtk_widget_modify_text(ge_entry2, GTK_STATE_NORMAL, &disabled_color); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
275 |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
276 gtk_entry_set_text(GTK_ENTRY(ge_entry2), "Change password"); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
277 g_signal_connect(G_OBJECT(ge_entry2), "focus-in-event", |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
278 G_CALLBACK(entry_focus_in), |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
279 NULL); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
280 g_signal_connect(G_OBJECT(ge_entry2), "focus-out-event", |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
281 G_CALLBACK(entry_focus_out), |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
282 NULL); |
d3e42ee17c93
added password prompt
Andrew O. Shadoura <bugzilla@tut.by>
parents:
2599
diff
changeset
|
283 |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
284 gtk_widget_show (ge_entry2); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
285 gtk_table_attach_defaults (GTK_TABLE (table1), ge_entry2, 1, 2, 3, 4); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
286 |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
287 label1 = gtk_label_new (_("<b>Gerpok</b>")); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
288 gtk_label_set_use_markup (GTK_LABEL (label1), TRUE); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
289 gtk_notebook_append_page(GTK_NOTEBOOK(notebook1), GTK_WIDGET(align1), label1); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
290 |
354 | 291 // common |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
292 gtk_box_pack_start (GTK_BOX (vbox2), notebook1, TRUE, TRUE, 6); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
293 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
294 himage1 = gtk_image_new_from_file (DATA_DIR "/images/audioscrobbler_badge.png"); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
295 gtk_widget_show (himage1); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
296 gtk_box_pack_start (GTK_BOX (vbox2), himage1, FALSE, FALSE, 0); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
297 gtk_misc_set_alignment (GTK_MISC (himage1), 1, 0.5); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
298 |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
299 gtk_entry_set_text(GTK_ENTRY(entry1), ""); |
2944 | 300 gtk_entry_set_text(GTK_ENTRY(ge_entry1), ""); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
301 |
2124 | 302 if ((db = aud_cfg_db_open())) { |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
303 gchar *username = NULL; |
3109
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
304 gchar *sc_url = NULL; |
354 | 305 // last fm |
2124 | 306 aud_cfg_db_get_string(db, "audioscrobbler", "username", |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
307 &username); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
308 if (username) { |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
309 gtk_entry_set_text(GTK_ENTRY(entry1), username); |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
310 g_free(username); |
347 | 311 username = NULL; |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
312 } |
3109
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
313 |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
314 aud_cfg_db_get_string(db, "audioscrobbler", "sc_url", &sc_url); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
315 if (sc_url) { |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
316 gtk_entry_set_text(GTK_ENTRY(entry3), sc_url); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
317 g_free(sc_url); |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
318 sc_url = NULL; |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
319 } |
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
320 |
354 | 321 // gerpok |
2124 | 322 aud_cfg_db_get_string(db, "audioscrobbler", "ge_username", |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
323 &username); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
324 if (username) { |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
325 gtk_entry_set_text(GTK_ENTRY(ge_entry1), username); |
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
326 g_free(username); |
364 | 327 username = NULL; |
344
03c1ae10bc8d
[svn] - Merge audacious-scrobbler III, new features include:
nenolod
parents:
12
diff
changeset
|
328 } |
990
238055a6cb8f
[svn] - remove support for hatena music as hatena ceased their musical profile service.
yaz
parents:
527
diff
changeset
|
329 |
2124 | 330 aud_cfg_db_close(db); |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
331 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
332 |
2318
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
333 g_signal_connect(entry1, "changed", G_CALLBACK(entry_changed), NULL); |
3109
5a11abf0075c
scrobbler: add support for custom audioscrobbler servers. (closes #23)
William Pitcock <nenolod@atheme.org>
parents:
2971
diff
changeset
|
334 g_signal_connect(entry3, "changed", G_CALLBACK(entry_changed), NULL); |
2318
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
335 g_signal_connect(ge_entry1, "changed", G_CALLBACK(entry_changed), NULL); |
d7c321957be8
apply username/password changes 10 seconds after last keystroke in config editboxes
Tomasz Mon <desowin@gmail.com>
parents:
2124
diff
changeset
|
336 |
0
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
337 return vbox2; |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
338 } |
13389e613d67
[svn] - initial import of audacious-plugins tree (lots to do)
nenolod
parents:
diff
changeset
|
339 |