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

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

Moved st_sort to new prefs.


Index: context_menus.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/context_menus.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- context_menus.c     21 May 2006 15:51:34 -0000      1.59
+++ context_menus.c     13 Jun 2006 05:48:55 -0000      1.60
@@ -260,19 +260,19 @@
 {
     if (selected_entry)
     {
-       switch (prefs_get_st_sort ())
+       switch (prefs_get_int("st_sort"))
        {
        case SORT_ASCENDING:
-           prefs_set_st_sort (SORT_DESCENDING);
+           prefs_set_int("st_sort", SORT_DESCENDING);
            break;
        case SORT_DESCENDING:
-           prefs_set_st_sort (SORT_NONE);
+           prefs_set_int("st_sort", SORT_NONE);
            break;
        case SORT_NONE:
-           prefs_set_st_sort (SORT_ASCENDING);
+           prefs_set_int("st_sort", SORT_ASCENDING);
            break;
        }
-       st_sort (prefs_get_st_sort ());
+       st_sort (prefs_get_int("st_sort"));
     }
 }
 

Index: display_sorttabs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_sorttabs.c,v
retrieving revision 1.79
retrieving revision 1.80
diff -u -d -r1.79 -r1.80
--- display_sorttabs.c  11 Jun 2006 16:04:47 -0000      1.79
+++ display_sorttabs.c  13 Jun 2006 05:48:55 -0000      1.80
@@ -1190,7 +1190,7 @@
       if (st->entry_hash)  g_hash_table_destroy (st->entry_hash);
       st->entry_hash = NULL;
 
-      if((prefs_get_st_sort () == SORT_NONE) &&
+      if((prefs_get_int("st_sort") == SORT_NONE) &&
         gtk_tree_sortable_get_sort_column_id (GTK_TREE_SORTABLE (st->model),
                                               &column, &order))
       { /* recreate track treeview to unset sorted column */
@@ -2434,7 +2434,7 @@
        if (disable_count[inst] == 0)
        {
            /* Re-enable sorting */
-           if ((prefs_get_st_sort () != SORT_NONE) &&
+           if ((prefs_get_int("st_sort") != SORT_NONE) &&
                prefs_get_disable_sorting ())
            {
                SortTab *st = sorttab[inst];
@@ -2454,7 +2454,7 @@
                        gtk_tree_sortable_set_sort_column_id (
                            GTK_TREE_SORTABLE (st->model),
                            ST_COLUMN_ENTRY,
-                           prefs_get_st_sort ());
+                           prefs_get_int("st_sort"));
                    }
                }
            }
@@ -2466,7 +2466,7 @@
        if (disable_count[inst] == 0)
        {
            /* Disable sorting */
-           if ((prefs_get_st_sort () != SORT_NONE) &&
+           if ((prefs_get_int("st_sort") != SORT_NONE) &&
                prefs_get_disable_sorting ())
            {
                SortTab *st = sorttab[inst];
@@ -2486,7 +2486,7 @@
                        gtk_tree_sortable_set_sort_column_id (
                            GTK_TREE_SORTABLE (st->model),
                            GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID,
-                           prefs_get_st_sort ());
+                           prefs_get_int("st_sort"));
                    }
                }
            }
@@ -3064,8 +3064,8 @@
   page = prefs_get_int_index("st_category", inst);
   st->current_category = page;
   gtk_notebook_set_current_page (st->notebook, page);
-  if (prefs_get_st_sort () != SORT_NONE)
-    st_sort_inst (inst, prefs_get_st_sort ());
+  if (prefs_get_int("st_sort") != SORT_NONE)
+    st_sort_inst (inst, prefs_get_int("st_sort"));
 }
 
 

Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.240
retrieving revision 1.241
diff -u -d -r1.240 -r1.241
--- prefs.c     13 Jun 2006 04:19:36 -0000      1.240
+++ prefs.c     13 Jun 2006 05:48:55 -0000      1.241
@@ -239,6 +239,7 @@
     /* Set sorting prefs */
     prefs_set_int("case_sensitive", FALSE);
     prefs_set_int("tm_autostore", FALSE);
+    prefs_set_int("st_sort", SORT_NONE);
 }
 
 /* Initialize default variable-length list entries */
@@ -666,6 +667,21 @@
     }          
 }
 
+/* sort order was reversed between V0.82_CVS and V0.83.CVS */
+static gint correct_sort (gint sort)
+{
+    switch (sort)
+    {
+    case SORT_ASCENDING:
+       sort = SORT_DESCENDING;
+       break;
+    case SORT_DESCENDING:
+       sort = SORT_ASCENDING;
+       break;
+    }
+    return sort;
+}
+
 /* Delete and rename keys */
 static void cleanup_keys()
 {
@@ -673,6 +689,7 @@
     gint int_buf;
     gint i;
     gint x, y, p;  /* Window position */
+    gint sort;  /* sort order */
     float version=0;
 
     /* get version */
@@ -957,6 +974,12 @@
        prefs_set_string("sm_autostore", NULL);
     }
 
+    /* Correct sort order */
+    sort = prefs_get_int("st_sort");
+    sort = correct_sort(sort);
+    prefs_set_int("st_sort", sort);
+    
+
     prefs_set_string ("version", VERSION);
 }
 
@@ -1833,7 +1856,6 @@
     mycfg->display_tooltips_prefs = TRUE;
 
     mycfg->sortcfg.pm_sort = SORT_NONE;
-    mycfg->sortcfg.st_sort = SORT_NONE;
     mycfg->sortcfg.tm_sort = SORT_NONE;
     mycfg->sortcfg.tm_sortcol = TM_COLUMN_TITLE;
 
