Mercurial > audlegacy
annotate src/audacious/ui_fileinfopopup.c @ 4063:069d37422964
Automated merge with ssh://hg.atheme.org//hg/audacious
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Tue, 04 Dec 2007 03:34:41 +0300 |
parents | e794ae16017e |
children | 4d4691fdebe1 |
rev | line source |
---|---|
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
1 /* |
2894
062324422c40
Backed out changeset 7dad846ec69940e4e905c357ae8dff81240b579b
William Pitcock <nenolod@atheme.org>
parents:
2862
diff
changeset
|
2 * Audacious: A cross-platform multimedia player |
062324422c40
Backed out changeset 7dad846ec69940e4e905c357ae8dff81240b579b
William Pitcock <nenolod@atheme.org>
parents:
2862
diff
changeset
|
3 * Copyright (c) 2006 William Pitcock, Tony Vroon, George Averill, |
062324422c40
Backed out changeset 7dad846ec69940e4e905c357ae8dff81240b579b
William Pitcock <nenolod@atheme.org>
parents:
2862
diff
changeset
|
4 * Giacomo Lozito, Derek Pomery and Yoshiki Yazawa. |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
5 * |
2894
062324422c40
Backed out changeset 7dad846ec69940e4e905c357ae8dff81240b579b
William Pitcock <nenolod@atheme.org>
parents:
2862
diff
changeset
|
6 * This program is free software; you can redistribute it and/or modify |
062324422c40
Backed out changeset 7dad846ec69940e4e905c357ae8dff81240b579b
William Pitcock <nenolod@atheme.org>
parents:
2862
diff
changeset
|
7 * it under the terms of the GNU General Public License as published by |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2894
diff
changeset
|
8 * the Free Software Foundation; under version 3 of the License. |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
9 * |
2894
062324422c40
Backed out changeset 7dad846ec69940e4e905c357ae8dff81240b579b
William Pitcock <nenolod@atheme.org>
parents:
2862
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
062324422c40
Backed out changeset 7dad846ec69940e4e905c357ae8dff81240b579b
William Pitcock <nenolod@atheme.org>
parents:
2862
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
062324422c40
Backed out changeset 7dad846ec69940e4e905c357ae8dff81240b579b
William Pitcock <nenolod@atheme.org>
parents:
2862
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
062324422c40
Backed out changeset 7dad846ec69940e4e905c357ae8dff81240b579b
William Pitcock <nenolod@atheme.org>
parents:
2862
diff
changeset
|
13 * GNU General Public License for more details. |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
14 * |
2894
062324422c40
Backed out changeset 7dad846ec69940e4e905c357ae8dff81240b579b
William Pitcock <nenolod@atheme.org>
parents:
2862
diff
changeset
|
15 * You should have received a copy of the GNU General Public License |
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2894
diff
changeset
|
16 * along with this program. If not, see <http://www.gnu.org/licenses>. |
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
17 * |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
18 * The Audacious team does not consider modular code linking to |
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
19 * Audacious or using our public API to be a derived work. |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
20 */ |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
21 |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
22 #ifdef HAVE_CONFIG_H |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
23 # include "config.h" |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
24 #endif |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
25 |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
26 #include <glib.h> |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
27 #include <glib/gi18n.h> |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
28 #include <gtk/gtk.h> |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
29 #include <string.h> |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
30 |
2604 | 31 #include "main.h" |
32 #include "playlist.h" | |
33 #include "playback.h" | |
34 #include "strings.h" | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
35 #include "ui_fileinfopopup.h" |
2604 | 36 #include "ui_fileinfo.h" |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
37 |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
38 static void |
2604 | 39 filepopup_entry_set_text(GtkWidget *filepopup_win, const gchar *entry_name, |
40 const gchar *text) | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
41 { |
2604 | 42 GtkWidget *widget = g_object_get_data(G_OBJECT(filepopup_win), entry_name); |
43 g_return_if_fail(widget != NULL); | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
44 |
2604 | 45 gtk_label_set_text(GTK_LABEL(widget), text); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
46 } |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
47 |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
48 static void |
2604 | 49 filepopup_entry_set_image(GtkWidget *filepopup_win, const gchar *entry_name, |
50 const gchar *text) | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
51 { |
2604 | 52 GtkWidget *widget = g_object_get_data(G_OBJECT(filepopup_win), entry_name); |
53 GdkPixbuf *pixbuf, *pixbuf2; | |
54 int width, height; | |
55 double aspect; | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
56 |
2604 | 57 g_return_if_fail(widget != NULL); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
58 |
2604 | 59 pixbuf = gdk_pixbuf_new_from_file(text, NULL); |
60 g_return_if_fail(pixbuf != NULL); | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
61 |
2604 | 62 width = gdk_pixbuf_get_width(GDK_PIXBUF(pixbuf)); |
63 height = gdk_pixbuf_get_height(GDK_PIXBUF(pixbuf)); | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
64 |
2604 | 65 if (strcmp(DATA_DIR "/images/audio.png", text)) |
66 { | |
67 if (width == 0) | |
68 width = 1; | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
69 |
2604 | 70 aspect = (double)height / (double)width; |
71 if (aspect > 1.0) { | |
72 height = (int)(cfg.filepopup_pixelsize * aspect); | |
73 width = cfg.filepopup_pixelsize; | |
74 } else { | |
75 height = cfg.filepopup_pixelsize; | |
76 width = (int)(cfg.filepopup_pixelsize / aspect); | |
77 } | |
78 | |
79 pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), width, height, | |
80 GDK_INTERP_BILINEAR); | |
81 g_object_unref(G_OBJECT(pixbuf)); | |
82 pixbuf = pixbuf2; | |
83 } | |
84 | |
85 gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf)); | |
86 g_object_unref(G_OBJECT(pixbuf)); | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
87 } |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
88 |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
89 static gboolean |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
90 fileinfopopup_progress_cb(gpointer filepopup_win) |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
91 { |
2604 | 92 GtkWidget *progressbar = |
93 g_object_get_data(G_OBJECT(filepopup_win), "progressbar"); | |
94 gchar *tooltip_file = g_object_get_data(G_OBJECT(filepopup_win), "file"); | |
3373
706e85734317
progress bar for fileinfopopup lives again
Giacomo Lozito <james@develia.org>
parents:
3298
diff
changeset
|
95 gchar *current_file_u, *current_file; |
2604 | 96 Playlist *pl; |
97 gint length = | |
98 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(filepopup_win), "length")); | |
99 gint pos, time; | |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
100 |
2604 | 101 g_return_val_if_fail(progressbar != NULL, FALSE); |
2484
adc63272c9ff
[svn] - add some debugging assertions to this code
nenolod
parents:
2442
diff
changeset
|
102 |
2604 | 103 pl = playlist_get_active(); |
104 g_return_val_if_fail(pl != NULL, FALSE); | |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
105 |
2604 | 106 pos = playlist_get_position(pl); |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
107 |
3373
706e85734317
progress bar for fileinfopopup lives again
Giacomo Lozito <james@develia.org>
parents:
3298
diff
changeset
|
108 current_file_u = playlist_get_filename(pl , pos); |
706e85734317
progress bar for fileinfopopup lives again
Giacomo Lozito <james@develia.org>
parents:
3298
diff
changeset
|
109 g_return_val_if_fail(current_file_u != NULL, FALSE); |
706e85734317
progress bar for fileinfopopup lives again
Giacomo Lozito <james@develia.org>
parents:
3298
diff
changeset
|
110 current_file = g_filename_from_uri(current_file_u, NULL, NULL); |
2484
adc63272c9ff
[svn] - add some debugging assertions to this code
nenolod
parents:
2442
diff
changeset
|
111 |
3134
10c42e059460
prevent playback_get_time: assertion playback_get_playing() failed
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
112 if (playback_get_playing() && length != -1 && |
2604 | 113 current_file != NULL && tooltip_file != NULL && |
114 !strcmp(tooltip_file, current_file) && cfg.filepopup_showprogressbar) | |
115 { | |
3134
10c42e059460
prevent playback_get_time: assertion playback_get_playing() failed
Tomasz Mon <desowin@gmail.com>
parents:
3123
diff
changeset
|
116 time = playback_get_time(); |
2604 | 117 gchar *progress_time = |
118 g_strdup_printf("%d:%02d", time / 60000, (time / 1000) % 60); | |
119 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar), | |
120 (gdouble)time / (gdouble)length); | |
121 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progressbar), progress_time); | |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
122 |
2604 | 123 if (!GTK_WIDGET_VISIBLE(progressbar)) |
124 gtk_widget_show(progressbar); | |
125 | |
126 g_free(progress_time); | |
127 } | |
128 else | |
129 { | |
130 /* tooltip opened, but song is not the same, | |
131 * or playback is stopped, or length is not applicabile */ | |
132 if (GTK_WIDGET_VISIBLE(progressbar)) | |
133 gtk_widget_hide(progressbar); | |
134 } | |
135 | |
3373
706e85734317
progress bar for fileinfopopup lives again
Giacomo Lozito <james@develia.org>
parents:
3298
diff
changeset
|
136 g_free( current_file ); |
2604 | 137 return TRUE; |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
138 } |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
139 |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
140 static gboolean |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
141 fileinfopopup_progress_check_active(GtkWidget *filepopup_win) |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
142 { |
2610
2c41c0ef0c36
[svn] - made progress bar in fileinfo popup work again; it's ok to do code cleaning/beautifying but please, do ensure and test that things work as they should
giacomo
parents:
2608
diff
changeset
|
143 if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(filepopup_win),"progress_sid")) == 0) |
2604 | 144 return FALSE; |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
145 return TRUE; |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
146 } |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
147 |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
148 static void |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
149 fileinfopopup_progress_init(GtkWidget *filepopup_win) |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
150 { |
2610
2c41c0ef0c36
[svn] - made progress bar in fileinfo popup work again; it's ok to do code cleaning/beautifying but please, do ensure and test that things work as they should
giacomo
parents:
2608
diff
changeset
|
151 g_object_set_data( G_OBJECT(filepopup_win) , "progress_sid" , GINT_TO_POINTER(0) ); |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
152 } |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
153 |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
154 static void |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
155 fileinfopopup_progress_start(GtkWidget *filepopup_win) |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
156 { |
2604 | 157 gint sid = |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
158 g_timeout_add(500, (GSourceFunc)fileinfopopup_progress_cb, |
2604 | 159 filepopup_win); |
160 g_object_set_data(G_OBJECT(filepopup_win), "progress_sid", | |
161 GINT_TO_POINTER(sid)); | |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
162 } |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
163 |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
164 static void |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
165 fileinfopopup_progress_stop(GtkWidget *filepopup_win) |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
166 { |
2604 | 167 gint sid = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(filepopup_win), |
168 "progress_sid")); | |
169 if (sid != 0) | |
170 { | |
171 g_source_remove(sid); | |
2610
2c41c0ef0c36
[svn] - made progress bar in fileinfo popup work again; it's ok to do code cleaning/beautifying but please, do ensure and test that things work as they should
giacomo
parents:
2608
diff
changeset
|
172 g_object_set_data(G_OBJECT(filepopup_win),"progress_sid",GINT_TO_POINTER(0)); |
2604 | 173 } |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
174 } |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
175 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
176 static void |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
177 fileinfopopup_add_category(GtkWidget *filepopup_win, |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
178 GtkWidget *filepopup_data_table, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
179 const gchar *category, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
180 const gchar *header_data, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
181 const gchar *label_data, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
182 const gint position) |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
183 { |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
184 gchar *markup; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
185 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
186 GtkWidget *filepopup_data_info_header = gtk_label_new(""); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
187 GtkWidget *filepopup_data_info_label = gtk_label_new(""); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
188 gtk_misc_set_alignment(GTK_MISC(filepopup_data_info_header), 0, 0.5); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
189 gtk_misc_set_alignment(GTK_MISC(filepopup_data_info_label), 0, 0.5); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
190 gtk_misc_set_padding(GTK_MISC(filepopup_data_info_header), 0, 3); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
191 gtk_misc_set_padding(GTK_MISC(filepopup_data_info_label), 0, 3); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
192 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
193 markup = |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
194 g_markup_printf_escaped("<span style=\"italic\">%s</span>", category); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
195 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
196 gtk_label_set_markup(GTK_LABEL(filepopup_data_info_header), markup); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
197 g_free(markup); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
198 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
199 g_object_set_data(G_OBJECT(filepopup_win), header_data, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
200 filepopup_data_info_header); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
201 g_object_set_data(G_OBJECT(filepopup_win), label_data, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
202 filepopup_data_info_label); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
203 gtk_table_attach(GTK_TABLE(filepopup_data_table), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
204 filepopup_data_info_header, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
205 0, 1, position, position + 1, GTK_FILL, 0, 0, 0); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
206 gtk_table_attach(GTK_TABLE(filepopup_data_table), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
207 filepopup_data_info_label, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
208 1, 2, position, position + 1, GTK_FILL, 0, 0, 0); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
209 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
210 |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
211 |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
212 |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
213 GtkWidget * |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
214 fileinfopopup_create(void) |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
215 { |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
216 GtkWidget *filepopup_win; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
217 GtkWidget *filepopup_hbox; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
218 GtkWidget *filepopup_data_image; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
219 GtkWidget *filepopup_data_table; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
220 GtkWidget *filepopup_progress; |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
221 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
222 filepopup_win = gtk_window_new(GTK_WINDOW_POPUP); |
3896
e794ae16017e
Add missing gtk_window_set_type_hint.
Jonathan Schleifer <js-audacious@webkeks.org>
parents:
3755
diff
changeset
|
223 gtk_window_set_type_hint(GTK_WINDOW(filepopup_win), |
e794ae16017e
Add missing gtk_window_set_type_hint.
Jonathan Schleifer <js-audacious@webkeks.org>
parents:
3755
diff
changeset
|
224 GDK_WINDOW_TYPE_HINT_TOOLTIP); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
225 gtk_window_set_decorated(GTK_WINDOW(filepopup_win), FALSE); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
226 gtk_container_set_border_width(GTK_CONTAINER(filepopup_win), 6); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
227 gtk_window_set_transient_for(GTK_WINDOW(filepopup_win), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
228 GTK_WINDOW(mainwin)); |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
229 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
230 filepopup_hbox = gtk_hbox_new(FALSE, 0); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
231 gtk_container_add(GTK_CONTAINER(filepopup_win), filepopup_hbox); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
232 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
233 filepopup_data_image = gtk_image_new(); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
234 gtk_misc_set_alignment(GTK_MISC(filepopup_data_image), 0.5, 0); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
235 gtk_image_set_from_file(GTK_IMAGE(filepopup_data_image), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
236 DATA_DIR "/images/audio.png"); |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
237 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
238 g_object_set_data(G_OBJECT(filepopup_win), "image_artwork", |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
239 filepopup_data_image); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
240 g_object_set_data(G_OBJECT(filepopup_win), "last_artwork", NULL); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
241 gtk_box_pack_start(GTK_BOX(filepopup_hbox), filepopup_data_image, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
242 FALSE, FALSE, 0); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
243 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
244 gtk_box_pack_start(GTK_BOX(filepopup_hbox), gtk_vseparator_new(), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
245 FALSE, FALSE, 6); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
246 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
247 filepopup_data_table = gtk_table_new(8, 2, FALSE); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
248 gtk_table_set_row_spacings(GTK_TABLE(filepopup_data_table), 0); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
249 gtk_table_set_col_spacings(GTK_TABLE(filepopup_data_table), 6); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
250 gtk_box_pack_start(GTK_BOX(filepopup_hbox), filepopup_data_table, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
251 TRUE, TRUE, 0); |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
252 |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
253 fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
254 _("Title"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
255 "header_title", "label_title", 0); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
256 fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
257 _("Artist"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
258 "header_artist", "label_artist", 1); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
259 fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
260 _("Album"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
261 "header_album", "label_album", 2); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
262 fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
263 _("Genre"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
264 "header_genre", "label_genre", 3); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
265 fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
266 _("Year"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
267 "header_year", "label_year", 4); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
268 fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
269 _("Track Number"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
270 "header_tracknum", "label_tracknum", |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
271 5); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
272 fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
273 _("Track Length"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
274 "header_tracklen", "label_tracklen", |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
275 6); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
276 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
277 gtk_table_set_row_spacing(GTK_TABLE(filepopup_data_table), 6, 6); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
278 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
279 /* track progress */ |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
280 filepopup_progress = gtk_progress_bar_new(); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
281 gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(filepopup_progress), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
282 GTK_PROGRESS_LEFT_TO_RIGHT); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
283 gtk_progress_bar_set_text(GTK_PROGRESS_BAR(filepopup_progress), ""); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
284 gtk_table_attach(GTK_TABLE(filepopup_data_table), filepopup_progress, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
285 0, 2, 7, 8, GTK_FILL, 0, 0, 0); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
286 g_object_set_data(G_OBJECT(filepopup_win), "file", NULL); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
287 g_object_set_data(G_OBJECT(filepopup_win), "progressbar", |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
288 filepopup_progress); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
289 fileinfopopup_progress_init(filepopup_win); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
290 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
291 /* this will realize all widgets contained in filepopup_hbox */ |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
292 gtk_widget_show_all(filepopup_hbox); |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
293 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
294 /* do not show the track progress */ |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
295 gtk_widget_hide(filepopup_progress); |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
296 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
297 return filepopup_win; |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
298 } |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
299 |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
300 void |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
301 fileinfopopup_destroy(GtkWidget *filepopup_win) |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
302 { |
2656
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
303 gchar *last_artwork; |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
304 fileinfopopup_progress_stop(filepopup_win); |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
305 |
2656
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
306 last_artwork = |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
307 g_object_get_data(G_OBJECT(filepopup_win), "last_artwork"); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
308 if (last_artwork != NULL) |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
309 g_free(last_artwork); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
310 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
311 gtk_widget_destroy(filepopup_win); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
312 } |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
313 |
2608 | 314 static void |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
315 fileinfopupup_update_data(GtkWidget *filepopup_win, |
2608 | 316 const gchar *text, |
317 const gchar *label_data, | |
318 const gchar *header_data) | |
319 { | |
320 if (text != NULL) | |
321 { | |
322 filepopup_entry_set_text(filepopup_win, label_data, text); | |
323 gtk_widget_show(GTK_WIDGET(g_object_get_data(G_OBJECT(filepopup_win), header_data))); | |
324 gtk_widget_show(GTK_WIDGET(g_object_get_data(G_OBJECT(filepopup_win), label_data))); | |
325 } | |
326 else | |
327 { | |
328 gtk_widget_hide(GTK_WIDGET(g_object_get_data(G_OBJECT(filepopup_win), header_data))); | |
329 gtk_widget_hide(GTK_WIDGET(g_object_get_data(G_OBJECT(filepopup_win), label_data))); | |
330 } | |
331 } | |
332 | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
333 void |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
334 fileinfopopup_show_from_tuple(GtkWidget *filepopup_win, |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3272
diff
changeset
|
335 Tuple *tuple) |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
336 { |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
337 gchar *tmp = NULL; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
338 gint x, y, x_off = 3, y_off = 3, h, w; |
2656
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
339 gchar *length_string, *year_string, *track_string; |
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
340 gchar *last_artwork; |
2657
dd5f6197e18f
[svn] - fixed c++ish declaration in a c file (part 4)
giacomo
parents:
2656
diff
changeset
|
341 const static gchar default_artwork[] = DATA_DIR "/images/audio.png"; |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3272
diff
changeset
|
342 gint length; |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
343 |
2656
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
344 last_artwork = |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
345 g_object_get_data(G_OBJECT(filepopup_win), "last_artwork"); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
346 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
347 g_return_if_fail(tuple != NULL); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
348 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
349 tmp = g_object_get_data(G_OBJECT(filepopup_win), "file"); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
350 if (tmp != NULL) { |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
351 g_free(tmp); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
352 tmp = NULL; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
353 g_object_set_data(G_OBJECT(filepopup_win), "file", NULL); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
354 } |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
355 if (tuple_get_string(tuple, FIELD_FILE_PATH, NULL) && tuple_get_string(tuple, FIELD_FILE_NAME, NULL)) |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
356 g_object_set_data(G_OBJECT(filepopup_win), "file", |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
357 g_build_filename(tuple_get_string(tuple, FIELD_FILE_PATH, NULL), |
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
358 tuple_get_string(tuple, FIELD_FILE_NAME, NULL), |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
359 NULL)); |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
360 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
361 gtk_widget_realize(filepopup_win); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
362 |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
363 if (tuple_get_string(tuple, FIELD_TITLE, NULL)) |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
364 { |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
365 gchar *markup = |
2608 | 366 g_markup_printf_escaped("<span style=\"italic\">%s</span>", _("Title")); |
367 gtk_label_set_markup(GTK_LABEL(g_object_get_data(G_OBJECT(filepopup_win), "header_title")), markup); | |
368 g_free(markup); | |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
369 filepopup_entry_set_text(filepopup_win, "label_title", tuple_get_string(tuple, FIELD_TITLE, NULL)); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
370 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
371 else |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
372 { |
2608 | 373 /* display filename if track_name is not available */ |
374 gchar *markup = | |
375 g_markup_printf_escaped("<span style=\"italic\">%s</span>", _("Filename")); | |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
376 gchar *utf_filename = filename_to_utf8(tuple_get_string(tuple, FIELD_FILE_NAME, NULL)); |
2608 | 377 gtk_label_set_markup(GTK_LABEL(g_object_get_data(G_OBJECT(filepopup_win), "header_title")), markup); |
378 g_free(markup); | |
379 filepopup_entry_set_text(filepopup_win, "label_title", utf_filename); | |
380 g_free(utf_filename); | |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
381 } |
2395
b047268eec32
[svn] - made the song info popup window a bit smarter; do not display missing information, display filename if title is missing; also, added a audacious_fileinfopopup_show_from_title to show a popup using a generic string (i.e. the one picked from playlist_get_songtitle when a tuple is not available, useful for http streams)
giacomo
parents:
2362
diff
changeset
|
382 |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
383 fileinfopupup_update_data(filepopup_win, tuple_get_string(tuple, FIELD_ARTIST, NULL), |
2608 | 384 "label_artist", "header_artist"); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
385 fileinfopupup_update_data(filepopup_win, tuple_get_string(tuple, FIELD_ALBUM, NULL), |
2608 | 386 "label_album", "header_album"); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
387 fileinfopupup_update_data(filepopup_win, tuple_get_string(tuple, FIELD_GENRE, NULL), |
2608 | 388 "label_genre", "header_genre"); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
389 |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
390 length = tuple_get_int(tuple, FIELD_LENGTH, NULL); |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3272
diff
changeset
|
391 length_string = (length > 0) ? |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3272
diff
changeset
|
392 g_strdup_printf("%d:%02d", length / 60000, (length / 1000) % 60) : NULL; |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
393 fileinfopupup_update_data(filepopup_win, length_string, |
2608 | 394 "label_tracklen", "header_tracklen"); |
395 g_free(length_string); | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
396 |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3272
diff
changeset
|
397 if ( length > 0 ) |
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3272
diff
changeset
|
398 g_object_set_data( G_OBJECT(filepopup_win), "length" , GINT_TO_POINTER(length) ); |
2610
2c41c0ef0c36
[svn] - made progress bar in fileinfo popup work again; it's ok to do code cleaning/beautifying but please, do ensure and test that things work as they should
giacomo
parents:
2608
diff
changeset
|
399 else |
2c41c0ef0c36
[svn] - made progress bar in fileinfo popup work again; it's ok to do code cleaning/beautifying but please, do ensure and test that things work as they should
giacomo
parents:
2608
diff
changeset
|
400 g_object_set_data( G_OBJECT(filepopup_win), "length" , GINT_TO_POINTER(-1) ); |
2c41c0ef0c36
[svn] - made progress bar in fileinfo popup work again; it's ok to do code cleaning/beautifying but please, do ensure and test that things work as they should
giacomo
parents:
2608
diff
changeset
|
401 |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
402 year_string = (tuple_get_int(tuple, FIELD_YEAR, NULL) == 0) ? NULL : g_strdup_printf("%d", tuple_get_int(tuple, FIELD_YEAR, NULL)); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
403 fileinfopupup_update_data(filepopup_win, year_string, |
2608 | 404 "label_year", "header_year"); |
405 g_free(year_string); | |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
406 |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
407 track_string = (tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL) == 0) ? NULL : g_strdup_printf("%d", tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL)); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
408 fileinfopupup_update_data(filepopup_win, track_string, |
2608 | 409 "label_tracknum", "header_tracknum"); |
410 g_free(track_string); | |
411 | |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
412 if (tuple_get_string(tuple, FIELD_FILE_NAME, NULL) && tuple_get_string(tuple, FIELD_FILE_PATH, NULL)) { |
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
413 tmp = fileinfo_recursive_get_image(tuple_get_string(tuple, FIELD_FILE_PATH, NULL), tuple_get_string(tuple, FIELD_FILE_NAME, NULL), 0); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
414 if (tmp) { // picture found |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
415 if (!last_artwork || strcmp(last_artwork, tmp)) { // new picture |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
416 filepopup_entry_set_image(filepopup_win, "image_artwork", tmp); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
417 if (last_artwork) g_free(last_artwork); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
418 last_artwork = tmp; |
2608 | 419 g_object_set_data(G_OBJECT(filepopup_win), "last_artwork", last_artwork); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
420 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
421 else { // same picture |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
422 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
423 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
424 else { // no picture found |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
425 if (!last_artwork || strcmp(last_artwork, default_artwork)) { |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
426 filepopup_entry_set_image(filepopup_win, "image_artwork", default_artwork); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
427 if (last_artwork) g_free(last_artwork); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
428 last_artwork = g_strdup(default_artwork); |
2608 | 429 g_object_set_data(G_OBJECT(filepopup_win), "last_artwork", last_artwork); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
430 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
431 else { |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
432 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
433 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
434 } |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
435 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
436 /* start a timer that updates a progress bar if the tooltip |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
437 is shown for the song that is being currently played */ |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
438 if (fileinfopopup_progress_check_active(filepopup_win) == FALSE) |
2608 | 439 { |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
440 fileinfopopup_progress_start(filepopup_win); |
2608 | 441 /* immediately run the callback once to update progressbar status */ |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
442 fileinfopopup_progress_cb(filepopup_win); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
443 } |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
444 |
2613
0280eb67fd5d
[svn] - use gdk_get_default_root_window in place of NULL for gdk_window_get_pointer
giacomo
parents:
2610
diff
changeset
|
445 gdk_window_get_pointer(gdk_get_default_root_window(), &x, &y, NULL); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
446 gtk_window_get_size(GTK_WINDOW(filepopup_win), &w, &h); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
447 if (gdk_screen_width()-(w+3) < x) x_off = (w*-1)-3; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
448 if (gdk_screen_height()-(h+3) < y) y_off = (h*-1)-3; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
449 gtk_window_move(GTK_WINDOW(filepopup_win), x + x_off, y + y_off); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
450 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
451 gtk_widget_show(filepopup_win); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
452 } |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
453 |
2395
b047268eec32
[svn] - made the song info popup window a bit smarter; do not display missing information, display filename if title is missing; also, added a audacious_fileinfopopup_show_from_title to show a popup using a generic string (i.e. the one picked from playlist_get_songtitle when a tuple is not available, useful for http streams)
giacomo
parents:
2362
diff
changeset
|
454 void |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
455 fileinfopopup_show_from_title(GtkWidget *filepopup_win, gchar *title) |
2395
b047268eec32
[svn] - made the song info popup window a bit smarter; do not display missing information, display filename if title is missing; also, added a audacious_fileinfopopup_show_from_title to show a popup using a generic string (i.e. the one picked from playlist_get_songtitle when a tuple is not available, useful for http streams)
giacomo
parents:
2362
diff
changeset
|
456 { |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3272
diff
changeset
|
457 Tuple * tuple = tuple_new(); |
3490
602ec8c40d0d
Fixed to comply with the Tuple API changes.
Matti Hamalainen <ccr@tnsp.org>
parents:
3373
diff
changeset
|
458 tuple_associate_string(tuple, FIELD_TITLE, NULL, title); |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
459 fileinfopopup_show_from_tuple(filepopup_win, tuple); |
3298
f985357757e0
audacious-core: convert to tuple-ng, remove titlestring API.
William Pitcock <nenolod@atheme-project.org>
parents:
3272
diff
changeset
|
460 mowgli_object_unref(tuple); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
461 return; |
2395
b047268eec32
[svn] - made the song info popup window a bit smarter; do not display missing information, display filename if title is missing; also, added a audacious_fileinfopopup_show_from_title to show a popup using a generic string (i.e. the one picked from playlist_get_songtitle when a tuple is not available, useful for http streams)
giacomo
parents:
2362
diff
changeset
|
462 } |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
463 |
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
464 void |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
465 fileinfopopup_hide(GtkWidget *filepopup_win, gpointer unused) |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
466 { |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
467 if (GTK_WIDGET_VISIBLE(filepopup_win)) |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
468 { |
3755
2ca446f02d97
export the fileinfopopup API.
William Pitcock <nenolod@atheme.org>
parents:
3490
diff
changeset
|
469 fileinfopopup_progress_stop(filepopup_win); |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
470 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
471 gtk_widget_hide(filepopup_win); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
472 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
473 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_title", ""); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
474 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_artist", ""); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
475 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_album", ""); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
476 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_genre", ""); |
3272
7b26c3c5e362
resolve CRITICAL **: filepopup_entry_set_text: assertion 'widget != NULL' failed
Tomasz Mon <desowin@gmail.com>
parents:
3134
diff
changeset
|
477 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_tracknum", ""); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
478 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_year", ""); |
3272
7b26c3c5e362
resolve CRITICAL **: filepopup_entry_set_text: assertion 'widget != NULL' failed
Tomasz Mon <desowin@gmail.com>
parents:
3134
diff
changeset
|
479 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_tracklen", ""); |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
480 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
481 gtk_window_resize(GTK_WINDOW(filepopup_win), 1, 1); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
482 } |
2348
564e8a1fe09a
[svn] - made a public API for fileinfopopup (popup that displays metadata, the same used in playlist); now plugins can include ui_fileinfopopup.h to display metadata popups (i.e. statusicon and libnotify plugins)
giacomo
parents:
diff
changeset
|
483 } |