Mercurial > audlegacy
annotate src/audacious/ui_fileinfopopup.c @ 2862:7dad846ec699 trunk
BSD relicensing (pass 3).
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Sat, 23 Jun 2007 22:38:15 -0500 |
parents | dd5f6197e18f |
children | 062324422c40 |
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 /* |
2862
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
2 * audacious: Cross-platform multimedia player. |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
3 * ui_fileinfopopup.c: UI for viewing tuple metadata for files. |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
4 * |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
5 * Copyright (c) 2005-2007 Audacious development team. |
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
|
6 * |
2862
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
7 * Redistribution and use in source and binary forms, with or without |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
8 * modification, are permitted provided that the following conditions are |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
9 * met: |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
10 * |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
11 * 1. Redistributions of source code must retain the above copyright notice, |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
12 * this list of conditions and the following disclaimer. |
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
|
13 * |
2862
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
14 * 2. Redistributions in binary form must reproduce the above copyright |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
15 * notice, this list of conditions and the following disclaimer in the |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
16 * documentation and/or other materials provided with the distribution. |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
17 * |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
18 * 3. The name of the author may not be used to endorse or promote products |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
19 * derived from this software without specific prior written permission. |
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 * |
2862
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
24 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
25 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
26 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
27 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
29 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
30 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
7dad846ec699
BSD relicensing (pass 3).
William Pitcock <nenolod@atheme.org>
parents:
2657
diff
changeset
|
31 * POSSIBILITY OF SUCH DAMAGE. |
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
|
32 */ |
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
|
33 |
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
|
34 #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
|
35 # 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
|
36 #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
|
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 #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
|
39 #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
|
40 #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
|
41 #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
|
42 |
2604 | 43 #include "main.h" |
44 #include "playlist.h" | |
45 #include "playback.h" | |
46 #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
|
47 #include "titlestring.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
|
48 #include "ui_fileinfopopup.h" |
2604 | 49 #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
|
50 |
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 static void |
2604 | 52 filepopup_entry_set_text(GtkWidget *filepopup_win, const gchar *entry_name, |
53 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
|
54 { |
2604 | 55 GtkWidget *widget = g_object_get_data(G_OBJECT(filepopup_win), entry_name); |
56 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
|
57 |
2604 | 58 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
|
59 } |
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
|
60 |
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 static void |
2604 | 62 filepopup_entry_set_image(GtkWidget *filepopup_win, const gchar *entry_name, |
63 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
|
64 { |
2604 | 65 GtkWidget *widget = g_object_get_data(G_OBJECT(filepopup_win), entry_name); |
66 GdkPixbuf *pixbuf, *pixbuf2; | |
67 int width, height; | |
68 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
|
69 |
2604 | 70 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
|
71 |
2604 | 72 pixbuf = gdk_pixbuf_new_from_file(text, NULL); |
73 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
|
74 |
2604 | 75 width = gdk_pixbuf_get_width(GDK_PIXBUF(pixbuf)); |
76 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
|
77 |
2604 | 78 if (strcmp(DATA_DIR "/images/audio.png", text)) |
79 { | |
80 if (width == 0) | |
81 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
|
82 |
2604 | 83 aspect = (double)height / (double)width; |
84 if (aspect > 1.0) { | |
85 height = (int)(cfg.filepopup_pixelsize * aspect); | |
86 width = cfg.filepopup_pixelsize; | |
87 } else { | |
88 height = cfg.filepopup_pixelsize; | |
89 width = (int)(cfg.filepopup_pixelsize / aspect); | |
90 } | |
91 | |
92 pixbuf2 = gdk_pixbuf_scale_simple(GDK_PIXBUF(pixbuf), width, height, | |
93 GDK_INTERP_BILINEAR); | |
94 g_object_unref(G_OBJECT(pixbuf)); | |
95 pixbuf = pixbuf2; | |
96 } | |
97 | |
98 gtk_image_set_from_pixbuf(GTK_IMAGE(widget), GDK_PIXBUF(pixbuf)); | |
99 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
|
100 } |
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
|
101 |
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
|
102 static gboolean |
2604 | 103 audacious_fileinfopopup_progress_cb(gpointer filepopup_win) |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
104 { |
2604 | 105 GtkWidget *progressbar = |
106 g_object_get_data(G_OBJECT(filepopup_win), "progressbar"); | |
107 gchar *tooltip_file = g_object_get_data(G_OBJECT(filepopup_win), "file"); | |
108 gchar *current_file; | |
109 Playlist *pl; | |
110 gint length = | |
111 GPOINTER_TO_INT(g_object_get_data(G_OBJECT(filepopup_win), "length")); | |
112 gint pos, time; | |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
113 |
2604 | 114 g_return_val_if_fail(progressbar != NULL, FALSE); |
2484
adc63272c9ff
[svn] - add some debugging assertions to this code
nenolod
parents:
2442
diff
changeset
|
115 |
2604 | 116 pl = playlist_get_active(); |
117 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
|
118 |
2604 | 119 pos = playlist_get_position(pl); |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
120 |
2604 | 121 current_file = playlist_get_filename(pl , pos); |
122 time = playback_get_time(); | |
123 | |
124 g_return_val_if_fail(current_file != NULL, FALSE); | |
2484
adc63272c9ff
[svn] - add some debugging assertions to this code
nenolod
parents:
2442
diff
changeset
|
125 |
2604 | 126 if (time != -1 && length != -1 && |
127 current_file != NULL && tooltip_file != NULL && | |
128 !strcmp(tooltip_file, current_file) && cfg.filepopup_showprogressbar) | |
129 { | |
130 gchar *progress_time = | |
131 g_strdup_printf("%d:%02d", time / 60000, (time / 1000) % 60); | |
132 gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(progressbar), | |
133 (gdouble)time / (gdouble)length); | |
134 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
|
135 |
2604 | 136 if (!GTK_WIDGET_VISIBLE(progressbar)) |
137 gtk_widget_show(progressbar); | |
138 | |
139 g_free(progress_time); | |
140 } | |
141 else | |
142 { | |
143 /* tooltip opened, but song is not the same, | |
144 * or playback is stopped, or length is not applicabile */ | |
145 if (GTK_WIDGET_VISIBLE(progressbar)) | |
146 gtk_widget_hide(progressbar); | |
147 } | |
148 | |
149 return TRUE; | |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
150 } |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
151 |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
152 static gboolean |
2604 | 153 audacious_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
|
154 { |
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
|
155 if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(filepopup_win),"progress_sid")) == 0) |
2604 | 156 return FALSE; |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
157 return TRUE; |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
158 } |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
159 |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
160 static void |
2604 | 161 audacious_fileinfopopup_progress_init(GtkWidget *filepopup_win) |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
162 { |
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
|
163 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
|
164 } |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
165 |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
166 static void |
2604 | 167 audacious_fileinfopopup_progress_start(GtkWidget *filepopup_win) |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
168 { |
2604 | 169 gint sid = |
170 g_timeout_add(500, (GSourceFunc)audacious_fileinfopopup_progress_cb, | |
171 filepopup_win); | |
172 g_object_set_data(G_OBJECT(filepopup_win), "progress_sid", | |
173 GINT_TO_POINTER(sid)); | |
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 |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
176 static void |
2604 | 177 audacious_fileinfopopup_progress_stop(GtkWidget *filepopup_win) |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
178 { |
2604 | 179 gint sid = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(filepopup_win), |
180 "progress_sid")); | |
181 if (sid != 0) | |
182 { | |
183 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
|
184 g_object_set_data(G_OBJECT(filepopup_win),"progress_sid",GINT_TO_POINTER(0)); |
2604 | 185 } |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
186 } |
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
187 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
188 static void |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
189 audacious_fileinfopopup_add_category(GtkWidget *filepopup_win, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
190 GtkWidget *filepopup_data_table, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
191 const gchar *category, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
192 const gchar *header_data, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
193 const gchar *label_data, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
194 const gint position) |
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 gchar *markup; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
197 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
198 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
|
199 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
|
200 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
|
201 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
|
202 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
|
203 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
|
204 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
205 markup = |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
206 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
|
207 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
208 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
|
209 g_free(markup); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
210 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
211 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
|
212 filepopup_data_info_header); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
213 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
|
214 filepopup_data_info_label); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
215 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
|
216 filepopup_data_info_header, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
217 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
|
218 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
|
219 filepopup_data_info_label, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
220 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
|
221 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
222 |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
223 |
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
|
224 |
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
|
225 GtkWidget * |
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
|
226 audacious_fileinfopopup_create(void) |
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
|
227 { |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
228 GtkWidget *filepopup_win; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
229 GtkWidget *filepopup_hbox; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
230 GtkWidget *filepopup_data_image; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
231 GtkWidget *filepopup_data_table; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
232 GtkWidget *filepopup_progress; |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
233 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
234 filepopup_win = gtk_window_new(GTK_WINDOW_POPUP); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
235 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
|
236 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
|
237 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
|
238 GTK_WINDOW(mainwin)); |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
239 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
240 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
|
241 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
|
242 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
243 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
|
244 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
|
245 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
|
246 DATA_DIR "/images/audio.png"); |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
247 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
248 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
|
249 filepopup_data_image); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
250 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
|
251 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
|
252 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
|
253 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
254 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
|
255 FALSE, FALSE, 6); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
256 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
257 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
|
258 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
|
259 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
|
260 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
|
261 TRUE, TRUE, 0); |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
262 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
263 audacious_fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
264 _("Title"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
265 "header_title", "label_title", 0); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
266 audacious_fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
267 _("Artist"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
268 "header_artist", "label_artist", 1); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
269 audacious_fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
270 _("Album"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
271 "header_album", "label_album", 2); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
272 audacious_fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
273 _("Genre"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
274 "header_genre", "label_genre", 3); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
275 audacious_fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
276 _("Year"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
277 "header_year", "label_year", 4); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
278 audacious_fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
279 _("Track Number"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
280 "header_tracknum", "label_tracknum", |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
281 5); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
282 audacious_fileinfopopup_add_category(filepopup_win, filepopup_data_table, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
283 _("Track Length"), |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
284 "header_tracklen", "label_tracklen", |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
285 6); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
286 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
287 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
|
288 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
289 /* track progress */ |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
290 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
|
291 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
|
292 GTK_PROGRESS_LEFT_TO_RIGHT); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
293 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
|
294 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
|
295 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
|
296 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
|
297 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
|
298 filepopup_progress); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
299 audacious_fileinfopopup_progress_init(filepopup_win); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
300 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
301 /* 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
|
302 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
|
303 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
304 /* 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
|
305 gtk_widget_hide(filepopup_progress); |
2355
f03beaca8e81
[svn] - ui_fileinfopopup.c uses gtk code, no more glade in it
giacomo
parents:
2351
diff
changeset
|
306 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
307 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
|
308 } |
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
|
309 |
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
|
310 void |
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
|
311 audacious_fileinfopopup_destroy(GtkWidget *filepopup_win) |
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 { |
2656
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
313 gchar *last_artwork; |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
314 audacious_fileinfopopup_progress_stop(filepopup_win); |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
315 |
2656
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
316 last_artwork = |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
317 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
|
318 if (last_artwork != NULL) |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
319 g_free(last_artwork); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
320 |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
321 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
|
322 } |
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
|
323 |
2608 | 324 static void |
325 audacious_fileinfopupup_update_data(GtkWidget *filepopup_win, | |
326 const gchar *text, | |
327 const gchar *label_data, | |
328 const gchar *header_data) | |
329 { | |
330 if (text != NULL) | |
331 { | |
332 filepopup_entry_set_text(filepopup_win, label_data, text); | |
333 gtk_widget_show(GTK_WIDGET(g_object_get_data(G_OBJECT(filepopup_win), header_data))); | |
334 gtk_widget_show(GTK_WIDGET(g_object_get_data(G_OBJECT(filepopup_win), label_data))); | |
335 } | |
336 else | |
337 { | |
338 gtk_widget_hide(GTK_WIDGET(g_object_get_data(G_OBJECT(filepopup_win), header_data))); | |
339 gtk_widget_hide(GTK_WIDGET(g_object_get_data(G_OBJECT(filepopup_win), label_data))); | |
340 } | |
341 } | |
342 | |
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 void |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
344 audacious_fileinfopopup_show_from_tuple(GtkWidget *filepopup_win, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
345 TitleInput *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
|
346 { |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
347 gchar *tmp = NULL; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
348 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
|
349 gchar *length_string, *year_string, *track_string; |
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
350 gchar *last_artwork; |
2657
dd5f6197e18f
[svn] - fixed c++ish declaration in a c file (part 4)
giacomo
parents:
2656
diff
changeset
|
351 const static gchar default_artwork[] = DATA_DIR "/images/audio.png"; |
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
|
352 |
2656
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
353 last_artwork = |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
354 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
|
355 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
356 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
|
357 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
358 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
|
359 if (tmp != NULL) { |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
360 g_free(tmp); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
361 tmp = NULL; |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
362 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
|
363 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
364 if (tuple->file_path && tuple->file_name) |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
365 g_object_set_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
|
366 g_build_filename(tuple->file_path, tuple->file_name, |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
367 NULL)); |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
368 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
369 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
|
370 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
371 if (tuple->track_name != NULL) |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
372 { |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
373 gchar *markup = |
2608 | 374 g_markup_printf_escaped("<span style=\"italic\">%s</span>", _("Title")); |
375 gtk_label_set_markup(GTK_LABEL(g_object_get_data(G_OBJECT(filepopup_win), "header_title")), markup); | |
376 g_free(markup); | |
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
|
377 filepopup_entry_set_text(filepopup_win, "label_title", tuple->track_name); |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
378 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
379 else |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
380 { |
2608 | 381 /* display filename if track_name is not available */ |
382 gchar *markup = | |
383 g_markup_printf_escaped("<span style=\"italic\">%s</span>", _("Filename")); | |
384 gchar *utf_filename = filename_to_utf8(tuple->file_name); | |
385 gtk_label_set_markup(GTK_LABEL(g_object_get_data(G_OBJECT(filepopup_win), "header_title")), markup); | |
386 g_free(markup); | |
387 filepopup_entry_set_text(filepopup_win, "label_title", utf_filename); | |
388 g_free(utf_filename); | |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
389 } |
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
|
390 |
2608 | 391 audacious_fileinfopupup_update_data(filepopup_win, tuple->performer, |
392 "label_artist", "header_artist"); | |
393 audacious_fileinfopupup_update_data(filepopup_win, tuple->album_name, | |
394 "label_album", "header_album"); | |
395 audacious_fileinfopupup_update_data(filepopup_win, tuple->genre, | |
396 "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
|
397 |
2656
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
398 length_string = (tuple->length > 0) ? |
2608 | 399 g_strdup_printf("%d:%02d", tuple->length / 60000, (tuple->length / 1000) % 60) : NULL; |
400 audacious_fileinfopupup_update_data(filepopup_win, length_string, | |
401 "label_tracklen", "header_tracklen"); | |
402 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
|
403 |
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
|
404 if ( tuple->length > 0 ) |
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
|
405 g_object_set_data( G_OBJECT(filepopup_win), "length" , GINT_TO_POINTER(tuple->length) ); |
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
|
406 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
|
407 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
|
408 |
2656
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
409 year_string = (tuple->year == 0) ? NULL : g_strdup_printf("%d", tuple->year); |
2608 | 410 audacious_fileinfopupup_update_data(filepopup_win, year_string, |
411 "label_year", "header_year"); | |
412 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
|
413 |
2656
f6c8622ef240
[svn] - fixed c++ish declaration in a c file (part 3)
giacomo
parents:
2613
diff
changeset
|
414 track_string = (tuple->track_number == 0) ? NULL : g_strdup_printf("%d", tuple->track_number); |
2608 | 415 audacious_fileinfopupup_update_data(filepopup_win, track_string, |
416 "label_tracknum", "header_tracknum"); | |
417 g_free(track_string); | |
418 | |
419 if (tuple->file_path && tuple->file_name) | |
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 tmp = fileinfo_recursive_get_image(tuple->file_path, tuple->file_name, 0); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
422 if (tmp) { // picture found |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
423 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
|
424 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
|
425 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
|
426 last_artwork = tmp; |
2608 | 427 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
|
428 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
429 else { // same picture |
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 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
432 else { // no picture found |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
433 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
|
434 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
|
435 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
|
436 last_artwork = g_strdup(default_artwork); |
2608 | 437 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
|
438 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
439 else { |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
440 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
441 } |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
442 } |
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
|
443 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
444 /* 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
|
445 is shown for the song that is being currently played */ |
2608 | 446 if (audacious_fileinfopopup_progress_check_active(filepopup_win) == FALSE) |
447 { | |
448 audacious_fileinfopopup_progress_start(filepopup_win); | |
449 /* immediately run the callback once to update progressbar status */ | |
450 audacious_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
|
451 } |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
452 |
2613
0280eb67fd5d
[svn] - use gdk_get_default_root_window in place of NULL for gdk_window_get_pointer
giacomo
parents:
2610
diff
changeset
|
453 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
|
454 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
|
455 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
|
456 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
|
457 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
|
458 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
459 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
|
460 } |
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
|
461 |
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 void |
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
|
463 audacious_fileinfopopup_show_from_title(GtkWidget *filepopup_win, gchar *title) |
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
|
464 { |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
465 TitleInput * tuple = bmp_title_input_new(); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
466 tuple->track_name = g_strdup(title); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
467 audacious_fileinfopopup_show_from_tuple(filepopup_win, tuple); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
468 bmp_title_input_free(tuple); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
469 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
|
470 } |
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
|
471 |
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 void |
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
|
473 audacious_fileinfopopup_hide(GtkWidget *filepopup_win, gpointer unused) |
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
|
474 { |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
475 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
|
476 { |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
477 audacious_fileinfopopup_progress_stop(filepopup_win); |
2357
139d2358f617
[svn] - added progressbar with display of elapsed time for metadata tooltip
giacomo
parents:
2355
diff
changeset
|
478 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
479 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
|
480 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
481 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
|
482 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
|
483 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
|
484 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_genre", ""); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
485 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_track", ""); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
486 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_year", ""); |
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
487 filepopup_entry_set_text(GTK_WIDGET(filepopup_win), "label_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
|
488 |
2606
7c19bb5516db
[svn] - Removed some of the horrible code duplication in the file popup code
mf0102
parents:
2604
diff
changeset
|
489 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
|
490 } |
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
|
491 } |