# HG changeset patch # User nenolod # Date 1150601431 25200 # Node ID 19b1d3f22e10218ce36af3889641db79020cde13 # Parent e80a7a0b1065177107e381c1a1413f950a4f8b5b [svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup diff -r e80a7a0b1065 -r 19b1d3f22e10 audacious/glade/Makefile --- a/audacious/glade/Makefile Sat Jun 17 19:50:11 2006 -0700 +++ b/audacious/glade/Makefile Sat Jun 17 20:30:31 2006 -0700 @@ -5,5 +5,6 @@ OBJECTIVE_DATA = \ fileinfo.glade:$(gladexmldir) \ + fileinfo_popup.glade:$(gladexmldir) \ prefswin.glade:$(gladexmldir) \ addfiles.glade:$(gladexmldir) diff -r e80a7a0b1065 -r 19b1d3f22e10 audacious/glade/fileinfo_popup.glade --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/audacious/glade/fileinfo_popup.glade Sat Jun 17 20:30:31 2006 -0700 @@ -0,0 +1,202 @@ + + + + + + + 6 + Artist Popup + GTK_WINDOW_POPUP + GTK_WIN_POS_NONE + False + True + False + False + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_CENTER + True + False + + + + True + 3 + 2 + False + 3 + 3 + + + + True + <i>Title</i> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + <i>Artist</i> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + <i>Album</i> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 0 + 1 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 1 + 2 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 2 + 3 + fill + + + + + + + + diff -r e80a7a0b1065 -r 19b1d3f22e10 audacious/main.c --- a/audacious/main.c Sat Jun 17 19:50:11 2006 -0700 +++ b/audacious/main.c Sat Jun 17 20:30:31 2006 -0700 @@ -1077,6 +1077,7 @@ create_prefs_window(); create_fileinfo_window(); + create_filepopup_window(); if (cfg.player_visible) mainwin_show(TRUE); diff -r e80a7a0b1065 -r 19b1d3f22e10 audacious/ui_fileinfo.c --- a/audacious/ui_fileinfo.c Sat Jun 17 19:50:11 2006 -0700 +++ b/audacious/ui_fileinfo.c Sat Jun 17 20:30:31 2006 -0700 @@ -54,6 +54,8 @@ #include "libaudacious/configdb.h" #include "libaudacious/titlestring.h" +#include "playlist.h" + #include "mainwin.h" #include "ui_playlist.h" #include "skinwin.h" @@ -62,6 +64,7 @@ #include "ui_fileinfo.h" GtkWidget *fileinfo_win; +GtkWidget *filepopup_win; static void fileinfo_entry_set_text(const char *entry, const char *text) @@ -89,6 +92,74 @@ g_free(text); } +static void +filepopup_entry_set_text(const char *entry, const char *text) +{ + GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml"); + GtkWidget *widget = glade_xml_get_widget(xml, entry); + + if (xml == NULL || widget == NULL) + return; + + gtk_label_set_text(GTK_LABEL(widget), text); +} + +#if 0 +static void +filepopup_entry_set_text_free(const char *entry, char *text) +{ + GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml"); + GtkWidget *widget = glade_xml_get_widget(xml, entry); + + if (xml == NULL || widget == NULL) + return; + + gtk_label_set_text(GTK_LABEL(widget), text); + + g_free(text); +} +#endif + +static gboolean +filepopup_pointer_check_iter(gpointer unused) +{ + gint x, y, pos; + TitleInput *tuple; + static gint prev_x = 0, prev_y = 0, ctr = 0; + + gdk_window_get_pointer(playlistwin->window, &x, &y, NULL); + + if (prev_x == x && prev_y == y) + ctr++; + else + { + ctr = 0; + prev_x = x; + prev_y = y; + filepopup_hide(NULL); + return TRUE; + } + + if (ctr >= 20) + { + pos = playlist_list_get_playlist_position(playlistwin_list, x, y); + + if (pos == -1) + { + filepopup_hide(NULL); + return TRUE; + } + + tuple = playlist_get_tuple(pos); + + gdk_window_get_pointer(NULL, &x, &y, NULL); + filepopup_show_for_tuple(tuple); + gtk_window_move(GTK_WINDOW(filepopup_win), x + 3, y + 3); + } + + return TRUE; +} + void fileinfo_hide(gpointer unused) { gtk_widget_hide(fileinfo_win); @@ -104,6 +175,15 @@ fileinfo_entry_set_text("entry_location", ""); } +void filepopup_hide(gpointer unused) +{ + gtk_widget_hide(filepopup_win); + + filepopup_entry_set_text("label_title", ""); + filepopup_entry_set_text("label_artist", ""); + filepopup_entry_set_text("label_album", ""); +} + void create_fileinfo_window(void) { @@ -127,6 +207,30 @@ } void +create_filepopup_window(void) +{ + const gchar *glade_file = DATA_DIR "/glade/fileinfo_popup.glade"; + GladeXML *xml; +#if 0 + GtkWidget *widget; +#endif + xml = glade_xml_new_or_die(_("Track Information Popup"), glade_file, NULL, NULL); + + glade_xml_signal_autoconnect(xml); + + filepopup_win = glade_xml_get_widget(xml, "win_pl_popup"); + g_object_set_data(G_OBJECT(filepopup_win), "glade-xml", xml); + gtk_window_set_transient_for(GTK_WINDOW(filepopup_win), GTK_WINDOW(mainwin)); + +#if 0 + widget = glade_xml_get_widget(xml, "image_artwork"); + gtk_image_set_from_file(GTK_IMAGE(widget), DATA_DIR "/images/audio.png"); +#endif + + g_timeout_add(50, filepopup_pointer_check_iter, NULL); +} + +void fileinfo_show_for_tuple(TitleInput *tuple) { if (tuple == NULL) @@ -151,6 +255,21 @@ } void +filepopup_show_for_tuple(TitleInput *tuple) +{ + if (tuple == NULL) + return; + + gtk_widget_realize(filepopup_win); + + filepopup_entry_set_text("label_title", tuple->track_name); + filepopup_entry_set_text("label_artist", tuple->performer); + filepopup_entry_set_text("label_album", tuple->album_name); + + gtk_widget_show(filepopup_win); +} + +void fileinfo_show_for_path(gchar *path) { TitleInput *tuple = input_get_song_tuple(path); diff -r e80a7a0b1065 -r 19b1d3f22e10 audacious/ui_fileinfo.h --- a/audacious/ui_fileinfo.h Sat Jun 17 19:50:11 2006 -0700 +++ b/audacious/ui_fileinfo.h Sat Jun 17 20:30:31 2006 -0700 @@ -22,7 +22,11 @@ #define _UI_FILEINFO_H_ void create_fileinfo_window(void); +void create_filepopup_window(void); void fileinfo_show_for_tuple(TitleInput *tuple); +void filepopup_show_for_tuple(TitleInput *tuple); void fileinfo_show_for_path(gchar *path); +void filepopup_hide(gpointer unused); + #endif