~ubuntu-branches/ubuntu/wily/gnomad2/wily

« back to all changes in this revision

Viewing changes to src/editmeta.c

  • Committer: Bazaar Package Importer
  • Author(s): Shaun Jackman
  • Date: 2006-04-08 15:58:16 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060408155816-25y8gx2wa4chfr69
Tags: 2.8.3-1
* New upstream release.
* Update the Debian policy to version 3.6.2.2. No changes necessary.
* Update the watch file.
* Update the copyright file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "common.h"
20
20
/* The GNOME library - cannot be put in common as it
21
21
 * disturbs the id3.cpp file */
 
22
#if !GTK_CHECK_VERSION(2,6,0)
22
23
#include <libgnomeui/libgnomeui.h>
 
24
#endif
23
25
 
24
26
#include "filesystem.h"
25
27
#include "jukebox.h"
311
313
 
312
314
static void add_to_dialog(GtkWidget *dialog, GtkWidget *thing)
313
315
{
 
316
#if !GTK_CHECK_VERSION(2,6,0)
314
317
  gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), thing, TRUE,
315
318
                      TRUE, 0);
 
319
#else
 
320
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), thing, TRUE,
 
321
                      TRUE, 0);
 
322
#endif
316
323
}
317
324
/* Editing the metadata... */
318
325
static void edit_dialog_create()
319
326
{
320
327
  GtkWidget *hbox, *label, *dialog, *tempwid, *entry;
321
 
 
322
 
  if (target == JB_LIST)
 
328
#if !GTK_CHECK_VERSION(2,6,0)
 
329
  if (target == JB_LIST) {
323
330
    dialog = gnome_dialog_new(_("Edit jukebox file metadata"),
324
331
                              GNOME_STOCK_BUTTON_CANCEL,
325
332
                              GNOME_STOCK_BUTTON_OK,
326
333
                              NULL);
327
 
  else
 
334
  } else {
328
335
    dialog = gnome_dialog_new(_("Edit track metadata (ID3v2)"),
329
336
                              GNOME_STOCK_BUTTON_CANCEL,
330
337
                              GNOME_STOCK_BUTTON_OK,
331
338
                              NULL);
 
339
  }
332
340
  gnome_dialog_button_connect_object(GNOME_DIALOG(dialog),
333
341
                                     0,
334
342
                                     G_CALLBACK(edit_cancel_click),
337
345
                              1,
338
346
                              G_CALLBACK(edit_ok_click),
339
347
                              NULL);
 
348
#else
 
349
  if (target == JB_LIST) {
 
350
    dialog = gtk_dialog_new_with_buttons(_("Edit jukebox file metadata"),
 
351
                                         NULL, 0, NULL);
 
352
  } else {
 
353
    dialog = gtk_dialog_new_with_buttons(_("Edit track metadata (ID3v2)"),
 
354
                                         NULL, 0, NULL);
 
355
  }
 
356
  
 
357
  tempwid = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, 0);
 
358
  g_signal_connect (tempwid, "clicked",
 
359
                    G_CALLBACK (edit_cancel_click), NULL);
 
360
 
 
361
  tempwid = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_OK, 1);
 
362
  g_signal_connect (tempwid, "clicked",
 
363
                    G_CALLBACK (edit_ok_click), NULL);
 
364
#endif
340
365
  edit_dialog = dialog;
341
366
 
342
367
  /* Add the metadata edit field for the dialog box */
625
650
}
626
651
 
627
652
/* Removes any directories from a selection */
628
 
static GList *remove_directories(GList *metadatas)
 
653
static GList *filter_for_editing(GList *metadatas, guint listtype)
629
654
{
630
655
  GList *tmp = metadatas;
631
656
  GList *newmetas = NULL;
639
664
    if (meta->size == 0) {
640
665
      /* Throw this away */
641
666
      destroy_metadata_t(meta);
 
667
    } else if ( (listtype == HD_LIST) &&
 
668
                strcmp(meta->codec, "MP3") ) {
 
669
      // If on the host side, we can only edit MP3 ID3v1/v2
 
670
      // metadata, so filter out anything else.
 
671
      destroy_metadata_t(meta);
642
672
    } else {
643
673
      /* Keep this */
644
674
      newmetas = g_list_append (newmetas, meta);
654
684
{
655
685
  /* This is for the harddisk list only */
656
686
  GList *metadatas = get_all_metadata_from_selection(listtype);
657
 
  metadatas = remove_directories(metadatas);
 
687
 
 
688
  metadatas = filter_for_editing(metadatas, listtype);
658
689
  selection = get_metadata_selection(listtype);
659
690
  artist = NULL;
660
691
  title = NULL;