Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv5898/src

Modified Files:
        md5.c md5.h prefs.c prefs.h prefs_window.c 
Log Message:

Fixed the fallout from the charset fiasco:
        - MD5 checksums work again
        - Reapplied other patches trashed by the reversal
        - Old prefs is now just a stub (will be removed shortly)


Index: md5.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/md5.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- md5.c       21 Jun 2006 04:50:09 -0000      1.43
+++ md5.c       25 Jun 2006 23:29:08 -0000      1.44
@@ -93,7 +93,7 @@
 #define PATH_MAX_MD5 4096
 
 /* Set up or destory the md5 hash table */
-void setup_md5(gboolean active)
+void setup_md5()
 {
     struct itdbs_head *itdbs_head;
 
@@ -104,7 +104,7 @@
     /* gets called before itdbs are set up -> fail silently */
     if (itdbs_head)
     {
-       if (active)  /* MD5 hashing turned on */
+       if (prefs_get_int("md5"))  /* MD5 hashing turned on */
        {
            gp_md5_hash_tracks();
        

Index: md5.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/md5.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- md5.h       21 Jun 2006 04:50:09 -0000      1.21
+++ md5.h       25 Jun 2006 23:29:08 -0000      1.22
@@ -33,7 +33,7 @@
 
 #include "display_itdb.h"
 
-void setup_md5(gboolean active);
+void setup_md5();
 gchar *md5_hash_on_filename (gchar *name, gboolean silent);
 /* Any calls to the following functions immediately return if md5sums
  * is not on */

Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.265
retrieving revision 1.266
diff -u -d -r1.265 -r1.266
--- prefs.c     25 Jun 2006 16:08:22 -0000      1.265
+++ prefs.c     25 Jun 2006 23:29:08 -0000      1.266
@@ -150,8 +150,9 @@
 /* Set default prefrences */
 static void set_default_preferences()
 {
-    int i; 
-  
+    int i;
+    gchar *dir; /* Last directory browsed to */
+
     prefs_set_int("update_existing", FALSE);
     prefs_set_int("id3_write", FALSE);
     prefs_set_int("id3_write_id3v24", FALSE);
@@ -261,7 +262,19 @@
     prefs_set_int("display_toolbar", TRUE);
     prefs_set_int("toolbar_style", GTK_TOOLBAR_BOTH);
     prefs_set_int("block_display", FALSE);
+    prefs_set_int("md5", TRUE);
+
+    /* Set last browsed directory */
+    dir = g_get_current_dir();
 
+    if (dir)
+    {
+       prefs_set_string("last_dir_browsed", dir);
+       g_free(dir);
+    }
+    else
+       prefs_set_string("last_dir_browsed", g_get_home_dir());
+    
     /* Set sorting prefs */
     prefs_set_int("case_sensitive", FALSE);
     prefs_set_int("tm_autostore", FALSE);
@@ -1816,7 +1829,7 @@
                
        string_iter++;
     }
-       
+    
     return list;
 }
 
@@ -1835,27 +1848,9 @@
 struct cfg *cfg_new(void)
 {
     struct cfg *mycfg = NULL;
-    gchar curdir[PATH_MAX];
-    gchar *cfgdir;
-
-    cfgdir = prefs_get_cfgdir ();
 
     mycfg = g_malloc0 (sizeof (struct cfg));
-    if(getcwd(curdir, PATH_MAX))
-    {
-       prefs_set_string ("last_dir_browsed", curdir);
-    }
-    else
-    {
-       gchar *dir = convert_filename ("~/");
-       prefs_set_string ("last_dir_browsed", dir);
-       g_free (dir);
-    }
-
-    mycfg->charset = NULL;    
-    mycfg->md5tracks = TRUE;
 
-    g_free (cfgdir);
 
     return(mycfg);
 }
@@ -1964,10 +1959,6 @@
          {
              /* obsoleted since 0.71 */
          }
-         else if(g_ascii_strcasecmp (line, "md5") == 0)
-         {
-             prefs_set_md5tracks((gboolean)atoi(arg));
-         }
          else if(g_ascii_strcasecmp (line, "pm_autostore") == 0)
          {
              /* ignore */
@@ -1976,23 +1967,10 @@
          {
              /* removed with version after 0.82-CVS */
          }
-         else if(g_ascii_strcasecmp (line, "dir_browse") == 0)
-         {
-             prefs_set_string ("last_dir_browsed", arg);
-         }
-         else if(g_ascii_strcasecmp (line, "dir_export") == 0)
-         {
-             prefs_set_string (EXPORT_FILES_PATH, arg);
-         }
          else if(g_ascii_strcasecmp (line, "save_sorted_order") == 0)
          {
              /* ignore option -- has been deleted with 0.53 */
          }
-         else if(g_ascii_strcasecmp (line, "export_check_existing") == 0)
-         {
-             prefs_set_int (EXPORT_FILES_CHECK_EXISTING,
-                                  atoi (arg));
-         }
          else if(g_ascii_strcasecmp (line, "fix_path") == 0)
          {
              /* ignore -- wie always fix the export path (replace
@@ -2002,15 +1980,6 @@
          {
              /* ignore -- not used any more */
          }
-         else if(g_ascii_strcasecmp (line, "concal_autosync") == 0)
-         {
-             prefs_set_int ("itdb_0_concal_autosync", atoi(arg));
-         }
-         else if(g_ascii_strcasecmp (line, "special_export_charset") == 0)
-         {
-             prefs_set_int (EXPORT_FILES_SPECIAL_CHARSET,
-                                  atoi (arg));
-         }
          else
          {   /* All leftover options will be stored into the prefs
                 setting hash (generic options -- should have had this
@@ -2143,14 +2112,6 @@
     if(!fp)
        fp = stderr;
 
-
-    if (cfg->charset)
-    {
-       fprintf(fp, "charset=%s\n", cfg->charset);
-    } else {
-       fprintf(fp, "charset=\n");
-    }
-    fprintf(fp, "md5=%d\n",prefs_get_md5tracks ());
 }
 
 
@@ -2192,48 +2153,10 @@
 {
     if(c)
     {
-      g_free (c->charset);
       g_free (c);
     }
 }
 
-/* If the status of md5 hash flag changes, free or re-init the md5
-   hash table */
-void prefs_set_md5tracks (gboolean active)
-{
-    struct itdbs_head *itdbs_head;
-
-    g_return_if_fail (gtkpod_window);
-    itdbs_head = g_object_get_data (G_OBJECT (gtkpod_window),
-                                   "itdbs_head");
-/*    g_return_if_fail (itdbs_head);*/
-    /* gets called before itdbs are set up -> fail silently */
-    if (!itdbs_head)
-    {
-       cfg->md5tracks = active;
-       return;
-    }
-
-    if (cfg->md5tracks && !active)
-    { /* md5 checksums have been turned off */
-       cfg->md5tracks = FALSE;
-       gp_md5_free_hash ();
-    }
-    if (!cfg->md5tracks && active)
-    { /* md5 checksums have been turned on */
-       cfg->md5tracks = TRUE; /* must be set before calling
-                                 gp_md5_hash_tracks() */
-       gp_md5_hash_tracks ();
-       /* display duplicates */
-       gp_duplicate_remove (NULL, NULL);
-    }
-}
-
-gboolean prefs_get_md5tracks(void)
-{
-    return cfg->md5tracks;
-}
-
 struct cfg *clone_prefs(void)
 {
     struct cfg *result = NULL;
@@ -2241,7 +2164,6 @@
     if(cfg)
     {
        result = g_memdup (cfg, sizeof (struct cfg));
-       result->charset = g_strdup(cfg->charset);
     }
     return(result);
 }

Index: prefs.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.h,v
retrieving revision 1.189
retrieving revision 1.190
diff -u -d -r1.189 -r1.190
--- prefs.h     25 Jun 2006 16:08:22 -0000      1.189
+++ prefs.h     25 Jun 2006 23:29:08 -0000      1.190
@@ -59,8 +59,6 @@
 
 struct cfg
 {
-  gchar    *charset;        /* CHARSET to use with file operations */
-  gboolean md5tracks;      /* don't allow track duplication on your ipod */
   float version;            /* version of gtkpod writing the cfg file */
 };
 

Index: prefs_window.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs_window.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -d -r1.179 -r1.180
--- prefs_window.c      25 Jun 2006 05:56:42 -0000      1.179
+++ prefs_window.c      25 Jun 2006 23:29:08 -0000      1.180
@@ -34,6 +34,7 @@
 #include "display_itdb.h"
 #include "info.h"
 #include "fileselection.h"
+#include "md5.h"
 #include "misc.h"
 #include "misc_track.h"
 #include "prefs.h"
@@ -374,7 +375,7 @@
     
     w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_md5tracks");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
-                                tmpcfg->md5tracks);
+                                prefs_get_int("md5"));
 
     w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_update_existing");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
@@ -383,7 +384,7 @@
     w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_show_duplicates");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
                                 prefs_get_int("show_duplicates"));
-    if (!tmpcfg->md5tracks) gtk_widget_set_sensitive (w, FALSE);
+    if (!prefs_get_int("md5")) gtk_widget_set_sensitive (w, FALSE);
 
     w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_show_updated");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
@@ -687,14 +688,16 @@
      /* Update the display if we changed the number of sort tabs */
      if (temp_prefs_get_int_value(temp_prefs, "sort_tab_num", NULL))
       st_show_visible();
+
+     /* Set up/free md5 hash table if changed */
+     if (temp_prefs_get_int_value(temp_prefs, "md5", NULL))
+        setup_md5();
    }
   
    /* Need this in case user reordered column order (we don't
     * catch the reorder signal) */
    tm_store_col_order ();
 
-   /* this call well automatically destroy/setup the md5 hash table */
-   prefs_set_md5tracks(tmpcfg->md5tracks);
    tm_show_preferred_columns();
    st_show_visible();
    display_show_hide_tooltips();
@@ -960,7 +963,7 @@
     gboolean val = gtk_toggle_button_get_active(togglebutton);
     GtkWidget *w = gtkpod_xml_get_widget (prefs_window_xml, 
"cfg_show_duplicates");
 
-    tmpcfg->md5tracks = val;
+    temp_prefs_set_int(temp_prefs, "md5", val);
     if(w)      gtk_widget_set_sensitive (w, val);
 }
 


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to