# HG changeset patch # User giacomo # Date 1169050387 28800 # Node ID f03beaca8e8185a3316f3c7c75d3ee5ca73fe846 # Parent fea1b8594cd84983e7eb9f068fb743ba89393434 [svn] - ui_fileinfopopup.c uses gtk code, no more glade in it diff -r fea1b8594cd8 -r f03beaca8e81 ChangeLog --- a/ChangeLog Wed Jan 17 04:09:20 2007 -0800 +++ b/ChangeLog Wed Jan 17 08:13:07 2007 -0800 @@ -1,3 +1,10 @@ +2007-01-17 12:09:20 +0000 Giacomo Lozito + revision [3718] + - removed other obsolete (and annoying) gdk_window_set_hints calls + trunk/src/audacious/ui_main.c | 15 +++------------ + 1 file changed, 3 insertions(+), 12 deletions(-) + + 2007-01-17 11:11:48 +0000 Giacomo Lozito revision [3716] - added audacious_menu_main_show(x,y,button,time) in util.h, convenience function to display the audacious main popup menu diff -r fea1b8594cd8 -r f03beaca8e81 src/audacious/glade/Makefile --- a/src/audacious/glade/Makefile Wed Jan 17 04:09:20 2007 -0800 +++ b/src/audacious/glade/Makefile Wed Jan 17 08:13:07 2007 -0800 @@ -5,7 +5,6 @@ OBJECTIVE_DATA = \ fileinfo.glade:$(gladexmldir) \ - fileinfo_popup.glade:$(gladexmldir) \ prefswin.glade:$(gladexmldir) \ addfiles.glade:$(gladexmldir) diff -r fea1b8594cd8 -r f03beaca8e81 src/audacious/glade/fileinfo_popup.glade --- a/src/audacious/glade/fileinfo_popup.glade Wed Jan 17 04:09:20 2007 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,465 +0,0 @@ - - - - - - - 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 - False - 0 - - - - True - 0.5 - 0 - 0 - 0 - - - 0 - False - False - - - - - - True - - - 6 - False - False - - - - - - True - 7 - 2 - False - 6 - 6 - - - - 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 - - - - - - - True - <i>Genre</i> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 3 - 4 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 3 - 4 - fill - - - - - - - True - <i>Year</i> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 4 - 5 - fill - - - - - - - True - <i>Track Number</i> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 5 - 6 - fill - - - - - - - True - <i>Track Length</i> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 6 - 7 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 4 - 5 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 5 - 6 - fill - - - - - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 6 - 7 - fill - - - - - - 0 - True - True - - - - - - - diff -r fea1b8594cd8 -r f03beaca8e81 src/audacious/ui_fileinfopopup.c --- a/src/audacious/ui_fileinfopopup.c Wed Jan 17 04:09:20 2007 -0800 +++ b/src/audacious/ui_fileinfopopup.c Wed Jan 17 08:13:07 2007 -0800 @@ -25,10 +25,8 @@ #include #include #include -#include #include -#include "glade.h" #include "titlestring.h" #include "ui_fileinfopopup.h" #include "main.h" @@ -36,28 +34,26 @@ static void -filepopup_entry_set_text(GtkWidget *filepopup_win, const char *entry, const char *text) +filepopup_entry_set_text(GtkWidget *filepopup_win, const char *entry_name, const char *text) { - GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml"); - GtkWidget *widget = glade_xml_get_widget(xml, entry); + GtkWidget *widget = g_object_get_data(G_OBJECT(filepopup_win), entry_name); - if (xml == NULL || widget == NULL) - return; + if (widget == NULL) + return; - gtk_label_set_text(GTK_LABEL(widget), text); + gtk_label_set_text( GTK_LABEL(widget) , text ); } static void -filepopup_entry_set_image(GtkWidget *filepopup_win, const char *entry, const char *text) +filepopup_entry_set_image(GtkWidget *filepopup_win, const char *entry_name, const char *text) { - GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml"); - GtkWidget *widget = glade_xml_get_widget(xml, entry); + GtkWidget *widget = g_object_get_data(G_OBJECT(filepopup_win), entry_name); GdkPixbuf *pixbuf; int width, height; double aspect; GdkPixbuf *pixbuf2; - if (xml == NULL || widget == NULL) + if (widget == NULL) return; pixbuf = gdk_pixbuf_new_from_file(text, NULL); @@ -90,12 +86,11 @@ } static void -filepopup_entry_set_text_free(GtkWidget *filepopup_win, const char *entry, char *text) +filepopup_entry_set_text_free(GtkWidget *filepopup_win, const char *entry_name, char *text) { - GladeXML *xml = g_object_get_data(G_OBJECT(filepopup_win), "glade-xml"); - GtkWidget *widget = glade_xml_get_widget(xml, entry); + GtkWidget *widget = g_object_get_data(G_OBJECT(filepopup_win), entry_name); - if (xml == NULL || widget == NULL) + if (widget == NULL) return; gtk_label_set_text(GTK_LABEL(widget), text); @@ -268,34 +263,147 @@ GtkWidget * audacious_fileinfopopup_create(void) { - const gchar *glade_file = DATA_DIR "/glade/fileinfo_popup.glade"; - GladeXML *xml; - GtkWidget *widget; - GtkWidget *filepopup_win; + GtkWidget *filepopup_win; + GtkWidget *filepopup_hbox; + GtkWidget *filepopup_data_image; + GtkWidget *filepopup_data_table; + GtkWidget *filepopup_data_info_header[7]; + GtkWidget *filepopup_data_info_label[7]; + gchar *markup; + + filepopup_win = gtk_window_new( GTK_WINDOW_POPUP ); + gtk_window_set_decorated( GTK_WINDOW(filepopup_win), FALSE ); + gtk_container_set_border_width( GTK_CONTAINER(filepopup_win) , 6 ); + gtk_window_set_transient_for( GTK_WINDOW(filepopup_win) , GTK_WINDOW(mainwin) ); + + filepopup_hbox = gtk_hbox_new( FALSE , 0 ); + gtk_container_add( GTK_CONTAINER(filepopup_win) , filepopup_hbox ); + + filepopup_data_image = gtk_image_new(); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_image) , 0.5 , 0 ); + gtk_image_set_from_file( GTK_IMAGE(filepopup_data_image) , DATA_DIR "/images/audio.png" ); + g_object_set_data( G_OBJECT(filepopup_win) , "image_artwork" , filepopup_data_image ); + g_object_set_data( G_OBJECT(filepopup_win) , "last_artwork" , NULL ); + gtk_box_pack_start( GTK_BOX(filepopup_hbox) , filepopup_data_image , FALSE , FALSE , 0 ); + + gtk_box_pack_start( GTK_BOX(filepopup_hbox) , gtk_vseparator_new() , FALSE , FALSE , 6 ); - xml = glade_xml_new_or_die(_("Track Information Popup"), glade_file, NULL, NULL); + filepopup_data_table = gtk_table_new( 7 , 2 , FALSE ); + gtk_table_set_row_spacings( GTK_TABLE(filepopup_data_table) , 6 ); + gtk_table_set_col_spacings( GTK_TABLE(filepopup_data_table) , 6 ); + gtk_box_pack_start( GTK_BOX(filepopup_hbox) , filepopup_data_table , TRUE , TRUE , 0 ); - glade_xml_signal_autoconnect(xml); + /* title */ + filepopup_data_info_header[0] = gtk_label_new(""); + filepopup_data_info_label[0] = gtk_label_new(""); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_header[0]) , 0 , 0.5 ); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_label[0]) , 0 , 0.5 ); + markup = g_markup_printf_escaped( "%s" , _("Title") ); + gtk_label_set_markup( GTK_LABEL(filepopup_data_info_header[0]) , markup ); + g_free( markup ); + g_object_set_data( G_OBJECT(filepopup_win) , "label_title" , filepopup_data_info_label[0] ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_header[0] , + 0 , 1 , 0 , 1 , GTK_FILL , 0 , 0 , 0 ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_label[0] , + 1 , 2 , 0 , 1 , GTK_FILL , 0 , 0 , 0 ); + + /* artist */ + filepopup_data_info_header[1] = gtk_label_new(""); + filepopup_data_info_label[1] = gtk_label_new(""); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_header[1]) , 0 , 0.5 ); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_label[1]) , 0 , 0.5 ); + markup = g_markup_printf_escaped( "%s" , _("Artist") ); + gtk_label_set_markup( GTK_LABEL(filepopup_data_info_header[1]) , markup ); + g_free( markup ); + g_object_set_data( G_OBJECT(filepopup_win) , "label_artist" , filepopup_data_info_label[1] ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_header[1] , + 0 , 1 , 1 , 2 , GTK_FILL , 0 , 0 , 0 ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_label[1] , + 1 , 2 , 1 , 2 , GTK_FILL , 0 , 0 , 0 ); - 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)); + /* album */ + filepopup_data_info_header[2] = gtk_label_new(""); + filepopup_data_info_label[2] = gtk_label_new(""); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_header[2]) , 0 , 0.5 ); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_label[2]) , 0 , 0.5 ); + markup = g_markup_printf_escaped( "%s" , _("Album") ); + gtk_label_set_markup( GTK_LABEL(filepopup_data_info_header[2]) , markup ); + g_free( markup ); + g_object_set_data( G_OBJECT(filepopup_win) , "label_album" , filepopup_data_info_label[2] ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_header[2] , + 0 , 1 , 2 , 3 , GTK_FILL , 0 , 0 , 0 ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_label[2] , + 1 , 2 , 2 , 3 , GTK_FILL , 0 , 0 , 0 ); + + /* genre */ + filepopup_data_info_header[3] = gtk_label_new(""); + filepopup_data_info_label[3] = gtk_label_new(""); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_header[3]) , 0 , 0.5 ); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_label[3]) , 0 , 0.5 ); + markup = g_markup_printf_escaped( "%s" , _("Genre") ); + gtk_label_set_markup( GTK_LABEL(filepopup_data_info_header[3]) , markup ); + g_free( markup ); + g_object_set_data( G_OBJECT(filepopup_win) , "label_genre" , filepopup_data_info_label[3] ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_header[3] , + 0 , 1 , 3 , 4 , GTK_FILL , 0 , 0 , 0 ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_label[3] , + 1 , 2 , 3 , 4 , GTK_FILL , 0 , 0 , 0 ); - widget = glade_xml_get_widget(xml, "image_artwork"); - gtk_image_set_from_file(GTK_IMAGE(widget), DATA_DIR "/images/audio.png"); - g_object_set_data( G_OBJECT(filepopup_win) , "last_artwork" , NULL ); + /* year */ + filepopup_data_info_header[4] = gtk_label_new(""); + filepopup_data_info_label[4] = gtk_label_new(""); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_header[4]) , 0 , 0.5 ); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_label[4]) , 0 , 0.5 ); + markup = g_markup_printf_escaped( "%s" , _("Year") ); + gtk_label_set_markup( GTK_LABEL(filepopup_data_info_header[4]) , markup ); + g_free( markup ); + g_object_set_data( G_OBJECT(filepopup_win) , "label_year" , filepopup_data_info_label[4] ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_header[4] , + 0 , 1 , 4 , 5 , GTK_FILL , 0 , 0 , 0 ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_label[4] , + 1 , 2 , 4 , 5 , GTK_FILL , 0 , 0 , 0 ); - return filepopup_win; + /* Track Number */ + filepopup_data_info_header[5] = gtk_label_new(""); + filepopup_data_info_label[5] = gtk_label_new(""); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_header[5]) , 0 , 0.5 ); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_label[5]) , 0 , 0.5 ); + markup = g_markup_printf_escaped( "%s" , _("Track Number") ); + gtk_label_set_markup( GTK_LABEL(filepopup_data_info_header[5]) , markup ); + g_free( markup ); + g_object_set_data( G_OBJECT(filepopup_win) , "label_tracknum" , filepopup_data_info_label[5] ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_header[5] , + 0 , 1 , 5 , 6 , GTK_FILL , 0 , 0 , 0 ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_label[5] , + 1 , 2 , 5 , 6 , GTK_FILL , 0 , 0 , 0 ); + + /* Track Length */ + filepopup_data_info_header[6] = gtk_label_new(""); + filepopup_data_info_label[6] = gtk_label_new(""); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_header[6]) , 0 , 0.5 ); + gtk_misc_set_alignment( GTK_MISC(filepopup_data_info_label[6]) , 0 , 0.5 ); + markup = g_markup_printf_escaped( "%s" , _("Track Length") ); + gtk_label_set_markup( GTK_LABEL(filepopup_data_info_header[6]) , markup ); + g_free( markup ); + g_object_set_data( G_OBJECT(filepopup_win) , "label_tracklen" , filepopup_data_info_label[6] ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_header[6] , + 0 , 1 , 6 , 7 , GTK_FILL , 0 , 0 , 0 ); + gtk_table_attach( GTK_TABLE(filepopup_data_table) , filepopup_data_info_label[6] , + 1 , 2 , 6 , 7 , GTK_FILL , 0 , 0 , 0 ); + + /* this will realize all widgets contained in filepopup_hbox */ + gtk_widget_show_all(filepopup_hbox); + + return filepopup_win; } void audacious_fileinfopopup_destroy(GtkWidget *filepopup_win) { - gchar *last_artwork = g_object_get_data( G_OBJECT(filepopup_win) , "last_artwork" ); - if ( last_artwork != NULL ) g_free(last_artwork); - g_object_unref( g_object_get_data(G_OBJECT(filepopup_win), "glade-xml") ); - gtk_widget_destroy( filepopup_win ); - return; + gchar *last_artwork = g_object_get_data( G_OBJECT(filepopup_win) , "last_artwork" ); + if ( last_artwork != NULL ) g_free(last_artwork); + gtk_widget_destroy( filepopup_win ); + return; } void