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

Modified Files:
        display_sorttabs.c prefs.c prefs.h 
Log Message:

Move sp_*_cond to new prefs.


Index: display_sorttabs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_sorttabs.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- display_sorttabs.c  1 Jun 2006 07:18:04 -0000       1.69
+++ display_sorttabs.c  2 Jun 2006 01:47:34 -0000       1.70
@@ -428,7 +428,7 @@
     else       result = TRUE;   /* AND */
 
     /* RATING */
-    if (prefs_get_sp_cond (inst, T_RATING))
+    if (prefs_get_int_index("sp_rating_cond", inst))
     {
        /* checked = TRUE: at least one condition was checked */
        checked = TRUE;
@@ -442,7 +442,7 @@
     }
 
     /* PLAYCOUNT */
-    if (prefs_get_sp_cond (inst, T_PLAYCOUNT))
+    if (prefs_get_int_index("sp_playcount_cond", inst))
     {
        guint32 low = prefs_get_sp_playcount_low (inst);
        /* "-1" will translate into about 4 billion because I use
@@ -458,7 +458,7 @@
        if ((!sp_or) && (!cond)) return FALSE;
     }
     /* time played */
-    if (prefs_get_sp_cond (inst, T_TIME_PLAYED))
+    if (prefs_get_int_index("sp_played_cond", inst))
     {
        IntervalState result = sp_check_time (inst, T_TIME_PLAYED, track);
        if (sp_or && (result == IS_INSIDE))      return TRUE;
@@ -466,7 +466,7 @@
        if (result != IS_ERROR)                  checked = TRUE;
     }
     /* time modified */
-    if (prefs_get_sp_cond (inst, T_TIME_MODIFIED))
+    if (prefs_get_int_index("sp_modified_cond", inst))
     {
        IntervalState result = sp_check_time (inst, T_TIME_MODIFIED, track);
        if (sp_or && (result == IS_INSIDE))      return TRUE;
@@ -474,7 +474,7 @@
        if (result != IS_ERROR)                  checked = TRUE;
     }
     /* time added */
-    if (prefs_get_sp_cond (inst, T_TIME_ADDED))
+    if (prefs_get_int_index("sp_added_cond", inst))
     {
        IntervalState result = sp_check_time (inst, T_TIME_ADDED, track);
        if (sp_or && (result == IS_INSIDE))      return TRUE;
@@ -797,9 +797,31 @@
     guint32 inst = (guint32)(GPOINTER_TO_UINT(user_data) & SP_MASK);
     T_item cond = (guint32)GPOINTER_TO_UINT(user_data) >> SP_SHIFT;
 
-/*     printf ("%d/%d/%d\n",inst,cond,gtk_toggle_button_get_active 
(togglebutton)); */
-    prefs_set_sp_cond (inst, cond,
-                      gtk_toggle_button_get_active (togglebutton));
+  switch (cond)
+       {
+       case T_RATING:
+           prefs_set_int_index("sp_rating_cond", inst, 
+                          gtk_toggle_button_get_active(togglebutton));
+           break;
+       case T_PLAYCOUNT:
+           prefs_set_int_index("sp_playcount_cond", inst, 
+                          gtk_toggle_button_get_active(togglebutton));
+           break;
+       case T_TIME_PLAYED:
+           prefs_set_int_index("sp_played_cond", inst, 
+                          gtk_toggle_button_get_active(togglebutton));
+           break;
+       case T_TIME_MODIFIED:
+           prefs_set_int_index("sp_modified_cond", inst, 
+                          gtk_toggle_button_get_active(togglebutton));
+           break;
+       case T_TIME_ADDED:
+           prefs_set_int_index("sp_added_cond", inst, 
+                          gtk_toggle_button_get_active(togglebutton));
+           break;
+       default:
+           break;
+       }
     sp_conditions_changed (inst);
 }
 
@@ -812,7 +834,7 @@
 
     prefs_set_sp_rating_n (inst, n,
                           gtk_toggle_button_get_active (togglebutton));
-    if (prefs_get_sp_cond (inst, T_RATING))
+    if (prefs_get_int_index("sp_rating_cond", inst))
        sp_conditions_changed (inst);
 }
 
