# HG changeset patch # User Tomasz Mon # Date 1195846345 -3600 # Node ID a77a1b3f493f92a931847d8fdae1e8bb54d52474 # Parent ba5af8e85857e9422b482846ec9aa32c180c6b02 drop glade on fileinfo diff -r ba5af8e85857 -r a77a1b3f493f src/audacious/glade/fileinfo.glade --- a/src/audacious/glade/fileinfo.glade Fri Nov 23 19:26:35 2007 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,598 +0,0 @@ - - - - - - - 6 - Track Information - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_CENTER - False - False - False - True - False - False - GDK_WINDOW_TYPE_HINT_DIALOG - GDK_GRAVITY_NORTH_WEST - True - False - - - - True - False - 0 - - - - True - 0.5 - 0 - 0 - 0 - - - 0 - False - False - - - - - - True - - - 12 - False - False - - - - - - True - False - 0 - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 0 - 0 - 0 - - - - True - False - 0 - - - - True - <span size="small">Title</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 6 - 0 - 0 - - - - True - True - True - True - 0 - - True - * - False - - - - - 0 - False - False - - - - - - True - <span size="small">Artist</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 6 - 0 - 0 - - - - True - True - True - True - 0 - - True - * - False - - - - - 0 - False - False - - - - - - True - <span size="small">Album</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 6 - 0 - 0 - - - - True - True - True - True - 0 - - True - * - False - - - - - 0 - False - False - - - - - - True - <span size="small">Comment</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 6 - 0 - 0 - - - - True - True - True - True - 0 - - True - * - False - - - - - 0 - False - False - - - - - - True - <span size="small">Genre</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 6 - 0 - 0 - - - - True - True - True - True - 0 - - True - * - False - - - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 6 - 0 - 0 - - - - True - 2 - 2 - False - 0 - 6 - - - - True - <span size="small">Year</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - 1 - 0 - 1 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 0 - 1 - 1 - 2 - - - - - - - True - <span size="small">Track Number</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 1 - 2 - 0 - 1 - fill - - - - - - - True - True - True - True - 0 - - True - * - False - - - 1 - 2 - 1 - 2 - - - - - - - - 0 - False - False - - - - - - True - <span size="small">Location</span> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - True - 0.5 - 0.5 - 1 - 1 - 0 - 6 - 0 - 0 - - - - True - True - True - True - 0 - - True - * - False - - - - - 0 - False - False - - - - - - - 0 - True - True - - - - - - True - GTK_BUTTONBOX_END - 0 - - - - True - True - True - gtk-close - True - GTK_RELIEF_NORMAL - True - - - - - 0 - False - False - - - - - 0 - True - True - - - - - - - diff -r ba5af8e85857 -r a77a1b3f493f src/audacious/ui_fileinfo.c --- a/src/audacious/ui_fileinfo.c Fri Nov 23 19:26:35 2007 +0100 +++ b/src/audacious/ui_fileinfo.c Fri Nov 23 20:32:25 2007 +0100 @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -37,8 +36,6 @@ #include #include -#include "glade.h" - #include "plugin.h" #include "pluginenum.h" #include "input.h" @@ -63,43 +60,46 @@ GtkWidget *fileinfo_win; +GtkWidget *entry_location; +GtkWidget *entry_title; +GtkWidget *entry_artist; +GtkWidget *entry_album; +GtkWidget *entry_comment; +GtkWidget *entry_year; +GtkWidget *entry_track; +GtkWidget *entry_genre; + +GtkWidget *image_artwork; + static void -fileinfo_entry_set_text(const char *entry, const char *text) +fileinfo_entry_set_text(GtkWidget *widget, const char *text) { - GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml"); - GtkWidget *widget = glade_xml_get_widget(xml, entry); + if (widget == NULL) + return; - if (xml == NULL || widget == NULL) - return; - - gtk_entry_set_text(GTK_ENTRY(widget), text); + gtk_entry_set_text(GTK_ENTRY(widget), text); } static void -fileinfo_entry_set_text_free(const char *entry, char *text) +fileinfo_entry_set_text_free(GtkWidget *widget, char *text) { - GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml"); - GtkWidget *widget = glade_xml_get_widget(xml, entry); + if (widget == NULL) + return; - if (xml == NULL || widget == NULL) - return; + gtk_entry_set_text(GTK_ENTRY(widget), text); - gtk_entry_set_text(GTK_ENTRY(widget), text); - - g_free(text); + g_free(text); } static void -fileinfo_entry_set_image(const char *entry, const char *text) +fileinfo_entry_set_image(GtkWidget *widget, const char *text) { - GladeXML *xml = g_object_get_data(G_OBJECT(fileinfo_win), "glade-xml"); - GtkWidget *widget = glade_xml_get_widget(xml, entry); 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); @@ -133,41 +133,147 @@ void fileinfo_hide(gpointer unused) { - gtk_widget_hide(fileinfo_win); + gtk_widget_hide(fileinfo_win); - /* Clear it out. */ - fileinfo_entry_set_text("entry_title", ""); - fileinfo_entry_set_text("entry_artist", ""); - fileinfo_entry_set_text("entry_album", ""); - fileinfo_entry_set_text("entry_comment", ""); - fileinfo_entry_set_text("entry_genre", ""); - fileinfo_entry_set_text("entry_year", ""); - fileinfo_entry_set_text("entry_track", ""); - fileinfo_entry_set_text("entry_location", ""); + /* Clear it out. */ + fileinfo_entry_set_text(entry_title, ""); + fileinfo_entry_set_text(entry_artist, ""); + fileinfo_entry_set_text(entry_album, ""); + fileinfo_entry_set_text(entry_comment, ""); + fileinfo_entry_set_text(entry_genre, ""); + fileinfo_entry_set_text(entry_year, ""); + fileinfo_entry_set_text(entry_track, ""); + fileinfo_entry_set_text(entry_location, ""); - fileinfo_entry_set_image("image_artwork", DATA_DIR "/images/audio.png"); + fileinfo_entry_set_image(image_artwork, DATA_DIR "/images/audio.png"); } void create_fileinfo_window(void) { - const gchar *glade_file = DATA_DIR "/glade/fileinfo.glade"; - GladeXML *xml; - GtkWidget *widget; + GtkWidget *hbox; + GtkWidget *vbox1; + GtkWidget *vbox2; + GtkWidget *label_title; + GtkWidget *label_artist; + GtkWidget *label_album; + GtkWidget *label_comment; + GtkWidget *label_genre; + GtkWidget *label_year; + GtkWidget *label_track; + GtkWidget *label_location; + GtkWidget *table1; + GtkWidget *bbox_close; + GtkWidget *btn_close; + + fileinfo_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_container_set_border_width(GTK_CONTAINER(fileinfo_win), 6); + gtk_window_set_title(GTK_WINDOW(fileinfo_win), _("Track Information")); + gtk_window_set_position(GTK_WINDOW(fileinfo_win), GTK_WIN_POS_CENTER); + gtk_window_set_resizable(GTK_WINDOW(fileinfo_win), FALSE); + gtk_window_set_type_hint(GTK_WINDOW(fileinfo_win), GDK_WINDOW_TYPE_HINT_DIALOG); + gtk_window_set_transient_for(GTK_WINDOW(fileinfo_win), GTK_WINDOW(mainwin)); + + hbox = gtk_hbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(fileinfo_win), hbox); - xml = glade_xml_new_or_die(_("Track Information Window"), glade_file, NULL, NULL); + image_artwork = gtk_image_new(); + gtk_box_pack_start(GTK_BOX(hbox), image_artwork, FALSE, FALSE, 0); + gtk_misc_set_alignment(GTK_MISC(image_artwork), 0.5, 0); + gtk_image_set_from_file(GTK_IMAGE(image_artwork), DATA_DIR "/images/audio.png"); + + vbox1 = gtk_vbox_new(FALSE, 0); + gtk_box_pack_start(GTK_BOX(hbox), vbox1, TRUE, TRUE, 0); + + vbox2 = gtk_vbox_new(FALSE, 0); + gtk_container_add(GTK_CONTAINER(vbox1), vbox2); + + label_title = gtk_label_new(_("Title")); + gtk_box_pack_start(GTK_BOX(vbox2), label_title, FALSE, FALSE, 0); + gtk_label_set_use_markup(GTK_LABEL(label_title), TRUE); + gtk_misc_set_alignment(GTK_MISC(label_title), 0, 0); - glade_xml_signal_autoconnect(xml); + entry_title = gtk_entry_new(); + gtk_container_add(GTK_CONTAINER(vbox2), entry_title); + + label_artist = gtk_label_new(_("Artist")); + gtk_box_pack_start(GTK_BOX(vbox2), label_artist, FALSE, FALSE, 0); + gtk_label_set_use_markup(GTK_LABEL(label_artist), TRUE); + gtk_misc_set_alignment(GTK_MISC(label_artist), 0, 0.5); + + entry_artist = gtk_entry_new(); + gtk_container_add(GTK_CONTAINER(vbox2), entry_artist); + + label_album = gtk_label_new(_("Album")); + gtk_box_pack_start(GTK_BOX(vbox2), label_album, FALSE, FALSE, 0); + gtk_label_set_use_markup(GTK_LABEL(label_album), TRUE); + gtk_misc_set_alignment(GTK_MISC(label_album), 0, 0.5); + + entry_album = gtk_entry_new(); + gtk_container_add(GTK_CONTAINER(vbox2), entry_album); - fileinfo_win = glade_xml_get_widget(xml, "fileinfo_win"); - g_object_set_data(G_OBJECT(fileinfo_win), "glade-xml", xml); - gtk_window_set_transient_for(GTK_WINDOW(fileinfo_win), GTK_WINDOW(mainwin)); + label_comment = gtk_label_new(_("Comment")); + gtk_box_pack_start(GTK_BOX(vbox2), label_comment, FALSE, FALSE, 0); + gtk_label_set_use_markup(GTK_LABEL(label_comment), TRUE); + gtk_misc_set_alignment(GTK_MISC(label_comment), 0, 0.5); + + entry_comment = gtk_entry_new(); + gtk_container_add (GTK_CONTAINER(vbox2), entry_comment); + + label_genre = gtk_label_new(_("Genre")); + gtk_box_pack_start(GTK_BOX(vbox2), label_genre, FALSE, FALSE, 0); + gtk_label_set_use_markup(GTK_LABEL(label_genre), TRUE); + gtk_misc_set_alignment(GTK_MISC(label_genre), 0, 0.5); + + entry_genre = gtk_entry_new(); + gtk_container_add(GTK_CONTAINER(vbox2), entry_genre); + + table1 = gtk_table_new(2, 2, FALSE); + gtk_container_add(GTK_CONTAINER(vbox2), table1); + gtk_table_set_col_spacings(GTK_TABLE(table1), 6); + + label_year = gtk_label_new(_("Year")); + gtk_table_attach(GTK_TABLE(table1), label_year, 0, 1, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_use_markup(GTK_LABEL(label_year), TRUE); + gtk_misc_set_alignment(GTK_MISC(label_year), 0, 0.5); - widget = glade_xml_get_widget(xml, "image_artwork"); - gtk_image_set_from_file(GTK_IMAGE(widget), DATA_DIR "/images/audio.png"); + entry_year = gtk_entry_new(); + gtk_table_attach(GTK_TABLE(table1), entry_year, 0, 1, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + + label_track = gtk_label_new(_("Track Number")); + gtk_table_attach(GTK_TABLE(table1), label_track, 1, 2, 0, 1, + (GtkAttachOptions) (GTK_FILL), + (GtkAttachOptions) (0), 0, 0); + gtk_label_set_use_markup(GTK_LABEL(label_track), TRUE); + gtk_misc_set_alignment(GTK_MISC(label_track), 0, 0.5); + + entry_track = gtk_entry_new(); + gtk_table_attach(GTK_TABLE(table1), entry_track, 1, 2, 1, 2, + (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), + (GtkAttachOptions) (0), 0, 0); - widget = glade_xml_get_widget(xml, "btn_close"); - g_signal_connect(G_OBJECT(widget), "clicked", (GCallback) fileinfo_hide, NULL); + label_location = gtk_label_new(_("Location")); + gtk_box_pack_start(GTK_BOX(vbox2), label_location, FALSE, FALSE, 0); + gtk_label_set_use_markup(GTK_LABEL(label_location), TRUE); + gtk_misc_set_alignment(GTK_MISC(label_location), 0, 0.5); + + entry_location = gtk_entry_new(); + gtk_container_add(GTK_CONTAINER(vbox2), entry_location); + + bbox_close = gtk_hbutton_box_new(); + gtk_box_pack_start(GTK_BOX(vbox1), bbox_close, FALSE, FALSE, 0); + gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox_close), GTK_BUTTONBOX_END); + + btn_close = gtk_button_new_from_stock("gtk-close"); + gtk_container_add(GTK_CONTAINER(bbox_close), btn_close); + GTK_WIDGET_SET_FLAGS(btn_close, GTK_CAN_DEFAULT); + g_signal_connect(G_OBJECT(btn_close), "clicked", (GCallback) fileinfo_hide, NULL); + + gtk_widget_show_all (hbox); } void @@ -180,27 +286,27 @@ gtk_widget_realize(fileinfo_win); - fileinfo_entry_set_text("entry_title", tuple_get_string(tuple, FIELD_TITLE, NULL)); - fileinfo_entry_set_text("entry_artist", tuple_get_string(tuple, FIELD_ARTIST, NULL)); - fileinfo_entry_set_text("entry_album", tuple_get_string(tuple, FIELD_ALBUM, NULL)); - fileinfo_entry_set_text("entry_comment", tuple_get_string(tuple, FIELD_COMMENT, NULL)); - fileinfo_entry_set_text("entry_genre", tuple_get_string(tuple, FIELD_GENRE, NULL)); + fileinfo_entry_set_text(entry_title, tuple_get_string(tuple, FIELD_TITLE, NULL)); + fileinfo_entry_set_text(entry_artist, tuple_get_string(tuple, FIELD_ARTIST, NULL)); + fileinfo_entry_set_text(entry_album, tuple_get_string(tuple, FIELD_ALBUM, NULL)); + fileinfo_entry_set_text(entry_comment, tuple_get_string(tuple, FIELD_COMMENT, NULL)); + fileinfo_entry_set_text(entry_genre, tuple_get_string(tuple, FIELD_GENRE, NULL)); tmp = g_strdup_printf("%s/%s", tuple_get_string(tuple, FIELD_FILE_PATH, NULL), tuple_get_string(tuple, FIELD_FILE_NAME, NULL)); if(tmp){ - fileinfo_entry_set_text_free("entry_location", str_to_utf8(tmp)); + fileinfo_entry_set_text_free(entry_location, str_to_utf8(tmp)); g_free(tmp); tmp = NULL; } if (tuple_get_int(tuple, FIELD_YEAR, NULL)) - fileinfo_entry_set_text_free("entry_year", + fileinfo_entry_set_text_free(entry_year, g_strdup_printf("%d", tuple_get_int(tuple, FIELD_YEAR, NULL))); if (tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL)) - fileinfo_entry_set_text_free("entry_track", + fileinfo_entry_set_text_free(entry_track, g_strdup_printf("%d", tuple_get_int(tuple, FIELD_TRACK_NUMBER, NULL))); tmp = fileinfo_recursive_get_image( @@ -209,7 +315,7 @@ if(tmp) { - fileinfo_entry_set_image("image_artwork", tmp); + fileinfo_entry_set_image(image_artwork, tmp); g_free(tmp); }