static void infowin_show (gint list, gint entry, const gchar * filename, const Tuple * tuple, PluginHandle * decoder, gboolean updating_enabled) { gchar * tmp; if (infowin == NULL) create_infowin (); else clear_infowin (); current_file = g_strdup (filename); current_decoder = decoder; can_write = updating_enabled; set_entry_str_from_field (entry_title, tuple, FIELD_TITLE, updating_enabled); set_entry_str_from_field (entry_artist, tuple, FIELD_ARTIST, updating_enabled); set_entry_str_from_field (entry_album, tuple, FIELD_ALBUM, updating_enabled); set_entry_str_from_field (entry_comment, tuple, FIELD_COMMENT, updating_enabled); set_entry_str_from_field (gtk_bin_get_child ((GtkBin *) entry_genre), tuple, FIELD_GENRE, updating_enabled); tmp = uri_to_display (filename); gtk_label_set_text ((GtkLabel *) location_text, tmp); g_free (tmp); set_entry_int_from_field (entry_year, tuple, FIELD_YEAR, updating_enabled); set_entry_int_from_field (entry_track, tuple, FIELD_TRACK_NUMBER, updating_enabled); infowin_label_set_text (label_format_name, tuple_get_string (tuple, FIELD_CODEC, NULL)); infowin_label_set_text (label_quality, tuple_get_string (tuple, FIELD_QUALITY, NULL)); if (tuple_get_value_type (tuple, FIELD_BITRATE, NULL) == TUPLE_INT) { tmp = g_strdup_printf (_("%d kb/s"), tuple_get_int (tuple, FIELD_BITRATE, NULL)); infowin_label_set_text (label_bitrate, tmp); g_free (tmp); } else infowin_label_set_text (label_bitrate, NULL); infowin_entry_set_image (image_artwork, list, entry); gtk_window_present ((GtkWindow *) infowin); }
WRegion *infowin_load(WWindow *par, const WFitParams *fp, ExtlTab tab) { char *style=NULL, *text=NULL; WInfoWin *p; extl_table_gets_s(tab, "style", &style); p=create_infowin(par, fp, style); free(style); if(p==NULL) return NULL; if(extl_table_gets_s(tab, "text", &text)){ infowin_do_set_text(p, text); free(text); } return (WRegion*)p; }
static WInfoWin *setup_moveres_display(WWindow *parent, int cx, int cy) { GrBorderWidths bdw; GrFontExtents fnte; WInfoWin *infowin; WFitParams fp; fp.mode=REGION_FIT_EXACT; fp.g.x=0; fp.g.y=0; fp.g.w=1; fp.g.h=1; infowin=create_infowin(parent, &fp, "moveres_display"); if(infowin==NULL) return NULL; grbrush_get_border_widths(INFOWIN_BRUSH(infowin), &bdw); grbrush_get_font_extents(INFOWIN_BRUSH(infowin), &fnte); /* Create move/resize position/size display window */ fp.g.w=3; fp.g.w+=chars_for_num(REGION_GEOM(parent).w); fp.g.w+=chars_for_num(REGION_GEOM(parent).h); fp.g.w*=max_width(INFOWIN_BRUSH(infowin), "0123456789x+"); fp.g.w+=bdw.left+bdw.right; fp.g.h=fnte.max_height+bdw.top+bdw.bottom;; fp.g.x=cx-fp.g.w/2; fp.g.y=cy-fp.g.h/2; region_fitrep((WRegion*)infowin, NULL, &fp); region_map((WRegion*)infowin); return infowin; }