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

Modified Files:
        file.c misc_confirm.c prefs.c prefs.h prefs_window.c 
Log Message:
         * applied James Liggett's preferences patches.



Index: file.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/file.c,v
retrieving revision 1.157
retrieving revision 1.158
diff -u -d -r1.157 -r1.158
--- file.c      5 Apr 2006 15:37:01 -0000       1.157
+++ file.c      19 Apr 2006 12:39:32 -0000      1.158
@@ -1379,14 +1379,14 @@
     g_return_if_fail (itdb);
 
     /* set "update existing" to TRUE */
-    update = prefs_get_update_existing();
-    prefs_set_update_existing (TRUE);
+    update = prefs_get_int("update_existing");
+    prefs_set_int("update_existing", TRUE);
 
     /* sync all dirs stored in the hash */
     g_hash_table_foreach (sd->hash_tosync, sync_dir, sd->pl);
 
     /* reset "update existing" */
-    prefs_set_update_existing (update);
+    prefs_set_int("update_existing", update);
 
     /* display log of non-updated tracks */
     display_non_updated (NULL, NULL);
@@ -2079,7 +2079,7 @@
      just add it to the current playlist (if it's not already there) */
   if (oldtrack)
   {
-      if (prefs_get_update_existing ())
+      if (prefs_get_int("update_existing"))
       {   /* update the information */
          update_track_from_file (itdb, oldtrack);
       }
@@ -2667,5 +2667,3 @@
     }
     return result;
 }
-
-

Index: misc_confirm.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/misc_confirm.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- misc_confirm.c      5 Apr 2006 14:24:47 -0000       1.28
+++ misc_confirm.c      19 Apr 2006 12:39:33 -0000      1.29
@@ -1079,8 +1079,8 @@
     {
        server_shutdown (); /* stop accepting requests for playcount updates */
 
-       write_prefs ();
        cleanup_prefs();
+       write_prefs();
 
 /* FIXME: release memory in a clean way */
 #if 0

Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.159
retrieving revision 1.160
diff -u -d -r1.159 -r1.160
--- prefs.c     5 Apr 2006 14:24:47 -0000       1.159
+++ prefs.c     19 Apr 2006 12:39:33 -0000      1.160
@@ -120,7 +120,7 @@
 /* Set default prefrences */
 static void set_default_prefrences()
 {
-       
+       prefs_set_int("update_existing", FALSE);
 }
 
 /* Initialize default variable-length list entries */
@@ -411,7 +411,7 @@
                
                if (filename)
                {
-                       fp = fopen(filename, "a");
+                       fp = fopen(filename, "w");
                        
                        if (fp)
                        {
@@ -1099,7 +1099,6 @@
     mycfg->deletion.database = TRUE;
     mycfg->deletion.syncing = TRUE;
     mycfg->md5tracks = TRUE;
-    mycfg->update_existing = FALSE;
     mycfg->block_display = FALSE;
     mycfg->autoimport = FALSE;
     for (i=0; i<SORT_TAB_MAX; ++i)
@@ -1441,10 +1440,6 @@
          {
              prefs_set_md5tracks((gboolean)atoi(arg));
          }
-         else if(g_ascii_strcasecmp (line, "update_existing") == 0)
-         {
-             prefs_set_update_existing((gboolean)atoi(arg));
-         }
          else if(g_ascii_strcasecmp (line, "block_display") == 0)
          {
              prefs_set_block_display((gboolean)atoi(arg));
@@ -2113,7 +2108,6 @@
     fprintf(fp, "id3=%d\n", prefs_get_id3_write ());
     fprintf(fp, "id3_write_id3v24=%d\n", prefs_get_id3_write_id3v24 ());
     fprintf(fp, "md5=%d\n",prefs_get_md5tracks ());
-    fprintf(fp, "update_existing=%d\n",prefs_get_update_existing ());
     fprintf(fp, "block_display=%d\n",prefs_get_block_display());
     fprintf(fp, _("# delete confirmation\n"));
     fprintf(fp, "delete_file=%d\n",prefs_get_track_playlist_deletion());
@@ -2245,7 +2239,7 @@
     cfgdir = prefs_get_cfgdir ();
 
     filename = g_build_filename (cfgdir, "prefs", NULL);
-    if((fp = fopen(filename, "w")))
+    if((fp = fopen(filename, "a")))
     {
        write_prefs_to_file_desc(fp);
        fclose(fp);
@@ -2379,16 +2373,6 @@
     return cfg->md5tracks;
 }
 
-void prefs_set_update_existing(gboolean active)
-{
-    cfg->update_existing = active;
-}
-
-gboolean prefs_get_update_existing(void)
-{
-    return cfg->update_existing;
-}
-
 /* Should the display be blocked (be insenstive) while it is updated
    after a selection (playlist, tab entry) change? */
 void prefs_set_block_display(gboolean active)

Index: prefs.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.h,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- prefs.h     5 Apr 2006 14:24:47 -0000       1.103
+++ prefs.h     19 Apr 2006 12:39:33 -0000      1.104
@@ -70,7 +70,6 @@
   gboolean id3_write;       /* should changes to ID3 tags be written to file */
   gboolean id3_write_id3v24;/* should all ID3 tags be updated */
   gboolean md5tracks;      /* don't allow track duplication on your ipod */
-  gboolean update_existing; /* when adding track, update existing track */
   gboolean block_display;   /* block display during change of selection? */
   gboolean tmp_disable_sort;/* tmp. disable sorting during change of slctn? */
   gboolean startup_messages;/* show startup messages/warnings? */
@@ -330,7 +329,6 @@
 void prefs_set_mpl_autoselect (gboolean autoselect);
 void prefs_set_st_category (guint32 inst, guint category);
 void prefs_set_md5tracks(gboolean active);
-void prefs_set_update_existing(gboolean active);
 void prefs_set_block_display(gboolean active);
 void prefs_set_id3_write (gboolean active);
 void prefs_set_id3_write_id3v24 (gboolean active);
@@ -394,7 +392,6 @@
 gboolean prefs_get_col_visible (TM_item tm_item);
 TM_item prefs_get_col_order (gint pos);
 gboolean prefs_get_md5tracks(void);
-gboolean prefs_get_update_existing(void);
 gboolean prefs_get_block_display(void);
 gint prefs_get_paned_pos (gint i);
 guint32 prefs_get_statusbar_timeout (void);

Index: prefs_window.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs_window.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- prefs_window.c      5 Apr 2006 14:24:47 -0000       1.115
+++ prefs_window.c      19 Apr 2006 12:39:33 -0000      1.116
@@ -49,6 +49,10 @@
 static struct sortcfg *tmpsortcfg = NULL;
 static struct sortcfg *origsortcfg = NULL;
 
+/* New prefs temp handling */
+static TempPrefs *temp_prefs;
+static TempLists *temp_lists;
+
 /* keeps the check buttons for "Select Entry 'All' in Sorttab %d" */
 static GtkWidget *autoselect_widget[SORT_TAB_MAX];
 
@@ -406,6 +410,10 @@
        }
        return;
     }
+               
+               /* Initialize temp prefs structures */
+               temp_prefs = create_temp_prefs();
+               temp_lists = create_temp_lists();
 
     if(!tmpcfg && !origcfg)
     {
@@ -458,7 +466,7 @@
 
     w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_update_existing");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
-                                tmpcfg->update_existing);
+                                prefs_get_int("update_existing"));
 
     w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_show_duplicates");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
@@ -468,12 +476,12 @@
     w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_show_updated");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
                                 tmpcfg->show_updated);
