Mercurial > audlegacy
changeset 1283:19b1d3f22e10 trunk
[svn] - when hovering over a playlist tuple, describe the tuple via a tooltip-like popup
author | nenolod |
---|---|
date | Sat, 17 Jun 2006 20:30:31 -0700 |
parents | e80a7a0b1065 |
children | 13d5b542f4fd |
files | audacious/glade/Makefile audacious/glade/fileinfo_popup.glade audacious/main.c audacious/ui_fileinfo.c audacious/ui_fileinfo.h |
diffstat | 5 files changed, 327 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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)
--- /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 @@ +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> +<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> + +<glade-interface> + +<widget class="GtkWindow" id="win_pl_popup"> + <property name="border_width">6</property> + <property name="title" translatable="yes">Artist Popup</property> + <property name="type">GTK_WINDOW_POPUP</property> + <property name="window_position">GTK_WIN_POS_NONE</property> + <property name="modal">False</property> + <property name="resizable">True</property> + <property name="destroy_with_parent">False</property> + <property name="decorated">False</property> + <property name="skip_taskbar_hint">False</property> + <property name="skip_pager_hint">False</property> + <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> + <property name="gravity">GDK_GRAVITY_CENTER</property> + <property name="focus_on_map">True</property> + <property name="urgency_hint">False</property> + + <child> + <widget class="GtkTable" id="table1"> + <property name="visible">True</property> + <property name="n_rows">3</property> + <property name="n_columns">2</property> + <property name="homogeneous">False</property> + <property name="row_spacing">3</property> + <property name="column_spacing">3</property> + + <child> + <widget class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="label" translatable="yes"><i>Title</i></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="label" translatable="yes"><i>Artist</i></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="label" translatable="yes"><i>Album</i></property> + <property name="use_underline">False</property> + <property name="use_markup">True</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">0</property> + <property name="right_attach">1</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label_title"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">0</property> + <property name="bottom_attach">1</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label_artist"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">1</property> + <property name="bottom_attach">2</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label_album"> + <property name="visible">True</property> + <property name="label" translatable="yes"></property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property> + <property name="width_chars">-1</property> + <property name="single_line_mode">False</property> + <property name="angle">0</property> + </widget> + <packing> + <property name="left_attach">1</property> + <property name="right_attach">2</property> + <property name="top_attach">2</property> + <property name="bottom_attach">3</property> + <property name="x_options">fill</property> + <property name="y_options"></property> + </packing> + </child> + </widget> + </child> +</widget> + +</glade-interface>
--- 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);
--- 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);
--- 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