Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv14853/src
Modified Files:
display_sorttabs.c prefs.c prefs.h
Log Message:
Move sp_rating_state to new prefs.
Index: display_sorttabs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_sorttabs.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- display_sorttabs.c 2 Jun 2006 01:47:34 -0000 1.70
+++ display_sorttabs.c 4 Jun 2006 22:25:29 -0000 1.71
@@ -287,6 +287,40 @@
/* */
/* ---------------------------------------------------------------- */
+/* Set rating for tab @inst and rating @n */
+static void set_sp_rating_n(guint32 inst, gint n, gboolean state)
+{
+ guint32 rating;
+
+ if ((inst <= SORT_TAB_MAX) && (n <= RATING_MAX))
+ {
+ rating = (guint32) prefs_get_int_index("sp_rating_state", inst);
+
+ if (state)
+ rating |= (1 << n);
+ else
+ rating &= ~(1 << n);
+
+ prefs_set_int_index("sp_rating_state", inst, rating);
+ }
+}
+
+static gboolean get_sp_rating_n(guint32 inst, gint n)
+{
+ guint32 rating;
+
+ if ((inst <= SORT_TAB_MAX) && (n <= RATING_MAX))
+ {
+ rating = (guint32) prefs_get_int_index("sp_rating_state", inst);
+
+ if ((rating & (1 << n)) != 0)
+ return TRUE;
+ else
+ return FALSE;
+ }
+
+ return FALSE;
+}
/* Remove all members of special sort tab (ST_CAT_SPECIAL) in instance
* @inst */
@@ -432,7 +466,7 @@
{
/* checked = TRUE: at least one condition was checked */
checked = TRUE;
- cond = prefs_get_sp_rating_n (inst, track->rating/ITDB_RATING_STEP);
+ cond = get_sp_rating_n (inst, track->rating/ITDB_RATING_STEP);
/* If one of the two combinations occur, we can take a
shortcut and stop checking the other conditions */
if (sp_or && cond) return TRUE;
@@ -832,8 +866,8 @@
guint32 inst = (guint32)(GPOINTER_TO_UINT(user_data) & SP_MASK);
guint32 n = (guint32)GPOINTER_TO_UINT(user_data) >> SP_SHIFT;
- prefs_set_sp_rating_n (inst, n,
- gtk_toggle_button_get_active (togglebutton));
+ set_sp_rating_n (inst, n,
+ gtk_toggle_button_get_active
(togglebutton));
if (prefs_get_int_index("sp_rating_cond", inst))
sp_conditions_changed (inst);
}
@@ -2717,7 +2751,7 @@
"toggled", G_CALLBACK (on_sp_rating_n_toggled),
GUINT_TO_POINTER((i<<SP_SHIFT) + inst));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(w),
- prefs_get_sp_rating_n (inst, i));
+ get_sp_rating_n (inst, i));
g_free (buf);
}
Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -d -r1.195 -r1.196
--- prefs.c 4 Jun 2006 16:27:33 -0000 1.195
+++ prefs.c 4 Jun 2006 22:25:29 -0000 1.196
@@ -161,6 +161,7 @@
prefs_set_int_index("sp_played_cond", i, FALSE);
prefs_set_int_index("sp_modified_cond", i, FALSE);
prefs_set_int_index("sp_added_cond", i, FALSE);
+ prefs_set_int_index("sp_rating_state", i, 0);
}
}
@@ -1648,7 +1649,6 @@
mycfg->autoimport = FALSE;
for (i=0; i<SORT_TAB_MAX; ++i)
{
- mycfg->st[i].sp_rating_state = 0;
mycfg->st[i].sp_playcount_low = 0;
mycfg->st[i].sp_playcount_high = -1;
mycfg->st[i].sp_played_state = g_strdup (">4w");
@@ -1899,11 +1899,6 @@
{
prefs_set_autoimport((gboolean)atoi(arg));
}
- else if(arg_comp (line, "sp_rating_state", &off) == 0)
- {
- gint i = atoi (line+off);
- prefs_set_sp_rating_state (i, atoi (arg));
- }
else if(arg_comp (line, "sp_playcount_low", &off) == 0)
{
gint i = atoi (line+off);
@@ -2411,7 +2406,6 @@
fprintf(fp, _("# sort tab: select 'All', last selected page
(=category)\n"));
for (i=0; i<SORT_TAB_MAX; ++i)
{
- fprintf(fp, "sp_rating_state%d=%d\n", i, prefs_get_sp_rating_state(i));
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_state%d=%s\n", i, prefs_get_sp_entry (i,
T_TIME_PLAYED));
@@ -3349,53 +3343,6 @@
cfg->info_window = val;
}
-void prefs_set_sp_rating_n (guint32 inst, gint n, gboolean state)
-{
- if ((inst < SORT_TAB_MAX) && (n <=RATING_MAX))
- {
- if (state)
- cfg->st[inst].sp_rating_state |= (1<<n);
- else
- cfg->st[inst].sp_rating_state &= ~(1<<n);
- }
- else
- fprintf (stderr, "prefs_set_sp_rating_n(): inst=%d, n=%d\n", inst, n);
-}
-
-
-gboolean prefs_get_sp_rating_n (guint32 inst, gint n)
-{
- if ((inst < SORT_TAB_MAX) && (n <=RATING_MAX))
- {
- if ((cfg->st[inst].sp_rating_state & (1<<n)) != 0)
- return TRUE;
- else
- return FALSE;
- }
- fprintf (stderr, "prefs_get_sp_rating_n(): inst=%d, n=%d\n", inst, n);
- return FALSE;
-}
-
-
-void prefs_set_sp_rating_state (guint32 inst, guint32 state)
-{
- if (inst < SORT_TAB_MAX)
- /* only keep the 'RATING_MAX+1' lowest bits */
- cfg->st[inst].sp_rating_state = (state & ((1<<(RATING_MAX+1))-1));
- else
- fprintf (stderr, "prefs_set_sp_rating_state(): inst=%d\n", inst);
-}
-
-
-guint32 prefs_get_sp_rating_state (guint32 inst)
-{
- if (inst < SORT_TAB_MAX)
- return cfg->st[inst].sp_rating_state;
- fprintf (stderr, "prefs_get_sp_rating_state(): inst=%d\n", inst);
- return 0;
-}
-
-
void prefs_set_sp_entry (guint32 inst, T_item t_item, const gchar *str)
{
/* printf("psse: %d, %d, %s\n", inst, t_item, str);*/
Index: prefs.h
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.h,v
retrieving revision 1.122
retrieving revision 1.123
diff -u -d -r1.122 -r1.123
--- prefs.h 2 Jun 2006 02:56:43 -0000 1.122
+++ prefs.h 4 Jun 2006 22:25:30 -0000 1.123
@@ -106,7 +106,6 @@
struct
{
/* the following fields are for the "special" tab */
- guint32 sp_rating_state;/* pass which rating? (1 star: bit 1...) */
guint sp_playcount_low; /* lower limit for playcounts */
guint sp_playcount_high; /* higher limit for playcounts */
gchar *sp_played_state; /* current "played" string */
@@ -410,10 +409,6 @@
void prefs_set_last_prefs_page (gint i);
gboolean prefs_get_automount (void);
gboolean prefs_get_info_window (void);
-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);
-guint32 prefs_get_sp_rating_state (guint32 inst);
void prefs_set_sp_entry (guint32 inst, T_item t_item, const gchar *str);
gchar *prefs_get_sp_entry (guint32 inst, T_item t_item);
void prefs_set_sp_autodisplay (guint32 inst, gboolean state);
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2