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

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

Moved coverart and coverart_template to new prefs.


Index: file.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/file.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -u -d -r1.171 -r1.172
--- file.c      11 Jun 2006 16:04:47 -0000      1.171
+++ file.c      11 Jun 2006 23:17:39 -0000      1.172
@@ -929,7 +929,7 @@
 static void add_artwork (Track *tr)
 {
     ExtraTrackData *etr;
-    const gchar *full_template;
+    gchar *full_template;
     gchar **templates, **tplp;
     gchar *dirname;
     gchar *filename_local = NULL;
@@ -940,7 +940,7 @@
 
     dirname = g_path_get_dirname (etr->pc_path_utf8);
 
-    full_template = prefs_get_coverart_template ();
+    full_template = prefs_get_string("coverart_template");
 
     templates = g_strsplit (full_template, ";", 0);
     tplp = templates;
@@ -991,6 +991,7 @@
     }
 
     g_strfreev (templates);
+    g_free(full_template);
 }
 
 
@@ -1119,7 +1120,7 @@
        set_unset_entries_from_filename (nti);
 
        /* Set coverart */
-       if (prefs_get_coverart())
+       if (prefs_get_int("coverart"))
        {
            add_artwork (nti);
        }

Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.224
retrieving revision 1.225
diff -u -d -r1.224 -r1.225
--- prefs.c     11 Jun 2006 05:18:55 -0000      1.224
+++ prefs.c     11 Jun 2006 23:17:40 -0000      1.225
@@ -220,6 +220,8 @@
     prefs_set_int("parsetags", FALSE);
     prefs_set_int("parsetags_overwrite", FALSE);
     prefs_set_string("parsetags_template", "%a - %A/%T %t.mp3;%t.wav");
+    prefs_set_int("coverart", TRUE);
+    prefs_set_string("coverart_template", "%A;folder.jpg");
 }
 
 /* Initialize default variable-length list entries */
@@ -1778,8 +1780,6 @@
     mycfg->md5tracks = TRUE;
     mycfg->block_display = FALSE;
     mycfg->offline = FALSE;
-    mycfg->coverart = TRUE;
-    mycfg->coverart_template = g_strdup ("%A;folder.jpg");
     mycfg->display_toolbar = TRUE;
     mycfg->toolbar_style = GTK_TOOLBAR_BOTH;
     mycfg->display_tooltips_main = TRUE;
@@ -1971,14 +1971,6 @@
          {
              prefs_set_block_display((gboolean)atoi(arg));
          }
-         else if(g_ascii_strcasecmp (line, "coverart") == 0)
-         {
-             prefs_set_coverart((gboolean)atoi(arg));
-         }
-         else if(g_ascii_strcasecmp (line, "coverart_template") == 0)
-         {
-             prefs_set_coverart_template(strdup(arg));
-         }
          else if(g_ascii_strcasecmp (line, "offline") == 0)
          {
              prefs_set_offline((gboolean)atoi(arg));
@@ -2285,8 +2277,6 @@
     }
     fprintf(fp, "md5=%d\n",prefs_get_md5tracks ());
     fprintf(fp, "block_display=%d\n",prefs_get_block_display());
-    fprintf(fp, "coverart=%d\n", prefs_get_coverart());
-    fprintf(fp, "coverart_template=%s\n",cfg->coverart_template);
     fprintf(fp, "group_compilations=%d\n",prefs_get_group_compilations());
     fprintf(fp, "last_prefs_page=%d\n",prefs_get_last_prefs_page());
     fprintf(fp, "offline=%d\n",prefs_get_offline());
@@ -2458,7 +2448,6 @@
     {
        result = g_memdup (cfg, sizeof (struct cfg));
        result->charset = g_strdup(cfg->charset);
-       result->coverart_template = g_strdup(cfg->coverart_template);
        result->mserv_username = g_strdup(cfg->mserv_username);
     }
     return(result);
@@ -2504,30 +2493,6 @@
   return cfgdir;
 }
 
