Project

General

Profile

infowin.cc.diff

Jim Turner, September 07, 2022 05:21

View differences:

src/libaudgui/infowin.cc
53 53
};
54 54

  
55 55
static struct {
56
    GtkWidget * location;
56
    GtkTextView * location;
57
    GtkWidget * location_scrolled;
58
    GtkTextBuffer * textbuffer;
57 59
    GtkWidget * title;
58 60
    GtkWidget * artist;
59 61
    GtkWidget * album;
......
256 258

  
257 259
static void genre_fill (GtkWidget * combo)
258 260
{
259
    GList * list = nullptr;
260
    GList * node;
261
    Index<const char *> list;
262
    for (auto genre : genre_table)
263
        list.append (_(genre));
261 264

  
262
    for (const char * genre : genre_table)
263
        list = g_list_prepend (list, _(genre));
265
    list.sort (g_utf8_collate);
264 266

  
265
    list = g_list_sort (list, (GCompareFunc) strcmp);
266

  
267
    for (node = list; node != nullptr; node = node->next)
268
        gtk_combo_box_text_append_text ((GtkComboBoxText *) combo, (const char *) node->data);
269

  
270
    g_list_free (list);
267
    for (auto genre : list)
268
        gtk_combo_box_text_append_text ((GtkComboBoxText *) combo, genre);
271 269
}
272 270

  
273 271
static void autofill_toggled (GtkToggleButton * toggle)
......
308 306
    GtkWidget * label = small_label_new (title);
309 307

  
310 308
    gtk_table_attach ((GtkTable *) grid, label, x, x + span, y, y + 1,
311
     GTK_FILL, GTK_FILL, 0, 0);
309
     (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), GTK_FILL, 0, 0);
312 310
    gtk_table_attach ((GtkTable *) grid, entry, x, x + span, y + 1, y + 2,
313
     GTK_FILL, GTK_FILL, 0, 0);
311
     (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), GTK_FILL, 0, 0);
314 312

  
315 313
    g_signal_connect (entry, "changed", (GCallback) entry_changed, nullptr);
316 314
}
......
331 329
    gtk_container_add ((GtkContainer *) infowin, main_grid);
332 330

  
333 331
    widgets.image = audgui_scaled_image_new (nullptr);
334
    gtk_table_attach_defaults ((GtkTable *) main_grid, widgets.image, 0, 1, 0, 1);
335

  
336
    widgets.location = gtk_label_new ("");
337
    gtk_widget_set_size_request (widgets.location, 2 * dpi, -1);
338
    gtk_label_set_line_wrap ((GtkLabel *) widgets.location, true);
339
    gtk_label_set_line_wrap_mode ((GtkLabel *) widgets.location, PANGO_WRAP_WORD_CHAR);
340
    gtk_label_set_selectable ((GtkLabel *) widgets.location, true);
341
    gtk_table_attach ((GtkTable *) main_grid, widgets.location, 0, 1, 1, 2,
332
    gtk_widget_set_size_request (widgets.image, 2 * dpi, 2 * dpi);
333
    gtk_table_attach ((GtkTable *) main_grid, widgets.image, 0, 1, 0, 1,
342 334
     GTK_FILL, GTK_FILL, 0, 0);
343 335

  
336
    widgets.location_scrolled = gtk_scrolled_window_new (nullptr, nullptr);
337
    gtk_scrolled_window_set_shadow_type ((GtkScrolledWindow *) widgets.location_scrolled, GTK_SHADOW_IN);
338
    gtk_scrolled_window_set_policy ((GtkScrolledWindow *) widgets.location_scrolled,
339
     GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
340

  
341
    widgets.location = (GtkTextView *) gtk_text_view_new ();
342
    gtk_text_view_set_editable (widgets.location, false);
343
    gtk_text_view_set_cursor_visible (widgets.location, true);
344
    gtk_text_view_set_left_margin (widgets.location, 4);
345
    gtk_text_view_set_right_margin (widgets.location, 4);
346
    gtk_text_view_set_wrap_mode (widgets.location, GTK_WRAP_CHAR);
347
    widgets.textbuffer = gtk_text_view_get_buffer (widgets.location);
348

  
349
    gtk_container_add ((GtkContainer *) widgets.location_scrolled, (GtkWidget *) widgets.location);
350
    GtkWidget * scrolled_vbox = gtk_vbox_new (false, 6);
351
    gtk_box_pack_start ((GtkBox *) scrolled_vbox, widgets.location_scrolled, true, true, 0);
352
    gtk_widget_show_all (scrolled_vbox);
353
    gtk_table_attach ((GtkTable *) main_grid, scrolled_vbox, 0, 1, 1, 2,
354
     GTK_FILL, (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), 0, 0);
355

  
344 356
    GtkWidget * codec_grid = gtk_table_new (0, 0, false);
345 357
    gtk_table_set_row_spacings ((GtkTable *) codec_grid, 2);
346 358
    gtk_table_set_col_spacings ((GtkTable *) codec_grid, 12);
347 359
    gtk_table_attach ((GtkTable *) main_grid, codec_grid, 0, 1, 2, 3,
348
     GTK_FILL, GTK_FILL, 0, 0);
360
     GTK_FILL, GTK_FILL, 0, 8);
349 361

  
350 362
    for (int row = 0; row < CODEC_ITEMS; row ++)
351 363
    {
......
362 374
    gtk_table_set_row_spacings ((GtkTable *) grid, 2);
363 375
    gtk_table_set_col_spacings ((GtkTable *) grid, 6);
364 376
    gtk_table_attach ((GtkTable *) main_grid, grid, 1, 2, 0, 3,
365
     GTK_FILL, GTK_FILL, 0, 0);
377
     (GtkAttachOptions)(GTK_FILL | GTK_EXPAND), GTK_FILL, 0, 0);
366 378

  
367 379
    widgets.title = gtk_entry_new ();
368 380
    gtk_widget_set_size_request (widgets.title, 3 * dpi, -1);
......
402 414

  
403 415
    gtk_widget_set_no_show_all (widgets.autofill, true);
404 416
    gtk_widget_show (widgets.autofill);
405
    gtk_box_pack_start ((GtkBox *) bottom_hbox, widgets.autofill, false, false, 0);
417
    gtk_box_pack_start ((GtkBox *) bottom_hbox, widgets.autofill, true, true, 0);
406 418

  
407 419
    widgets.ministatus = small_label_new (nullptr);
408 420
    gtk_widget_set_no_show_all (widgets.ministatus, true);
......
455 467
    set_entry_str_from_field (gtk_bin_get_child ((GtkBin *) widgets.genre),
456 468
     tuple, Tuple::Genre, writable, clear, changed);
457 469

  
458
    gtk_label_set_text ((GtkLabel *) widgets.location, uri_to_display (filename));
470
    gtk_text_buffer_set_text (widgets.textbuffer, uri_to_display (filename), -1);
459 471

  
460 472
    set_entry_int_from_field (widgets.year, tuple, Tuple::Year, writable, clear, changed);
461 473
    set_entry_int_from_field (widgets.track, tuple, Tuple::Track, writable, clear, changed);