@@ -1861,24 +1883,6 @@
 }
 
 
-/* sort order was reversed between V0.82_CVS and V0.83.CVS */
-static gint correct_sort (gint sort)
-{
-    if (cfg && (cfg->version < 0.83))
-    {
-       switch (sort)
-       {
-       case SORT_ASCENDING:
-           sort = SORT_DESCENDING;
-           break;
-       case SORT_DESCENDING:
-           sort = SORT_ASCENDING;
-           break;
-       }
-    }
-    return sort;
-}
-
 /* default ignore strings -- must end with a space */
 static char* sort_ign_strings[] =
 {
@@ -2022,11 +2026,6 @@
              gint sort = correct_sort (atoi(arg));
              prefs_set_pm_sort(sort);
          }
-         else if(g_ascii_strcasecmp (line, "st_sort") == 0)
-         {
-             gint sort = correct_sort (atoi(arg));
-             prefs_set_st_sort(sort);
-         }
          else if((g_ascii_strcasecmp (line, "tm_sort_") == 0) ||
                  (g_ascii_strcasecmp (line, "sm_sort_") == 0))
          {
@@ -2242,7 +2241,6 @@
     fprintf(fp, "display_toolbar=%d\n",prefs_get_display_toolbar());
     fprintf(fp, "toolbar_style=%d\n",prefs_get_toolbar_style());
     fprintf(fp, "pm_sort=%d\n",prefs_get_pm_sort());
-    fprintf(fp, "st_sort=%d\n",prefs_get_st_sort());
     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",
@@ -2517,26 +2515,6 @@
     cfg->sortcfg.pm_sort = i;
 }
 
-gint prefs_get_st_sort (void)
-{
-    return cfg->sortcfg.st_sort;
-}
-
-void prefs_set_st_sort (gint i)
-{
-    switch (i)
-    {
-    case SORT_ASCENDING:
-    case SORT_DESCENDING:
-    case SORT_NONE:
-       cfg->sortcfg.st_sort = i;
-       break;
-    default:  /* illegal -- ignore */
-       gtkpod_warning ("Programming error: prefs_set_st_sort: illegal type 
'%d' ignored\n", i);
-       break;
-    }
-}
-
 gint prefs_get_tm_sort (void)
 {
     return cfg->sortcfg.tm_sort;

Index: prefs.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.h,v
retrieving revision 1.167
retrieving revision 1.168
diff -u -d -r1.167 -r1.168
--- prefs.h     13 Jun 2006 04:19:36 -0000      1.167
+++ prefs.h     13 Jun 2006 05:48:55 -0000      1.168
@@ -98,7 +98,6 @@
   struct sortcfg
   {         /* sort type: SORT_ASCENDING, SORT_DESCENDING, SORT_NONE */
     gint pm_sort;            /* sort type for playlists           */
-    gint st_sort;            /* sort type for sort tabs           */
     gint tm_sort;            /* sort type for tracks              */
     TM_item tm_sortcol;      /* sort column for tracks            */
     gboolean tm_autostore;   /* save sort order automatically?    */
@@ -264,7 +263,6 @@
 void prefs_set_offline(gboolean active);
 void prefs_set_pm_sort (gint type);
 void prefs_set_tm_sort (gint type);
-void prefs_set_st_sort (gint type);
 void prefs_set_tm_sortcol (TM_item col);
 void prefs_set_md5tracks(gboolean active);
 void prefs_set_block_display(gboolean active);
@@ -274,7 +272,6 @@
 
 gboolean prefs_get_offline(void);
 gint prefs_get_pm_sort (void);
-gint prefs_get_st_sort (void);
 gint prefs_get_tm_sort (void);
 TM_item prefs_get_tm_sortcol (void);
 gboolean prefs_get_autoimport(void);

Index: prefs_window.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs_window.c,v
retrieving revision 1.161
retrieving revision 1.162
diff -u -d -r1.161 -r1.162
--- prefs_window.c      13 Jun 2006 04:19:36 -0000      1.161
+++ prefs_window.c      13 Jun 2006 05:48:55 -0000      1.162
@@ -1631,7 +1631,7 @@
            gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w), TRUE);
 
        w = NULL;
-       switch (tmpsortcfg->st_sort)
+       switch (prefs_get_int("st_sort"))
        {
        case SORT_ASCENDING:
            w = gtkpod_xml_get_widget (sort_window_xml, "st_ascend");
@@ -1748,13 +1748,13 @@
     struct sortcfg *tsc;
     gchar *buf;
     gint i;
+    gint val; /* A value from temp prefs */
 
     g_return_if_fail (scfg);
 
     tsc = clone_sortprefs ();
 
     prefs_set_pm_sort (scfg->pm_sort);
-    prefs_set_st_sort (scfg->st_sort);
     prefs_set_tm_sort (scfg->tm_sort);
     scfg->tm_sortcol = sort_window_get_sort_col ();
     prefs_set_tm_sortcol (scfg->tm_sortcol);
@@ -1818,8 +1818,8 @@
     /* if sort type has changed, initialize display */
     if (tsc->pm_sort != scfg->pm_sort)
        pm_sort (scfg->pm_sort);
-    if (tsc->st_sort != scfg->st_sort)
-       st_sort (scfg->st_sort);
+    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))
     {
@@ -2076,7 +2076,7 @@
 
 void sort_window_set_st_sort (gint val)
 {
-    tmpsortcfg->st_sort = val;
+    temp_prefs_set_int(sort_temp_prefs, "st_sort", val);
 }
 
 void sort_window_set_tm_sort (gint val)



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

Reply via email to