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

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

Moved tm_sortcol and tm_sort to new prefs.


Index: display_songs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_songs.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- display_songs.c     13 Jun 2006 04:19:35 -0000      1.107
+++ display_songs.c     14 Jun 2006 02:52:55 -0000      1.108
@@ -1638,7 +1638,7 @@
 
 void tm_adopt_order_in_sorttab (void)
 {
-    if (prefs_get_tm_sort () == SORT_NONE)
+    if (prefs_get_int("tm_sort_") == SORT_NONE)
     {
        GList *gl, *tracks = NULL;
 
@@ -1660,7 +1660,7 @@
     {
        GtkTreeModel *model= gtk_tree_view_get_model (track_treeview);
 
-       prefs_set_tm_sort (SORT_NONE);
+       prefs_set_int("tm_sort_", SORT_NONE);
        if (!BROKEN_GTK_TREE_SORT)
        {
 /* no need to comment this out -- searching still works, but for lack
@@ -1778,9 +1778,9 @@
     }
     else
     {
-       prefs_set_tm_sort (order);
+       prefs_set_int("tm_sort_", order);
     }
-    prefs_set_tm_sortcol (newcol);
+    prefs_set_int("tm_sortcol", newcol);
 
     tm_set_search_column (newcol);
 
@@ -2177,7 +2177,7 @@
                    (gpointer)0);
 
   /* initialize sorting */
-  tm_sort (prefs_get_tm_sortcol (), prefs_get_tm_sort ());
+  tm_sort (prefs_get_int("tm_sortcol"), prefs_get_int("tm_sort_"));
   /* set correct column for typeahead */
   if (prefs_get_int_value (TM_PREFS_SEARCH_COLUMN, &col))
   {
@@ -2274,7 +2274,7 @@
            fprintf (stderr, "Programming error: disable_count < 0\n");
        if (disable_count == 0 && track_treeview)
        {
-           if ((prefs_get_tm_sort() != SORT_NONE) &&
+           if ((prefs_get_int("tm_sort_") != SORT_NONE) &&
                prefs_get_disable_sorting ())
            {
                /* Re-enable sorting */
@@ -2283,15 +2283,15 @@
                {
                    gtk_tree_sortable_set_sort_func (
                        GTK_TREE_SORTABLE (model),
-                       prefs_get_tm_sortcol (),
+                       prefs_get_int("tm_sortcol"),
                        tm_data_compare_func, NULL, NULL);
                }
                else
                {
                    gtk_tree_sortable_set_sort_column_id (
                        GTK_TREE_SORTABLE (model),
-                       prefs_get_tm_sortcol (),
-                       prefs_get_tm_sort ());
+                       prefs_get_int("tm_sortcol"),
+                       prefs_get_int("tm_sort_"));
                }
            }
        }
@@ -2300,7 +2300,7 @@
     {
        if (disable_count == 0 && track_treeview)
        {
-           if ((prefs_get_tm_sort() != SORT_NONE) &&
+           if ((prefs_get_int("tm_sort_") != SORT_NONE) &&
                prefs_get_disable_sorting ())
            {
                /* Disable sorting */
@@ -2309,7 +2309,7 @@
                {
                    gtk_tree_sortable_set_sort_func (
                        GTK_TREE_SORTABLE (model),
-                       prefs_get_tm_sortcol (),
+                       prefs_get_int("tm_sortcol"),
                        tm_nosort_comp, NULL, NULL);
                }
                else
@@ -2317,7 +2317,7 @@
                    gtk_tree_sortable_set_sort_column_id (
                        GTK_TREE_SORTABLE (model),
                        GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID,
-                       prefs_get_tm_sort ());
+                       prefs_get_int("tm_sort_"));
                }
            }
        }

Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.243
retrieving revision 1.244
diff -u -d -r1.243 -r1.244
--- prefs.c     13 Jun 2006 14:59:21 -0000      1.243
+++ prefs.c     14 Jun 2006 02:52:55 -0000      1.244
@@ -258,6 +258,8 @@
     prefs_set_int("tm_autostore", FALSE);
     prefs_set_int("st_sort", SORT_NONE);
     prefs_set_int("pm_sort", SORT_NONE);
+    prefs_set_int("tm_sortcol", TM_COLUMN_TITLE);
+    prefs_set_int("tm_sort_", SORT_NONE);
 }
 
 /* Initialize default variable-length list entries */
@@ -992,12 +994,32 @@
        prefs_set_string("sm_autostore", NULL);
     }
 
+    /* sm_sortcol renamed to tm_sortcol */
+    if (prefs_get_int_value("sm_sortcol", &int_buf))
+    {
+       prefs_set_int("tm_sortcol", int_buf);
+       prefs_set_string("sm_sortcol", NULL);
+    }
+
+    /* sm_sort_ renamed to tm_sort */
+    if (prefs_get_int_value("sm_sort_", &int_buf))
+    {
+       prefs_set_int("tm_sort_", int_buf);
+       prefs_set_string("sm_sort_", NULL);
+    }
+
     /* Correct sort order */
     sort = prefs_get_int("st_sort");
     sort = correct_sort(sort);
     prefs_set_int("st_sort", sort);
+
+    sort = prefs_get_int("pm_sort");
+    sort = correct_sort(sort);
     prefs_set_int("pm_sort", sort);
-    
+
+    sort = prefs_get_int("tm_sort");
+    sort = correct_sort(sort);
+    prefs_set_int("tm_sort_", sort);
 
     prefs_set_string ("version", VERSION);
 }
@@ -1874,9 +1896,6 @@
     mycfg->display_tooltips_main = TRUE;
     mycfg->display_tooltips_prefs = TRUE;
 
-    mycfg->sortcfg.tm_sort = SORT_NONE;
-    mycfg->sortcfg.tm_sortcol = TM_COLUMN_TITLE;
-
     g_free (cfgdir);
 
     return(mycfg);
@@ -2039,17 +2058,6 @@
          {
              /* ignore */
          }
-         else if((g_ascii_strcasecmp (line, "tm_sort_") == 0) ||
-                 (g_ascii_strcasecmp (line, "sm_sort_") == 0))
-         {
-             gint sort = correct_sort (atoi(arg));
-             prefs_set_tm_sort(sort);
-         }
-         else if((g_ascii_strcasecmp (line, "tm_sortcol") == 0) ||
-                 (g_ascii_strcasecmp (line, "sm_sortcol") == 0))
-         {
-             prefs_set_tm_sortcol(atoi(arg));
-         }
          else if(g_ascii_strcasecmp (line, "backups") == 0)
          {
              /* removed with version after 0.82-CVS */
@@ -2253,8 +2261,6 @@
     fprintf(fp, "offline=%d\n",prefs_get_offline());
     fprintf(fp, "display_toolbar=%d\n",prefs_get_display_toolbar());
     fprintf(fp, "toolbar_style=%d\n",prefs_get_toolbar_style());
-    fprintf(fp, "tm_sort_=%d\n",prefs_get_tm_sort());
-    fprintf(fp, "tm_sortcol=%d\n",prefs_get_tm_sortcol());
     fprintf(fp, "display_tooltips_main=%d\n",
            prefs_get_display_tooltips_main());
     fprintf(fp, "display_tooltips_prefs=%d\n",
@@ -2506,38 +2512,6 @@
     display_show_hide_toolbar ();
 }
 
-gint prefs_get_tm_sort (void)
-{
-    return cfg->sortcfg.tm_sort;
-}
-
-void prefs_set_tm_sort (gint i)
-{
-    switch (i)
-    {
-    case SORT_ASCENDING:
-    case SORT_DESCENDING:
-    case SORT_NONE:
-       cfg->sortcfg.tm_sort = i;
-       break;
-    default:  /* illegal -- ignore */
-       gtkpod_warning ("Programming error: prefs_set_tm_sort: illegal type 
'%d' ignored\n", i);
-       break;
-    }
-
-}
-
-TM_item prefs_get_tm_sortcol (void)
-{
-    return cfg->sortcfg.tm_sortcol;
-}
-
-void prefs_set_tm_sortcol (TM_item i)
-{
-    if (i < TM_NUM_COLUMNS)
-       cfg->sortcfg.tm_sortcol = i;
-}
-
 void prefs_set_display_tooltips_main (gboolean state)
 {
     cfg->display_tooltips_main = state;

Index: prefs.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.h,v
retrieving revision 1.170
retrieving revision 1.171
diff -u -d -r1.170 -r1.171
--- prefs.h     13 Jun 2006 14:59:22 -0000      1.170
+++ prefs.h     14 Jun 2006 02:52:55 -0000      1.171
@@ -81,10 +81,6 @@
   
   struct sortcfg
   {         /* sort type: SORT_ASCENDING, SORT_DESCENDING, SORT_NONE */
-    gint pm_sort;            /* sort type for playlists           */
-    gint tm_sort;            /* sort type for tracks              */
-    TM_item tm_sortcol;      /* sort column for tracks            */
-    gboolean tm_autostore;   /* save sort order automatically?    */
     GList *tmp_sort_ign_fields; /* used in prefs_window.c only     */
     gchar *tmp_sort_ign_strings;/* used in prefs_window.c only     */
   } sortcfg;
@@ -245,8 +241,6 @@
 gboolean read_prefs_old (GtkWidget *gtkpod, int argc, char *argv[]);
 
 void prefs_set_offline(gboolean active);
-void prefs_set_tm_sort (gint type);
-void prefs_set_tm_sortcol (TM_item col);
 void prefs_set_md5tracks(gboolean active);
 void prefs_set_block_display(gboolean active);
 void prefs_set_charset (gchar *charset);
@@ -254,9 +248,6 @@
 void prefs_set_statusbar_timeout (guint32 val);
 
 gboolean prefs_get_offline(void);
-gint prefs_get_tm_sort (void);
-TM_item prefs_get_tm_sortcol (void);
-gboolean prefs_get_autoimport(void);
 gchar * prefs_get_charset (void);
 gboolean prefs_get_md5tracks(void);
 gboolean prefs_get_block_display(void);

Index: prefs_window.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs_window.c,v
retrieving revision 1.165
retrieving revision 1.166
diff -u -d -r1.165 -r1.166
--- prefs_window.c      13 Jun 2006 15:25:09 -0000      1.165
+++ prefs_window.c      14 Jun 2006 02:52:56 -0000      1.166
@@ -764,11 +764,11 @@
     cfg_free (origcfg);
     origcfg = NULL;
        
-               /* Delete temp prefs structures */
-               temp_prefs_destroy(temp_prefs);
-               temp_prefs = NULL;
-               temp_lists_destroy(temp_lists);
-               temp_lists = NULL;
+    /* Delete temp prefs structures */
+    temp_prefs_destroy(temp_prefs);
+    temp_prefs = NULL;
+    temp_lists_destroy(temp_lists);
+    temp_lists = NULL;
 
     /* save current notebook page */
     nb = gtkpod_xml_get_widget (prefs_window_xml, "notebook");
@@ -1092,8 +1092,8 @@
 on_cfg_mpl_autoselect_toggled          (GtkToggleButton *togglebutton,
                                        gpointer         user_data)
 {
-       temp_prefs_set_int(temp_prefs, "mpl_autoselect", 
-                                                                               
 gtk_toggle_button_get_active(togglebutton));
+    temp_prefs_set_int(temp_prefs, "mpl_autoselect", 
+                      gtk_toggle_button_get_active(togglebutton));
 }
 
 void prefs_window_set_autosettags (gint category, gboolean autoset)
@@ -1619,7 +1619,7 @@
            sortcfg_free (tmpsortcfg);
        tmpsortcfg = clone_sortprefs();
 
-       switch (temp_prefs_get_int(sort_temp_prefs, "pm_sort"))
+       switch (prefs_get_int("pm_sort"))
        {
        case SORT_ASCENDING:
            w = gtkpod_xml_get_widget (sort_window_xml, "pm_ascend");
@@ -1650,7 +1650,7 @@
        if (w)
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), TRUE);
 
-       switch (tmpsortcfg->tm_sort)
+       switch (prefs_get_int("tm_sort_"))
        {
        case SORT_ASCENDING:
            w = gtkpod_xml_get_widget (sort_window_xml, "tm_ascend");
@@ -1676,7 +1676,7 @@
                                         prefs_get_int("case_sensitive"));
        }
        /* set standard entry in combo */
-       str = gettext (get_tm_string (prefs_get_tm_sortcol ()));
+       str = gettext (get_tm_string (prefs_get_int("tm_sortcol")));
        w = gtkpod_xml_get_widget (sort_window_xml, "sort_combo");
        gtk_entry_set_text (GTK_ENTRY (GTK_COMBO (w)->entry), str);
     }
@@ -1753,14 +1753,16 @@
     gchar *buf;
     gint i;
     gint val; /* A value from temp prefs */
+    TM_item sortcol_new;
+    TM_item sortcol_old;
 
     g_return_if_fail (scfg);
 
     tsc = clone_sortprefs ();
 
-    prefs_set_tm_sort (scfg->tm_sort);
-    scfg->tm_sortcol = sort_window_get_sort_col ();
-    prefs_set_tm_sortcol (scfg->tm_sortcol);
+    sortcol_old = prefs_get_int("tm_sortcol");
+    sortcol_new = sort_window_get_sort_col();
+    prefs_set_int("tm_sortcol", sortcol_new);
 
     /* set sort field states */
     for (i=0; sort_ign_fields[i] != -1; ++i)
@@ -1823,11 +1825,11 @@
        pm_sort (val);
     if (temp_prefs_get_int_value(sort_temp_prefs, "st_sort", &val))
        st_sort (val);
-    if ((tsc->tm_sort != scfg->tm_sort) ||
-       (tsc->tm_sortcol != scfg->tm_sortcol))
+    if (temp_prefs_get_int_value(sort_temp_prefs, "tm_sort_", NULL) ||
+       (sortcol_old != sortcol_new))
     {
        tm_sort_counter (-1);
-       tm_sort (prefs_get_tm_sortcol (), scfg->tm_sort);
+       tm_sort (prefs_get_int("tm_sortcol"), sortcol_new);
     }
     /* if auto sort was changed to TRUE, store order */
     if (!temp_prefs_get_int(sort_temp_prefs, "tm_autostore"))
@@ -2031,14 +2033,14 @@
     g_return_if_fail (tmpsortcfg);
     g_return_if_fail (origsortcfg);
 
+    temp_prefs_apply(sort_temp_prefs);
+    temp_lists_apply(sort_temp_lists);
+
     /* update the sort ignore strings */
     sort_window_read_sort_ign (tmpsortcfg);
     /* save current settings */
     sort_window_set (tmpsortcfg);
   
-    temp_prefs_apply(sort_temp_prefs);
-    temp_lists_apply(sort_temp_lists);
-
     /* delete sortcfg structs */
     sortcfg_free (tmpsortcfg);
     tmpsortcfg = NULL;
@@ -2084,7 +2086,7 @@
 
 void sort_window_set_tm_sort (gint val)
 {
-    tmpsortcfg->tm_sort = val;
+    temp_prefs_set_int(sort_temp_prefs, "tm_sort_", val);
 }
 
 void sort_window_set_case_sensitive (gboolean val)



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

Reply via email to