Code

Added _utf8 suffix to all functions that take utf8 arguments.
authorKalle Wallin <kaw@linux.se>
Sun, 20 Jun 2004 20:02:33 +0000 (20:02 +0000)
committerKalle Wallin <kaw@linux.se>
Sun, 20 Jun 2004 20:02:33 +0000 (20:02 +0000)
git-svn-id: https://svn.musicpd.org/ncmpc/trunk@1587 09075e82-0dd4-0310-85a5-a0d7c8717e4f

src/mpdclient.c
src/mpdclient.h
src/screen.c
src/screen_file.c
src/screen_play.c

index 1069f8ef539c914cc8605aeeee6f124756389be1..3f1fb4416501ddc3d2972daba35548dd6d59a1c5 100644 (file)
@@ -316,7 +316,7 @@ mpdclient_cmd_crossfade(mpdclient_t *c, gint value)
 }
 
 gint 
-mpdclient_cmd_db_update(mpdclient_t *c, gchar *path)
+mpdclient_cmd_db_update_utf8(mpdclient_t *c, gchar *path)
 {
   mpd_sendUpdateCommand(c->connection, path ? path : "");
   return mpdclient_finish_command(c);
@@ -329,14 +329,20 @@ mpdclient_cmd_volume(mpdclient_t *c, gint value)
   return mpdclient_finish_command(c);
 }
 
+gint 
+mpdclient_cmd_add_path_utf8(mpdclient_t *c, gchar *path_utf8)
+{
+  mpd_sendAddCommand(c->connection, path_utf8);
+  return mpdclient_finish_command(c);
+}
+
 gint 
 mpdclient_cmd_add_path(mpdclient_t *c, gchar *path)
 {
   gint retval;
   gchar *path_utf8 = locale_to_utf8(path);
 
-  mpd_sendAddCommand(c->connection, path_utf8);
-  retval=mpdclient_finish_command(c);
+  retval=mpdclient_cmd_add_path_utf8(c, path_utf8);
   g_free(path_utf8);
   return retval;
 }
@@ -483,20 +489,29 @@ mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index)
 }
 
 gint 
-mpdclient_cmd_save_playlist(mpdclient_t *c, gchar *filename)
+mpdclient_cmd_save_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
 {
   gint retval = 0;
-  gchar *filename_utf8 = locale_to_utf8(filename);
 
   mpd_sendSaveCommand(c->connection, filename_utf8);
   if( (retval=mpdclient_finish_command(c)) == 0 )
     mpdclient_browse_callback(c, BROWSE_PLAYLIST_SAVED, NULL);
+  return retval;
+}
+
+gint 
+mpdclient_cmd_save_playlist(mpdclient_t *c, gchar *filename)
+{
+  gint retval = 0;
+  gchar *filename_utf8 = locale_to_utf8(filename);
+  
+  retval = mpdclient_cmd_save_playlist_utf8(c, filename);
   g_free(filename_utf8);
   return retval;
 }
 
 gint 
-mpdclient_cmd_load_playlist(mpdclient_t *c, gchar *filename_utf8)
+mpdclient_cmd_load_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
 {
   mpd_sendLoadCommand(c->connection, filename_utf8);
   c->need_update = TRUE;
@@ -504,7 +519,7 @@ mpdclient_cmd_load_playlist(mpdclient_t *c, gchar *filename_utf8)
 }
 
 gint 
-mpdclient_cmd_delete_playlist(mpdclient_t *c, gchar *filename_utf8)
+mpdclient_cmd_delete_playlist_utf8(mpdclient_t *c, gchar *filename_utf8)
 {
   gint retval = 0;
 
@@ -514,6 +529,17 @@ mpdclient_cmd_delete_playlist(mpdclient_t *c, gchar *filename_utf8)
   return retval;
 }
 
+gint 
+mpdclient_cmd_delete_playlist(mpdclient_t *c, gchar *filename)
+{
+  gint retval = 0;
+  gchar *filename_utf8 = locale_to_utf8(filename);
+
+  retval = mpdclient_cmd_delete_playlist_utf8(c, filename_utf8);
+  g_free(filename_utf8);
+  return retval;
+}
+
 
 /****************************************************************************/
 /*** Callback managment functions *******************************************/
index c5df09ed800625a5f4a952167dc0fd96e1661a7c..c0d897d800f01fbb3888c03c089596132bd22acd 100644 (file)
@@ -81,17 +81,19 @@ gint mpdclient_cmd_clear(mpdclient_t *c);
 gint mpdclient_cmd_repeat(mpdclient_t *c, gint value);
 gint mpdclient_cmd_random(mpdclient_t *c, gint value);
 gint mpdclient_cmd_crossfade(mpdclient_t *c, gint value);