@@ -875,7 +897,7 @@
 
     prefs_set_sp_playcount_low (inst,
                                gtk_spin_button_get_value (spinbutton));
-    if (prefs_get_sp_cond (inst, T_PLAYCOUNT))
+    if (prefs_get_int_index("sp_playcount_cond", inst))
        sp_conditions_changed (inst);
 }
 
@@ -888,7 +910,7 @@
 
     prefs_set_sp_playcount_high (inst,
                                 gtk_spin_button_get_value (spinbutton));
-    if (prefs_get_sp_cond (inst, T_PLAYCOUNT))
+    if (prefs_get_int_index("sp_playcount_cond", inst))
        sp_conditions_changed (inst);
 }
 
@@ -2686,7 +2708,7 @@
                        "toggled", G_CALLBACK (on_sp_cond_button_toggled),
                        GUINT_TO_POINTER((T_RATING<<SP_SHIFT) + inst));
       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
-                                  prefs_get_sp_cond (inst, T_RATING));
+                                  prefs_get_int_index("sp_rating_cond", inst));
       for (i=0; i<=RATING_MAX; ++i)
       {
          gchar *buf = g_strdup_printf ("sp_rating%d", i);
@@ -2705,7 +2727,7 @@
                        "toggled", G_CALLBACK (on_sp_cond_button_toggled),
                        GUINT_TO_POINTER((T_PLAYCOUNT<<SP_SHIFT) + inst));
       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
-                                  prefs_get_sp_cond (inst, T_PLAYCOUNT));
+                                  prefs_get_int_index("sp_playcound_cond", 
inst));
       w = gtkpod_xml_get_widget (special_xml, "sp_playcount_low");
       g_signal_connect ((gpointer)w,
                        "value_changed",
@@ -2728,7 +2750,7 @@
                        "toggled", G_CALLBACK (on_sp_cond_button_toggled),
                        GUINT_TO_POINTER((T_TIME_PLAYED<<SP_SHIFT) + inst));
       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
-                                  prefs_get_sp_cond (inst, T_TIME_PLAYED));
+                                  prefs_get_int_index("sp_played_cond", inst));
       w = gtkpod_xml_get_widget (special_xml, "sp_played_entry");
       st->ti_played.entry = w;
       gtk_entry_set_text (GTK_ENTRY (w),
@@ -2749,7 +2771,7 @@
                        "toggled", G_CALLBACK (on_sp_cond_button_toggled),
                        GUINT_TO_POINTER((T_TIME_MODIFIED<<SP_SHIFT) + inst));
       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
-                                  prefs_get_sp_cond (inst, T_TIME_MODIFIED));
+                                  prefs_get_int_index("sp_modified_cond", 
inst));
       w = gtkpod_xml_get_widget (special_xml, "sp_modified_entry");
       st->ti_modified.entry = w;
       gtk_entry_set_text (GTK_ENTRY (w),
@@ -2770,7 +2792,7 @@
                        "toggled", G_CALLBACK (on_sp_cond_button_toggled),
                        GUINT_TO_POINTER((T_TIME_ADDED<<SP_SHIFT) + inst));
       gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
