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

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

Move tag_autoset to new prefs.


Index: file.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/file.c,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -d -r1.165 -r1.166
--- file.c      6 Jun 2006 12:53:54 -0000       1.165
+++ file.c      8 Jun 2006 05:53:49 -0000       1.166
@@ -661,7 +661,7 @@
     etr = track->userdata;
     g_return_if_fail (etr);
 
-    if (prefs_get_autosettags (column) &&
+    if (prefs_get_int_index("tag_autoset", column) &&
        etr->pc_path_utf8 && strlen (etr->pc_path_utf8))
     {
        switch (column)
@@ -695,18 +695,21 @@
 {
     /* try to fill tags from filename */
     if (prefs_get_parsetags ())
-       parse_filename (track);
+                       parse_filename (track);
     /* fill up what is left unset */
-    if (!track->album && prefs_get_autosettags (TM_COLUMN_ALBUM))
-       set_entry_from_filename (track, TM_COLUMN_ALBUM);
-    if (!track->artist && prefs_get_autosettags (TM_COLUMN_ARTIST))
-       set_entry_from_filename (track, TM_COLUMN_ARTIST);
-    if (!track->title && prefs_get_autosettags (TM_COLUMN_TITLE))
-       set_entry_from_filename (track, TM_COLUMN_TITLE);
-    if (!track->genre && prefs_get_autosettags (TM_COLUMN_GENRE))
-       set_entry_from_filename (track, TM_COLUMN_GENRE);
-    if (!track->composer && prefs_get_autosettags (TM_COLUMN_COMPOSER))
-       set_entry_from_filename (track, TM_COLUMN_COMPOSER);
+    if (!track->album && prefs_get_int_index("tag_autoset", TM_COLUMN_ALBUM))
+                       set_entry_from_filename (track, TM_COLUMN_ALBUM);
+    if (!track->artist && prefs_get_int_index("tag_autoset", TM_COLUMN_ARTIST))
+                       set_entry_from_filename (track, TM_COLUMN_ARTIST);
+    if (!track->title && prefs_get_int_index("tag_autoset", TM_COLUMN_TITLE))
+                       set_entry_from_filename (track, TM_COLUMN_TITLE);
+    if (!track->genre && prefs_get_int_index("tag_autoset", TM_COLUMN_GENRE))
+                       set_entry_from_filename (track, TM_COLUMN_GENRE);
+    if (!track->composer && prefs_get_int_index("tag_autoset", 
+                                                                               
                                                                                
                                TM_COLUMN_COMPOSER))
+               {
+                       set_entry_from_filename (track, TM_COLUMN_COMPOSER);
+               }
 }
 
 

Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.204
retrieving revision 1.205
diff -u -d -r1.204 -r1.205
--- prefs.c     8 Jun 2006 04:31:44 -0000       1.204
+++ prefs.c     8 Jun 2006 05:53:49 -0000       1.205
@@ -179,6 +179,11 @@
       prefs_set_int_index("col_visible", i, FALSE);
       prefs_set_int_index("col_order", i, i);
     }
+               
+               for (i = 0; i < TM_NUM_TAGS_PREFS; i++)
+                       prefs_set_int_index("tag_autoset", i, FALSE);
+               
+               prefs_set_int_index("tag_autoset", TM_COLUMN_TITLE, TRUE);
     
     prefs_set_int_index("col_visible", TM_COLUMN_ARTIST, TRUE);
     prefs_set_int_index("col_visible", TM_COLUMN_ALBUM, TRUE);
@@ -1712,7 +1717,6 @@
     struct cfg *mycfg = NULL;
     gchar curdir[PATH_MAX];
     gchar *cfgdir;
-    gint i;
 
     cfgdir = prefs_get_cfgdir ();
 
@@ -1749,11 +1753,6 @@
     mycfg->size_prefs.y = 480;
     mycfg->size_info.x = 510;
     mycfg->size_info.y = 300;
-    for (i=0; i<TM_NUM_TAGS_PREFS; ++i)
-    {
-       mycfg->autosettags[i] = FALSE;
-    }
-    mycfg->autosettags[TM_COLUMN_TITLE] = TRUE;
     mycfg->readtags = TRUE;
     mycfg->parsetags = FALSE;
     mycfg->parsetags_overwrite = FALSE;
@@ -1855,7 +1854,7 @@
 {
     gchar buf[PATH_MAX];
     gchar *line, *arg, *bufp;
-    gint len, off, i;
+    gint len, i;
 
     /* set ignore strings */
     for (i=0; sort_ign_strings[i]; ++i)
@@ -1962,11 +1961,6 @@
          {
              prefs_set_mpl_autoselect((gboolean)atoi(arg));
          }
-         else if(arg_comp (line, "tag_autoset", &off) == 0)
-         {
-             gint i = atoi (line+off);
-             prefs_set_autosettags (i, atoi (arg));
-         }
          else if(g_ascii_strcasecmp (line, "readtags") == 0)
          {
              prefs_set_readtags((gboolean)atoi(arg));
@@ -2352,7 +2346,6 @@
 static void
 write_prefs_to_file_desc(FILE *fp)
 {
-    gint i;
 
     if(!fp)
        fp = stderr;
@@ -2372,8 +2365,6 @@
 
     fprintf(fp, _("# autoselect master playlist?\n"));
     fprintf(fp, "mpl_autoselect=%d\n", prefs_get_mpl_autoselect ());
-       if (i < TM_NUM_TAGS_PREFS)
-           fprintf(fp, "tag_autoset%d=%d\n", i, prefs_get_autosettags (i));
   
     fprintf(fp, "readtags=%d\n", prefs_get_readtags());
     fprintf(fp, "parsetags=%d\n", prefs_get_parsetags());
@@ -2771,25 +2762,6 @@
     *y = cfg->size_info.y;
 }
 
-
-/* Should empty tags be set to filename? -- "category": one of the
-   TM_COLUMN_..., "autoset": new value */
-void prefs_set_autosettags (gint category, gboolean autoset)
-{
-    if (category < TM_NUM_TAGS_PREFS)
-       cfg->autosettags[category] = autoset;
-}
-
-
-/* Should empty tags be set to filename? -- "category": one of the
-   TM_COLUMN_... */
-gboolean prefs_get_autosettags (gint category)
-{
-    if (category < TM_NUM_TAGS_PREFS)
-       return cfg->autosettags[category];
-    return FALSE;
-}
-
 void prefs_set_readtags(gboolean active)
 {
   cfg->readtags = active;

Index: prefs.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.h,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- prefs.h     8 Jun 2006 04:31:44 -0000       1.131
+++ prefs.h     8 Jun 2006 05:53:49 -0000       1.132
@@ -138,7 +138,6 @@
   gboolean parsetags_overwrite; /* Overwrite tags already set? */
   gboolean coverart;            /* Read coverart when adding files? */
   gchar *coverart_template;     /* template for coverart filename   */
-  gboolean autosettags[TM_NUM_TAGS_PREFS]; /* autoset empty tags to filename?*/
 
   gboolean display_toolbar;     /* should toolbar be displayed */
   GtkToolbarStyle toolbar_style;/* style of toolbar */
@@ -324,8 +323,6 @@
 gboolean prefs_get_parsetags(void);
 void prefs_set_parsetags_overwrite (gboolean active);
 gboolean prefs_get_parsetags_overwrite(void);
-void prefs_set_autosettags (gint category, gboolean autoset);
-gboolean prefs_get_autosettags (gint category);
 void prefs_set_parsetags_template (const gchar *tpl);
 const gchar *prefs_get_parsetags_template (void);
 void prefs_set_coverart (gboolean active);

Index: prefs_window.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs_window.c,v
retrieving revision 1.133
retrieving revision 1.134
diff -u -d -r1.133 -r1.134
--- prefs_window.c      7 Jun 2006 05:03:43 -0000       1.133
+++ prefs_window.c      8 Jun 2006 05:53:49 -0000       1.134
@@ -538,7 +538,7 @@
        if((w = gtkpod_xml_get_widget (prefs_window_xml, buf)))
        {
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
-                                        tmpcfg->autosettags[i]);
+                                        prefs_get_int_index("tag_autoset", i));
            /* glade makes a "GTK_OBJECT (i)" which segfaults
               because "i" is not a GTK object. So we have to set up
               the signal handlers ourselves */
@@ -706,15 +706,12 @@
   
    if (tmpcfg)
     {
-       gint i;
        /* Need this in case user reordered column order (we don't
         * catch the reorder signal) */
        tm_store_col_order ();
        prefs_set_charset(tmpcfg->charset);
        prefs_set_autoimport(tmpcfg->autoimport);
-       for (i=0; i<TM_NUM_TAGS_PREFS; ++i) {
-           prefs_set_autosettags (i, tmpcfg->autosettags[i]);
-       }
+
        prefs_set_readtags(tmpcfg->readtags);
        prefs_set_parsetags(tmpcfg->parsetags);
        prefs_set_parsetags_overwrite(tmpcfg->parsetags_overwrite);
@@ -1144,7 +1141,7 @@
 void prefs_window_set_autosettags (gint category, gboolean autoset)
 {
     if (category < TM_NUM_TAGS_PREFS)
-       tmpcfg->autosettags[category] = autoset;
+                       temp_prefs_set_int_index(temp_prefs, "tag_autoset", 
category, autoset);
 }
 
 void



_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to