Changeset 114

Show
Ignore:
Timestamp:
09/07/06 16:00:09 (5 years ago)
Author:
ath
Message:

Better tag handling.

Location:
fm_gui/trunk/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • fm_gui/trunk/src/fm_cdj.c

    r103 r114  
    1313static void fm_cdj_state_changed_cb     (RgcRemoteObject        *obj, 
    1414                                         gint                   new_state, 
     15                                         gpointer               user_data); 
     16static void 
     17fm_cdj_found_tag_cb                     (RgcRemoteObject        *obj, 
     18                                         gchar                  *tag_name, 
     19                                         gchar                  *tag_value, 
    1520                                         gpointer               user_data); 
    1621 
     
    4449        rgc_remote_signal_connect (obj, "ready", rgc_marshal_cb_VOID__STRING, 
    4550                                   G_CALLBACK(fm_cdj_gui_ready_cb), cdata); 
     51        rgc_remote_signal_connect (obj, "found_tag", rgc_marshal_cb_VOID__STRING_STRING, 
     52                                   G_CALLBACK(fm_cdj_found_tag_cb), cdata); 
    4653 
    4754        // FIXME: check if we've already activated 
     
    6976        fm_cdj_gui_state_changed_cb (obj, new_state, gui); 
    7077} 
     78 
     79 
     80static void 
     81fm_cdj_found_tag_cb                     (RgcRemoteObject        *obj, 
     82                                         gchar                  *tag_name, 
     83                                         gchar                  *tag_value, 
     84                                         gpointer               user_data) 
     85{ 
     86        FmCDJData *cdata = (FmCDJData *) user_data; 
     87        FmCDJGui *gui = cdata->gui; 
     88 
     89        g_print("Tag \"%s\" = \"%s\"\n", tag_name, tag_value); 
     90 
     91        if (strcmp (tag_name, "artist") == 0) { 
     92                g_free (cdata->artist); 
     93                cdata->artist = g_strdup (tag_value); 
     94        } else if (strcmp (tag_name, "title") == 0) { 
     95                g_free (cdata->title); 
     96                cdata->title = g_strdup (tag_value); 
     97        } else 
     98                g_print ("Ignoring unknown tag \"%s\"\n", tag_name); 
     99 
     100        fm_cdj_gui_display_tag (cdata->gui, cdata->artist, cdata->title); 
     101} 
  • fm_gui/trunk/src/fm_cdj.h

    r44 r114  
    77 
    88        FmCDJGui        *gui; 
     9 
     10        gchar           *artist; 
     11        gchar           *title; 
    912}; 
    1013 
  • fm_gui/trunk/src/fm_cdj_gui.c

    r110 r114  
    235235        gchar *basename = g_path_get_basename (selected_filename); 
    236236        gchar *message = g_strdup_printf ("LOADING %s", basename); 
     237 
     238        g_free (cdata->artist); 
     239        cdata->artist = NULL; 
     240        g_free (cdata->title); 
     241        cdata->title = NULL; 
     242 
    237243        write_message(cdata->gui, message); 
    238244        g_free(message); 
     
    326332 
    327333        g_print ("Ready for %s\n", filename); 
    328         gchar *basename = g_path_get_basename (filename); 
     334        /*gchar *basename = g_path_get_basename (filename); 
    329335        gchar *message = g_strdup_printf ("LOADED %s", basename); 
    330336        write_message(cdata->gui, message); 
    331337        g_free (message); 
    332         g_free (basename); 
     338        g_free (basename);*/ 
     339} 
     340 
     341 
     342void 
     343fm_cdj_gui_display_tag                  (FmCDJGui               *gui, 
     344                                         gchar                  *artist, 
     345                                         gchar                  *title) 
     346{ 
     347        gchar *message = g_strdup_printf ("%s - %s", artist, title); 
     348        write_message(gui, message); 
     349        g_free (message); 
    333350} 
    334351 
  • fm_gui/trunk/src/fm_cdj_gui.h

    r110 r114  
    6565                                         gint                   new_state, 
    6666                                         FmCDJGui               *gui); 
     67 
     68void 
     69fm_cdj_gui_display_tag                  (FmCDJGui               *gui, 
     70                                         gchar                  *artist, 
     71                                         gchar                  *title);