-gint mpdclient_cmd_db_update(mpdclient_t *c, gchar *path);
+gint mpdclient_cmd_db_update_utf8(mpdclient_t *c, gchar *path);
 gint mpdclient_cmd_volume(mpdclient_t *c, gint value);
 gint mpdclient_cmd_add_path(mpdclient_t *c, gchar *path);
+gint mpdclient_cmd_add_path_utf8(mpdclient_t *c, gchar *path);
 
 gint mpdclient_cmd_add(mpdclient_t *c, mpd_Song *song);
 gint mpdclient_cmd_delete(mpdclient_t *c, gint index);
 gint mpdclient_cmd_move(mpdclient_t *c, gint old_index, gint new_index);
 
 gint mpdclient_cmd_save_playlist(mpdclient_t *c, gchar *filename);
-gint mpdclient_cmd_load_playlist(mpdclient_t *c, gchar *filename_utf8);
-gint mpdclient_cmd_delete_playlist(mpdclient_t *c, gchar *filename_utf8);
+gint mpdclient_cmd_save_playlist_utf8(mpdclient_t *c, gchar *filename);
+gint mpdclient_cmd_load_playlist_utf8(mpdclient_t *c, gchar *filename_utf8);
+gint mpdclient_cmd_delete_playlist_utf8(mpdclient_t *c, gchar *filename_utf8);
 
 
 /*** error callbacks *****************************************************/ 
index 43383d93c4e8b1460a651e938feeb75823190068..8d517c950518d11e6839aab315e0df1bb6e10833 100644 (file)
@@ -782,7 +782,7 @@ screen_cmd(mpdclient_t *c, command_t cmd)
     case CMD_DB_UPDATE:
       if( !c->status->updatingDb )
        {
-         if( mpdclient_cmd_db_update(c,NULL)==0 )
+         if( mpdclient_cmd_db_update_utf8(c,NULL)==0 )
            screen_status_printf(_("Database update started!"));
        }
       else
index ebde970966af4d21528794a63cd549617462ca04..9f1d0b209403ef7c3460386f8a854b14de02ff5f 100644 (file)
@@ -277,7 +277,7 @@ load_playlist(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry)
   mpd_PlaylistFile *plf = entity->info.playlistFile;
   char *filename = utf8_to_locale(plf->path);
 
-  if( mpdclient_cmd_load_playlist(c, plf->path) == 0 )
+  if( mpdclient_cmd_load_playlist_utf8(c, plf->path) == 0 )
     screen_status_printf(_("Loading playlist %s..."), basename(filename));
   g_free(filename);
   return 0;
@@ -318,7 +318,7 @@ handle_delete(screen_t *screen, mpdclient_t *c)
       return 0;
     }
 
-  if( mpdclient_cmd_delete_playlist(c, plf->path) )
+  if( mpdclient_cmd_delete_playlist_utf8(c, plf->path) )
     {
       return -1;
     }
@@ -418,9 +418,9 @@ handle_select(screen_t *screen, mpdclient_t *c)
     {
       mpd_Directory *dir = entry->entity->info.directory;
 #ifdef USE_OLD_ADD
-      add_directory(c, dir->path);
+      add_directory(c, tmp);
 #else
-      if( mpdclient_cmd_add_path(c, dir->path) == 0 )
+      if( mpdclient_cmd_add_path_utf8(c, dir->path) == 0 )
        {
          char *tmp = utf8_to_locale(dir->path);
 
@@ -579,7 +579,7 @@ browse_cmd(screen_t *screen, mpdclient_t *c, command_t cmd)
     case CMD_DB_UPDATE:
       if( !c->status->updatingDb )
        {
-         if( mpdclient_cmd_db_update(c,filelist->path)==0 )
+         if( mpdclient_cmd_db_update_utf8(c,filelist->path)==0 )
            {
              screen_status_printf(_("Database update of %s started!"),
                                   filelist->path);
index 60d0e2586c838c00c09bda736710d584b0ecaab6..b11229841b2511b5c5de3f64ce947d738cfa2aa1 100644 (file)
@@ -183,15 +183,11 @@ handle_save_playlist(screen_t *screen, mpdclient_t *c, char *name)
          key = tolower(screen_getch(screen->status_window.w, buf));
          if( key == YES[0] )
            {
-             char *filename_utf8 = locale_to_utf8(filename);
-             
-             if( mpdclient_cmd_delete_playlist(c, filename_utf8) )
+             if( mpdclient_cmd_delete_playlist(c, filename) )
                {
                  g_free(filename);
-                 g_free(filename_utf8);
                  return -1;
                }
-             g_free(filename_utf8);
              error = handle_save_playlist(screen, c, filename);
              g_free(filename);
              return error;