static void gimmix_tag_editor_save (GtkWidget *button, gpointer data) { gint year; gint track; gchar *genre = NULL; gchar *title = NULL; gchar *artist = NULL; gchar *album = NULL; gchar *comment = NULL; year = gtk_spin_button_get_value (GTK_SPIN_BUTTON(tag_year_spin)); taglib_tag_set_year (tag, year); track = gtk_spin_button_get_value (GTK_SPIN_BUTTON(tag_track_spin)); taglib_tag_set_track (tag, track); title = g_strdup (gtk_entry_get_text (GTK_ENTRY(tag_title))); artist = g_strdup (gtk_entry_get_text (GTK_ENTRY(tag_artist))); album = g_strdup (gtk_entry_get_text (GTK_ENTRY(tag_album))); comment = g_strdup (gtk_entry_get_text (GTK_ENTRY(tag_comment))); genre = gtk_combo_box_get_active_text (GTK_COMBO_BOX(tag_genre)); if (title) { taglib_tag_set_title (tag, g_strchomp(title)); } if (artist) { taglib_tag_set_artist (tag, g_strchomp(artist)); } if (album) { taglib_tag_set_album (tag, g_strchomp(album)); } if (comment) { taglib_tag_set_comment (tag, g_strchomp(comment)); } taglib_tag_set_genre (tag, genre); /* update the mpd database */ mpd_database_update_dir (gmo, "/"); /* set the song info a few seconds after update */ mpd_status_update (gmo); /* free the strings */ taglib_tag_free_strings (); taglib_file_save (file); g_free (title); g_free (artist); g_free (album); g_free (comment); return; }
static void gimmix_tag_editor_save (GtkWidget *button, gpointer data) { gint year; gint track; gchar *genre; const gchar *title; const gchar *artist; const gchar *album; const gchar *comment; year = gtk_spin_button_get_value (GTK_SPIN_BUTTON(tag_year_spin)); taglib_tag_set_year (tag, year); track = gtk_spin_button_get_value (GTK_SPIN_BUTTON(tag_track_spin)); taglib_tag_set_track (tag, track); title = gtk_entry_get_text (GTK_ENTRY(tag_title)); artist = gtk_entry_get_text (GTK_ENTRY(tag_artist)); album = gtk_entry_get_text (GTK_ENTRY(tag_album)); comment = gtk_entry_get_text (GTK_ENTRY(tag_comment)); genre = gtk_combo_box_get_active_text (GTK_COMBO_BOX(tag_genre)); taglib_tag_set_title (tag, title); taglib_tag_set_artist (tag, artist); taglib_tag_set_album (tag, album); taglib_tag_set_comment (tag, comment); taglib_tag_set_genre (tag, genre); /* update the mpd database */ mpd_database_update_dir (gmo, "/"); /* set the song info a few seconds after update */ g_timeout_add (300, (GSourceFunc)gimmix_update_song_info, NULL); /* free the strings */ taglib_tag_free_strings (); taglib_file_save (file); return; }
static void update_database_command(gpointer user_data, const char *param) { int val = mpd_server_check_command_allowed(connection, "update"); if (val == MPD_SERVER_COMMAND_NOT_SUPPORTED) { char * mesg = g_strdup_printf("%s: %s", _("Update database"), _("The used MPD server is too old and does not support this.")); playlist3_message_show(pl3_messages, mesg, ERROR_CRITICAL); g_free(mesg); } else if (val == MPD_SERVER_COMMAND_NOT_ALLOWED) { char * mesg = g_strdup_printf("%s: %s", _("Update database"), _("You have insufficient permission to use this option.")); playlist3_message_show(pl3_messages,mesg, ERROR_WARNING); g_free(mesg); } else if (val == MPD_SERVER_COMMAND_ALLOWED) { mpd_database_update_dir(connection, "/"); } }