annotate src/audacious/ui_lastfm.c @ 3497:6f34cc4217b9 trunk

Added "date" field to basic fields.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 05 Sep 2007 10:09:11 +0300
parents aea3349e2c62
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
1 #include <gtk/gtk.h>
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
2 #include <glib/gi18n.h>
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
3 #include <gdk/gdkkeysyms.h>
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
4 #include "configdb.h"
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
5 #include "playback.h"
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
6 #define DEBUG 1
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
7 typedef struct {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
8 gchar *username,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
9 *session;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
10 }last_fm;
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
11
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
12 typedef struct
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
13 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
14 gchar *artist,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
15 *title;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
16 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
17 track_data;
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
18
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
19 last_fm *login_data=NULL;
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
20 Playlist *current_playlist=NULL;
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
21 GtkWidget *lastfm_url_entry, *lastfm_label,*artist_label,*title_label,*album_label, *gui_window=NULL;
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
22
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
23 gpointer open_url(gpointer url)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
24 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
25 gchar*s=g_new0(gchar,20);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
26 VFSFile* fd = vfs_fopen((gchar*)url,"r");
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
27 if(fd)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
28 {
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
29 vfs_fgets(s,20,fd);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
30 g_print("Got data: '%s'\n",s);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
31 vfs_fclose(fd);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
32 }
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
33 g_free(s);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
34 g_free(url);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
35 return NULL;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
36 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
37 void command(gchar *comm)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
38 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
39 /* get the session from mowgli*/
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
40 if(login_data->session)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
41 {
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
42 g_free(login_data->session);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
43 login_data->session=NULL;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
44 }
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
45 login_data->session = g_strdup(mowgli_global_storage_get("lastfm_session_id"));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
46 gchar *url=g_strdup_printf("http://ws.audioscrobbler.com/radio/control.php?session=%s&command=%s&debug=0",login_data->session,comm);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
47 g_thread_create(open_url,url,FALSE,NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
48 if(!g_str_has_prefix(comm,"love"))
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
49 g_thread_create((gpointer)playback_initiate,NULL,FALSE,NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
50 return;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
51
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
52 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
53 static void change_track_data_cb(gpointer track, gpointer unused)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
54 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
55 gchar **inf,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
56 **t,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
57 *alb,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
58 *tr;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
59 tr=g_strdup(((track_data*)track)->title);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
60
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
61 if(tr==NULL)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
62 return ;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
63 if(g_strrstr(tr,"last.fm")==NULL)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
64 {
3408
aea3349e2c62 oops, missed an untranslated string in last.fm GUI
mf0102 <0102@gmx.at>
parents: 3402
diff changeset
65 gtk_entry_set_text(GTK_ENTRY(lastfm_url_entry), _("Not last.fm stream"));
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
66 return;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
67 }
3193
1fef0ac7395e fixed crashes
Cristi Magherusan <majeru@atheme-project.org>
parents: 3183
diff changeset
68
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
69 #if DEBUG
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
70 g_print("New Track: %s \n",tr);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
71 #endif
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
72 if(g_str_has_prefix(tr,"lastfm://"))
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
73 return;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
74 if(g_strrstr(tr,"Neighbour")!=NULL)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
75 {
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
76 gchar *temp=g_strdup_printf("lastfm://user/%s/neighbours", login_data->username);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
77 gtk_entry_set_text(GTK_ENTRY(lastfm_url_entry),temp);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
78 g_free(temp);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
79 }
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
80 if(g_strrstr(tr,"Personal")!=NULL)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
81 {
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
82 gchar *temp=g_strdup_printf("lastfm://user/%s/personal", login_data->username);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
83 gtk_entry_set_text(GTK_ENTRY(lastfm_url_entry),temp);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
84 g_free(temp);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
85 }
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
86
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
87 inf = g_strsplit(tr," - ",2);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
88 if(inf[0]==NULL || inf[1]==NULL)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
89 return;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
90 gchar* artist_markup=g_strdup_printf(_("<b>Artist:</b> %s") ,inf[0]);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
91 gtk_label_set_markup(GTK_LABEL(artist_label),artist_markup);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
92 g_free(artist_markup);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
93
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
94 t = g_strsplit(inf[1], g_strrstr(inf[1],"("),2);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
95 if(t[0]==NULL) return;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
96 alb = g_strdup(mowgli_global_storage_get("lastfm_album"));
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
97
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
98 gchar* title_markup=g_strdup_printf(_("<b>Title:</b> %s") ,t[0]);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
99 gtk_label_set_markup( GTK_LABEL(title_label),title_markup);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
100 g_free(title_markup);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
101
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
102 gchar* album_markup=g_strdup_printf(_("<b>Album:</b> %s") ,alb);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
103 gtk_label_set_markup( GTK_LABEL(album_label),album_markup);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
104 g_free(album_markup);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
105
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
106 g_strfreev(inf);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
107 g_strfreev(t);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
108 g_free(alb);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
109 g_free(tr);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
110
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
111 return ;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
112 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
113
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
114 static void show_login_error_dialog(void)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
115 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
116 const gchar *markup =
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
117 _("<b><big>Couldn't find your lastfm login data.</big></b>\n\n"
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
118 "Check if your Scrobbler's plugin login settings are configured properly.\n");
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
119
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
120 GtkWidget *dialog =
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
121 gtk_message_dialog_new_with_markup(NULL,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
122 GTK_DIALOG_DESTROY_WITH_PARENT,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
123 GTK_MESSAGE_ERROR,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
124 GTK_BUTTONS_OK,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
125 _(markup));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
126 gtk_dialog_run(GTK_DIALOG(dialog));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
127 gtk_widget_destroy(dialog);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
128 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
129
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
130
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
131
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
132 void init_last_fm(void)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
133 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
134 login_data = g_new0(last_fm,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
135 login_data->username = NULL;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
136 login_data->session = NULL;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
137 ConfigDb *cfg = NULL;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
138
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
139 if ((cfg = bmp_cfg_db_open()) != NULL)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
140 {
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
141 login_data->username=NULL;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
142 bmp_cfg_db_get_string(cfg, "audioscrobbler","username",
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
143 &login_data->username);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
144 if(login_data->username==NULL)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
145 show_login_error_dialog();
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
146 g_free(cfg);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
147 }
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
148
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
149 current_playlist = g_new0(Playlist,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
150 current_playlist = playlist_get_active();
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
151 track_data * tr=g_new0(track_data,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
152 tr->title =NULL;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
153 hook_associate( "playlist set info" , change_track_data_cb ,tr);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
154
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
155 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
156
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
157 /*event callback functions*/
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
158
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
159 gboolean love_press_callback(GtkWidget *love)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
160 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
161 command("love");
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
162 return FALSE;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
163 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
164
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
165 gboolean skip_press_callback(GtkWidget *skip)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
166 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
167 command("skip");
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
168 return FALSE;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
169 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
170 gboolean ban_press_callback(GtkWidget *ban)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
171 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
172 command("ban");
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
173 return FALSE;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
174 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
175
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
176
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
177 gboolean add_press_callback(GtkWidget *love)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
178 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
179 gchar *text=NULL;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
180 gint poz=0;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
181 text = g_strdup(gtk_entry_get_text(GTK_ENTRY(lastfm_url_entry)));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
182 if(playback_get_playing()==TRUE)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
183 playback_stop();
3193
1fef0ac7395e fixed crashes
Cristi Magherusan <majeru@atheme-project.org>
parents: 3183
diff changeset
184
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
185 poz = playlist_get_length(current_playlist);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
186 playlist_add_url(current_playlist, text);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
187 sleep(1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
188 playlist_set_position(current_playlist, poz);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
189 playback_initiate();
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
190 g_free(text);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
191 return FALSE;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
192 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
193
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
194 gboolean neighbours_press_callback(GtkWidget *love)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
195 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
196 gchar *temp=g_strdup_printf("lastfm://user/%s/neighbours", login_data->username);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
197 gtk_entry_set_text(GTK_ENTRY(lastfm_url_entry),temp);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
198 g_free(temp);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
199 return FALSE;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
200 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
201
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
202 gboolean personal_press_callback(GtkWidget *love)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
203 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
204 gchar *per=g_strdup_printf("lastfm://user/%s/personal", login_data->username);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
205 gtk_entry_set_text(GTK_ENTRY(lastfm_url_entry),per);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
206 g_free(per);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
207 return FALSE;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
208 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
209
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
210 gboolean delete_window_callback(GtkWidget *window)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
211 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
212 gtk_widget_destroy(window);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
213 window=NULL;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
214 return FALSE;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
215 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
216 static gboolean keypress_callback(GtkWidget * widget, GdkEventKey * event, gpointer data)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
217 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
218 switch (event->keyval)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
219 {
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
220 case GDK_Escape:
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
221 gtk_widget_hide_all(widget);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
222 break;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
223 default:
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
224 return FALSE;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
225 }
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
226 return TRUE;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
227 }
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
228
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
229
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
230 GtkWidget *ui_lastfm_create(void)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
231 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
232 GtkWidget *window;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
233 GtkWidget *box1,*box2,*vboxw,*vbox1,*vbox2,*v_hbox1,*v_hbox2,*labelbox;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
234 GtkWidget *love,*ban,*skip,*add,*neighbours,*personal;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
235
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
236 window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
237 gtk_window_set_position(GTK_WINDOW(window),GTK_WIN_POS_CENTER);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
238 gtk_window_set_title(GTK_WINDOW(window), _("Audacious last.fm radio tuner"));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
239 lastfm_label = gtk_label_new_with_mnemonic(_("Station:"));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
240 title_label = gtk_label_new(NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
241 artist_label = gtk_label_new(NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
242 album_label = gtk_label_new(NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
243 lastfm_url_entry = gtk_entry_new();
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
244 gtk_editable_set_editable (GTK_EDITABLE(lastfm_url_entry),TRUE);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
245 gchar* artist_markup=g_strdup(_("<b>Artist:</b>"));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
246 gtk_label_set_markup(GTK_LABEL(artist_label),artist_markup);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
247 g_free(artist_markup);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
248
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
249 gchar* title_markup=g_strdup(_("<b>Title:</b>"));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
250 gtk_label_set_markup( GTK_LABEL(title_label),title_markup);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
251 g_free(title_markup);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
252
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
253 gchar* album_markup=g_strdup_printf(_("<b>Album:</b>"));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
254 gtk_label_set_markup( GTK_LABEL(album_label),album_markup);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
255 g_free(album_markup);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
256
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
257 love = gtk_button_new_with_label (_("Love"));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
258 ban = gtk_button_new_with_label (_("Ban"));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
259 skip = gtk_button_new_with_label (_("Skip"));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
260 add = gtk_button_new_with_label (_("Tune in"));
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
261
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
262 neighbours = gtk_button_new_with_label(_("Neighbours' radio"));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
263 personal = gtk_button_new_with_label(_("Personal radio"));
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
264
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
265 box1 = gtk_hbox_new(FALSE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
266 box2 = gtk_hbox_new(FALSE,1);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
267
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
268 vboxw = gtk_vbox_new(FALSE,1);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
269
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
270 vbox1 = gtk_vbox_new(FALSE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
271 vbox2 = gtk_vbox_new(FALSE,1);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
272
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
273 v_hbox1 = gtk_vbox_new(FALSE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
274 v_hbox2 = gtk_hbox_new(FALSE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
275 labelbox = gtk_vbox_new(FALSE,1);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
276
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
277 gtk_misc_set_alignment(GTK_MISC(artist_label),0,0);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
278 gtk_misc_set_alignment(GTK_MISC(title_label),0,0);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
279 gtk_misc_set_alignment(GTK_MISC(album_label),0,0);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
280
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
281 gtk_box_pack_start(GTK_BOX(vboxw),box1,FALSE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
282 gtk_box_pack_end(GTK_BOX(vboxw),box2,TRUE,TRUE,1);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
283
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
284 gtk_box_pack_start(GTK_BOX(box1),lastfm_label,FALSE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
285 gtk_box_pack_start(GTK_BOX(box1),lastfm_url_entry,TRUE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
286 gtk_box_pack_start(GTK_BOX(box1),add,FALSE,TRUE,1);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
287
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
288 gtk_box_set_spacing(GTK_BOX(box1),2);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
289 gtk_container_set_border_width(GTK_CONTAINER(box1),2);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
290
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
291 gtk_box_pack_start(GTK_BOX(box2),vbox1,FALSE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
292 gtk_box_pack_start(GTK_BOX(box2),vbox2,TRUE,TRUE,1);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
293
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
294 gtk_box_pack_start(GTK_BOX(vbox1),neighbours,FALSE,TRUE,3);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
295 gtk_box_pack_start(GTK_BOX(vbox1),personal,FALSE,TRUE,3);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
296 gtk_box_set_spacing(GTK_BOX(vbox1),2);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
297 gtk_container_set_border_width(GTK_CONTAINER(vbox1),2);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
298
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
299 gtk_box_pack_start(GTK_BOX(vbox2),v_hbox1,TRUE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
300 gtk_box_pack_start(GTK_BOX(vbox2),v_hbox2,TRUE,TRUE,1);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
301
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
302 gtk_box_pack_start(GTK_BOX(v_hbox1),artist_label,TRUE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
303 gtk_box_pack_start(GTK_BOX(v_hbox1),title_label,TRUE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
304 gtk_box_pack_start(GTK_BOX(v_hbox1),album_label,TRUE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
305 gtk_box_set_spacing(GTK_BOX(v_hbox1),2);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
306 gtk_container_set_border_width(GTK_CONTAINER(v_hbox1),2);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
307
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
308
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
309 gtk_box_pack_start(GTK_BOX(v_hbox2),love,TRUE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
310 gtk_box_pack_start(GTK_BOX(v_hbox2),skip,TRUE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
311 gtk_box_pack_start(GTK_BOX(v_hbox2),ban,TRUE,TRUE,1);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
312 gtk_box_set_spacing(GTK_BOX(v_hbox1),2);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
313 gtk_container_set_border_width(GTK_CONTAINER(v_hbox1),2);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
314
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
315
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
316
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
317 gtk_container_add (GTK_CONTAINER (window), vboxw);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
318
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
319 g_signal_connect (G_OBJECT (love), "button_press_event",G_CALLBACK (love_press_callback), NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
320 g_signal_connect (G_OBJECT (add), "button_press_event",G_CALLBACK (add_press_callback), NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
321 g_signal_connect (G_OBJECT (ban), "button_press_event",G_CALLBACK (ban_press_callback), NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
322 g_signal_connect (G_OBJECT (skip), "button_press_event",G_CALLBACK (skip_press_callback), NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
323 g_signal_connect (G_OBJECT (neighbours), "button_press_event",G_CALLBACK (neighbours_press_callback), NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
324 g_signal_connect (G_OBJECT (personal), "button_press_event",G_CALLBACK (personal_press_callback), NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
325 g_signal_connect (G_OBJECT (window), "delete_event",G_CALLBACK (gtk_widget_hide_all), window);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
326 g_signal_connect (G_OBJECT (window), "key_press_event",G_CALLBACK(keypress_callback), NULL);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
327
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
328 gtk_widget_set_size_request(GTK_WIDGET(window),400,124);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
329 gtk_window_set_resizable(GTK_WINDOW(window),FALSE);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
330 gtk_widget_show_all(gui_window);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
331 return window;
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
332 }
3193
1fef0ac7395e fixed crashes
Cristi Magherusan <majeru@atheme-project.org>
parents: 3183
diff changeset
333 #if 0
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
334 static void no_lastfm_plugin_dialog(void)
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
335 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
336 const gchar *markup =
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
337 N_("<b><big>The lastfm radio plugin could not be found.</big></b>\n\n"
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
338 "Check if the AudioScrobbler plugin was compiled in\n");
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
339
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
340 GtkWidget *dialog =
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
341 gtk_message_dialog_new_with_markup(NULL,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
342 GTK_DIALOG_DESTROY_WITH_PARENT,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
343 GTK_MESSAGE_ERROR,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
344 GTK_BUTTONS_OK,
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
345 _(markup));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
346 gtk_dialog_run(GTK_DIALOG(dialog));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
347 gtk_widget_destroy(dialog);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
348 }
3193
1fef0ac7395e fixed crashes
Cristi Magherusan <majeru@atheme-project.org>
parents: 3183
diff changeset
349 #endif
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
350
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
351
3023
49ce30748980 added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
352 void ui_lastfm(void)
49ce30748980 added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
353 {
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
354 /*if(!mowgli_global_storage_get("lastfm_loaded"))
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
355 {
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
356 no_lastfm_plugin_dialog();
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
357 return;
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
358 }
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
359 */
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
360 init_last_fm();
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
361 if(!gui_window)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
362 {
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
363 if((gui_window = ui_lastfm_create())!=NULL);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
364 gtk_widget_show_all(gui_window);
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
365
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
366 #if 0
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
367 /*here should be set the artist, title and album labels at the first run, because it isn't captured by the hook*/
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
368 gchar* current_title = playlist_get_songtitle(current_playlist,playlist_get_position(current_playlist));
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
369 if(current_title)
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
370 change_track_data_cb(current_title,NULL);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
371 #endif
3402
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
372 }
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
373 else
dc5ac604569d - completed German translation (for now ...)
mf0102 <0102@gmx.at>
parents: 3298
diff changeset
374 gtk_widget_show_all(gui_window);
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
375
3023
49ce30748980 added lastfm GUI stub
Cristi Magherusan <majeru@atheme-project.org>
parents:
diff changeset
376 }
3183
bcf611cf5ae2 lastfm radio GUI
Cristi Magherusan <majeru@atheme-project.org>
parents: 3023
diff changeset
377