-    if (!tmpcfg->update_existing) gtk_widget_set_sensitive (w, FALSE);
+    if (!prefs_get_int("update_existing")) gtk_widget_set_sensitive (w, FALSE);
 
     w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_show_non_updated");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
                                 tmpcfg->show_non_updated);
-    if (!tmpcfg->update_existing) gtk_widget_set_sensitive (w, FALSE);
+    if (!prefs_get_int("update_existing")) gtk_widget_set_sensitive (w, FALSE);
 
     w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_show_sync_dirs");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
@@ -927,7 +935,6 @@
        prefs_set_show_sync_dirs(tmpcfg->show_sync_dirs);
        /* this call well automatically destroy/setup the md5 hash table */
        prefs_set_md5tracks(tmpcfg->md5tracks);
-       prefs_set_update_existing(tmpcfg->update_existing);
        prefs_set_block_display(tmpcfg->block_display);
        prefs_set_sort_tab_num(tmpcfg->sort_tab_num, TRUE);
        prefs_set_group_compilations(tmpcfg->group_compilations, TRUE);
@@ -1027,6 +1034,12 @@
     tmpcfg = NULL;
     cfg_free (origcfg);
     origcfg = NULL;
+       
+               /* Delete temp prefs structures */
+               destroy_temp_prefs(temp_prefs);
+               temp_prefs = NULL;
+               destroy_temp_lists(temp_lists);
+               temp_lists = NULL;
 
     /* save current notebook page */
     nb = gtkpod_xml_get_widget (prefs_window_xml, "notebook");
@@ -1062,6 +1075,10 @@
     tmpcfg = NULL;
     cfg_free (origcfg);
     origcfg = NULL;
+       
+    /* Committ temp prefs to prefs table */
+    apply_temp_prefs(temp_prefs);
+    apply_temp_lists(temp_lists);
 
     /* save current notebook page */
     nb = gtkpod_xml_get_widget (prefs_window_xml, "notebook");
@@ -1094,6 +1111,10 @@
 
     /* save current settings */
     prefs_window_set ();
+       
+               /* Committ temp prefs to prefs table */
+               apply_temp_prefs(temp_prefs);
+               apply_temp_lists(temp_lists);
 
     /* reset the validated path entries */
     for (i=0; i<PATH_NUM; ++i)
@@ -1340,7 +1361,7 @@
     gboolean val = gtk_toggle_button_get_active (togglebutton);
     GtkWidget *w;
 
-    tmpcfg->update_existing = val;
+    temp_prefs_set_int(temp_prefs, "update_existing", val);
 
     if((w = gtkpod_xml_get_widget (prefs_window_xml, "cfg_show_updated")))
        gtk_widget_set_sensitive (w, val);



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to