-                                  prefs_get_sp_cond (inst, T_TIME_ADDED));
+                                  prefs_get_int_index("sp_added_cond", inst));
       w = gtkpod_xml_get_widget (special_xml, "sp_added_entry");
       st->ti_added.entry = w;
       gtk_entry_set_text (GTK_ENTRY (w),

Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.192
retrieving revision 1.193
diff -u -d -r1.192 -r1.193
--- prefs.c     1 Jun 2006 07:18:04 -0000       1.192
+++ prefs.c     2 Jun 2006 01:47:35 -0000       1.193
@@ -588,6 +588,8 @@
 static void cleanup_keys()
 {
   gchar *buf;
+  gint int_buf;
+  gint i;
   float version=0;
 
   /* get version */
@@ -774,6 +776,13 @@
   if (prefs_get_string_value("mp3gain_path", NULL))
     prefs_set_string("mp3gain_path", NULL);
   
+  /* sp_created_cond renamed to sp_added_cond */
+  for (i = 0; i < SORT_TAB_MAX; i++)
+  {
+    if (prefs_get_int_value_index("sp_created_cond", i, &int_buf))
+      prefs_set_int_index("sp_added_cond", i, int_buf);
+  }
+  
   prefs_set_string ("version", VERSION);
 }
 
@@ -1890,32 +1899,6 @@
          {
              prefs_set_autoimport((gboolean)atoi(arg));
          }
-         else if(arg_comp (line, "sp_rating_cond", &off) == 0)
-         {
-             gint i = atoi (line+off);
-             prefs_set_sp_cond (i, T_RATING, atoi (arg));
-         }
-         else if(arg_comp (line, "sp_playcount_cond", &off) == 0)
-         {
-             gint i = atoi (line+off);
-             prefs_set_sp_cond (i, T_PLAYCOUNT, atoi (arg));
-         }
-         else if(arg_comp (line, "sp_played_cond", &off) == 0)
-         {
-             gint i = atoi (line+off);
-             prefs_set_sp_cond (i, T_TIME_PLAYED, atoi (arg));
-         }
-         else if(arg_comp (line, "sp_modified_cond", &off) == 0)
-         {
-             gint i = atoi (line+off);
-             prefs_set_sp_cond (i, T_TIME_MODIFIED, atoi (arg));
-         }
-         else if((arg_comp (line, "sp_created_cond", &off) == 0) ||
-                 arg_comp (line, "sp_added_cond", &off) == 0)
-         {
-             gint i = atoi (line+off);
-             prefs_set_sp_cond (i, T_TIME_ADDED, atoi (arg));
-         }
          else if(arg_comp (line, "sp_rating_state", &off) == 0)
          {
              gint i = atoi (line+off);
@@ -2428,16 +2411,11 @@
     fprintf(fp, _("# sort tab: select 'All', last selected page 
(=category)\n"));
     for (i=0; i<SORT_TAB_MAX; ++i)
     {
-       fprintf(fp, "sp_rating_cond%d=%d\n", i, prefs_get_sp_cond (i, 
T_RATING));
        fprintf(fp, "sp_rating_state%d=%d\n", i, prefs_get_sp_rating_state(i));
-       fprintf(fp, "sp_playcount_cond%d=%d\n", i, prefs_get_sp_cond (i, 
T_PLAYCOUNT));
        fprintf(fp, "sp_playcount_low%d=%d\n", i, prefs_get_sp_playcount_low 
(i));
        fprintf(fp, "sp_playcount_high%d=%d\n", i, prefs_get_sp_playcount_high 
(i));
-       fprintf(fp, "sp_played_cond%d=%d\n", i, prefs_get_sp_cond (i, 
T_TIME_PLAYED));
        fprintf(fp, "sp_played_state%d=%s\n", i, prefs_get_sp_entry (i, 
T_TIME_PLAYED));
-       fprintf(fp, "sp_modified_cond%d=%d\n", i, prefs_get_sp_cond (i, 
T_TIME_MODIFIED));
        fprintf(fp, "sp_modified_state%d=%s\n", i, prefs_get_sp_entry (i, 
T_TIME_MODIFIED));
-       fprintf(fp, "sp_added_cond%d=%d\n", i, prefs_get_sp_cond (i, 
T_TIME_ADDED));
        fprintf(fp, "sp_added_state%d=%s\n", i, prefs_get_sp_entry (i, 
T_TIME_ADDED));
        fprintf(fp, "sp_autodisplay%d=%d\n", i, prefs_get_sp_autodisplay (i));
     }

Index: prefs.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.h,v
retrieving revision 1.120
retrieving revision 1.121
diff -u -d -r1.120 -r1.121
--- prefs.h     1 Jun 2006 07:18:04 -0000       1.120
+++ prefs.h     2 Jun 2006 01:47:35 -0000       1.121
@@ -415,8 +415,6 @@
 void prefs_set_last_prefs_page (gint i);
 gboolean prefs_get_automount (void);
 gboolean prefs_get_info_window (void);
-void prefs_set_sp_cond (guint32 inst, T_item t_item, gboolean state);
-gboolean prefs_get_sp_cond (guint32 inst, T_item t_item);
 void prefs_set_sp_rating_n (guint32 inst, gint n, gboolean state);
 gboolean prefs_get_sp_rating_n (guint32 inst, gint n);
 void prefs_set_sp_rating_state (guint32 inst, guint32 state);



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

Reply via email to