-void prefs_set_coverart(gboolean active)
-{
-  cfg->coverart = active;
-}
-
-gboolean prefs_get_coverart(void)
-{
-  return cfg->coverart;
-}
-
-const gchar *prefs_get_coverart_template (void)
-{
-    return cfg->coverart_template;
-}
-
-void prefs_set_coverart_template (const gchar *tpl)
-{
-    if (tpl)
-    {
-       g_free(cfg->coverart_template);
-       cfg->coverart_template = g_strdup (tpl);
-    }
-}
-
 /* A value of "0" will set the default defined in misc.c */
 void prefs_set_statusbar_timeout (guint32 val)
 {

Index: prefs.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.h,v
retrieving revision 1.150
retrieving revision 1.151
diff -u -d -r1.150 -r1.151
--- prefs.h     11 Jun 2006 05:18:55 -0000      1.150
+++ prefs.h     11 Jun 2006 23:17:40 -0000      1.151
@@ -110,10 +110,6 @@
   gboolean info_window;   /* is info window open (will then open on restart */
   gboolean offline;       /* are we working offline, i.e. without iPod? */
 
-  gchar   *parsetags_template;  /* template for parsing tags */
-  gboolean coverart;            /* Read coverart when adding files? */
-  gchar *coverart_template;     /* template for coverart filename   */
-
   gboolean display_toolbar;     /* should toolbar be displayed */
   GtkToolbarStyle toolbar_style;/* style of toolbar */
   gboolean display_tooltips_main; /* should tooltips be displayed (main) */
@@ -286,10 +282,6 @@
 void prefs_set_tm_autostore (gboolean active);
 void prefs_set_md5tracks(gboolean active);
 void prefs_set_block_display(gboolean active);
-void prefs_set_coverart (gboolean active);
-gboolean prefs_get_coverart(void);
-void prefs_set_coverart_template (const gchar *tpl);
-const gchar *prefs_get_coverart_template (void);
 void prefs_set_charset (gchar *charset);
 void prefs_cfg_set_charset (struct cfg *cfg, gchar *charset);
 void prefs_set_statusbar_timeout (guint32 val);

Index: prefs_window.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs_window.c,v
retrieving revision 1.145
retrieving revision 1.146
diff -u -d -r1.145 -r1.146
--- prefs_window.c      11 Jun 2006 16:04:51 -0000      1.145
+++ prefs_window.c      11 Jun 2006 23:17:40 -0000      1.146
@@ -575,18 +575,13 @@
 
     w = gtkpod_xml_get_widget (prefs_window_xml, "coverart");
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
-                                tmpcfg->coverart);
+                                prefs_get_int("coverart"));
 
     w = gtkpod_xml_get_widget (prefs_window_xml, "coverart_template");
-    if (tmpcfg->coverart_template)
-    {  /* we should copy the new path first because by setting
-         the text we might get a callback destroying the old
-         value... */
-       buf = g_strdup (tmpcfg->coverart_template);
-       gtk_entry_set_text(GTK_ENTRY(w), buf);
-       g_free (buf);
-    }
-    gtk_widget_set_sensitive (w, tmpcfg->coverart);
+    buf = prefs_get_string("coverart_template");
+    gtk_entry_set_text(GTK_ENTRY(w), buf);
+    g_free(buf);
+    gtk_widget_set_sensitive (w, prefs_get_int("coverart"));
 
     for (i=0; i<TM_NUM_COLUMNS; ++i)
     {
@@ -703,9 +698,6 @@
        tm_store_col_order ();
        prefs_set_charset(tmpcfg->charset);
 
-       prefs_set_coverart(tmpcfg->coverart);
-       prefs_set_coverart_template(tmpcfg->coverart_template);
-
        /* this call well automatically destroy/setup the md5 hash table */
        prefs_set_md5tracks(tmpcfg->md5tracks);
        prefs_set_block_display(tmpcfg->block_display);
@@ -1177,7 +1169,7 @@
     gboolean val = gtk_toggle_button_get_active(togglebutton);
     GtkWidget *w;
 
-    tmpcfg->coverart = val;
+    temp_prefs_set_int(temp_prefs, "coverart", val);
     w = gtkpod_xml_get_widget (prefs_window_xml, "coverart_template");
     gtk_widget_set_sensitive (w, val);
 }
@@ -1186,8 +1178,8 @@
 on_coverart_template_changed             (GtkEditable     *editable,
                                        gpointer         user_data)
 {
-    g_free (tmpcfg->coverart_template);
-    tmpcfg->coverart_template = gtk_editable_get_chars (editable,0, -1);
+    temp_prefs_set_string(temp_prefs, "coverart_template",
+                         gtk_editable_get_chars (editable,0, -1));
 }
 
 void prefs_window_set_col_visible (gint column, gboolean visible)



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

Reply via email to