Update of /cvsroot/gtkpod/gtkpod/src
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv14041/src
Modified Files:
display_sorttabs.c prefs.c prefs.h
Log Message:
Move paned_pos_ keys to new prefs
Index: display_sorttabs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/display_sorttabs.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- display_sorttabs.c 7 Jun 2006 05:03:43 -0000 1.75
+++ display_sorttabs.c 8 Jun 2006 04:31:44 -0000 1.76
@@ -2580,7 +2580,7 @@
width = (x-p0) / num;
for (i=0; i<num; ++i)
{
- prefs_set_paned_pos (PANED_NUM_GLADE+i, width);
+ prefs_set_int_index("paned_pos_", PANED_NUM_GLADE+i, width);
}
}
g_free (buf);
@@ -2599,11 +2599,11 @@
st_set_visible_sort_tab_paned ();
for (i=0; i<num; ++i)
{
- if (prefs_get_paned_pos (PANED_NUM_GLADE + i) != -1)
+ if (prefs_get_int_index("paned_pos_", PANED_NUM_GLADE + i) != -1)
{
if (st_paned[i])
gtk_paned_set_position (
- st_paned[i], prefs_get_paned_pos (PANED_NUM_GLADE+i));
+ st_paned[i], prefs_get_int_index("paned_pos_",
PANED_NUM_GLADE+i));
}
}
}
@@ -2644,7 +2644,7 @@
}
/* set position of visible paned to decent values if not already
set */
- if (prefs_get_paned_pos (PANED_NUM_GLADE) == -1)
+ if (prefs_get_int_index("paned_pos_", PANED_NUM_GLADE) == -1)
st_set_visible_sort_tab_paned ();
}
@@ -3119,20 +3119,20 @@
GtkWidget *w = gtkpod_xml_get_widget (main_window_xml, buf);
g_free (buf);
g_return_if_fail (w);
- if (prefs_get_paned_pos (i) != -1)
+ if (prefs_get_int_index("paned_pos_", i) != -1)
{
gtk_paned_set_position (GTK_PANED (w),
- prefs_get_paned_pos (i));
+ prefs_get_int_index("paned_pos_", i));
}
}
/* Elements defined with display.c (sort tab hpaned) */
for (i=0; i<PANED_NUM_ST; ++i)
{
g_return_if_fail (st_paned[i]);
- if (prefs_get_paned_pos (PANED_NUM_GLADE + i) != -1)
+ if (prefs_get_int_index("paned_pos_", PANED_NUM_GLADE + i) != -1)
{
gtk_paned_set_position (
- st_paned[i], prefs_get_paned_pos (PANED_NUM_GLADE+i));
+ st_paned[i], prefs_get_int_index("paned_pos_",
PANED_NUM_GLADE+i));
}
}
}
@@ -3155,7 +3155,7 @@
buf = g_strdup_printf ("paned%d", i);
if((w = gtkpod_xml_get_widget (main_window_xml, buf)))
{
- prefs_set_paned_pos (i,
+ prefs_set_int_index("paned_pos_", i,
gtk_paned_get_position (GTK_PANED (w)));
}
g_free (buf);
@@ -3164,7 +3164,7 @@
for (i=0; i<PANED_NUM_ST; ++i)
{
if (st_paned[i])
- prefs_set_paned_pos (i + PANED_NUM_GLADE,
+ prefs_set_int_index("paned_pos_", i + PANED_NUM_GLADE,
gtk_paned_get_position (st_paned[i]));
}
}
Index: prefs.c
===================================================================
RCS file: /cvsroot/gtkpod/gtkpod/src/prefs.c,v
retrieving revision 1.203
retrieving revision 1.204
diff -u -d -r1.203 -r1.204
--- prefs.c 7 Jun 2006 05:03:43 -0000 1.203
+++ prefs.c 8 Jun 2006 04:31:44 -0000 1.204
@@ -187,7 +187,9 @@
prefs_set_int_index("col_visible", TM_COLUMN_PLAYCOUNT, TRUE);
prefs_set_int_index("col_visible", TM_COLUMN_RATING, TRUE);
-
+ /* Set pane positions--Let gtk worry about position */
+ for (i = 0; i < PANED_NUM; i++)
+ prefs_set_int_index("paned_pos_", i, -1);
}
/* Initialize default variable-length list entries */
@@ -621,6 +623,7 @@
gchar *buf;
gint int_buf;
gint i;
+ gint x, y, p; /* Window position */
float version=0;
/* get version */
@@ -828,6 +831,36 @@
prefs_set_int_index("tm_col_width", i, int_buf);
}
+ /* handle version changes in prefs */
+ if (version == 0.0)
+ {
+ /* most likely prefs file written by V0.50 */
+ /* I added two new PANED elements since V0.50 --> shift */
+ for (i=PANED_NUM_ST-1; i>=0; --i)
+ {
+ prefs_set_int_index("paned_pos_", PANED_NUM_GLADE + i,
+ prefs_get_int_index("paned_pos_",
PANED_NUM_GLADE + i - 2));
+ }
+ prefs_set_int_index("paned_pos_", PANED_STATUS1, -1);
+ prefs_set_int_index("paned_pos_", PANED_STATUS2, -1);
+ }
+
+ /* set statusbar paned to a decent value if unset */
+ if (prefs_get_int_index("paned_pos_", PANED_STATUS1) == -1)
+ {
+ prefs_get_size_gtkpod (&x, &y);
+ /* set to about 2/3 of the window width */
+ if (x>0) prefs_set_int_index("paned_pos_", PANED_STATUS1, 20*x/30);
+ }
+
+ if (prefs_get_int_index("paned_pos_", PANED_STATUS2) == -1)
+ {
+ prefs_get_size_gtkpod (&x, &y);
+ p = prefs_get_int_index("paned_pos_", PANED_STATUS1);
+ /* set to about half of the remaining window */
+ if (x>0) prefs_set_int_index("paned_pos_", PANED_STATUS2, (x-p)/2 );
+ }
+
prefs_set_string ("version", VERSION);
}
@@ -836,6 +869,9 @@
{
/* Sort column order needs to be stored */
tm_store_col_order();
+
+ /* Update default sizes */
+ display_update_default_sizes();
}
/* Initialize the prefs table and read configuration */
@@ -1724,10 +1760,6 @@
mycfg->parsetags_template = g_strdup ("%a - %A/%T %t.mp3;%t.wav");
mycfg->coverart = TRUE;
mycfg->coverart_template = g_strdup ("%A;folder.jpg");
- for (i=0; i<PANED_NUM; ++i)
- {
- mycfg->paned_pos[i] = -1; /* -1 means: let gtk worry about position */
- }
mycfg->display_toolbar = TRUE;
mycfg->toolbar_style = GTK_TOOLBAR_BOTH;
mycfg->display_tooltips_main = TRUE;
@@ -1959,11 +1991,6 @@
{
prefs_set_coverart_template(strdup(arg));
}
- else if(arg_comp (line, "paned_pos_", &off) == 0)
- {
- gint i = atoi (line+off);
- prefs_set_paned_pos (i, atoi (arg));
- }
else if(g_ascii_strcasecmp (line, "offline") == 0)
{
prefs_set_offline((gboolean)atoi(arg));
@@ -2262,39 +2289,6 @@
cfg->version = g_ascii_strtod (VERSION, NULL);
prefs_set_string ("version", VERSION);
}
-
- /* handle version changes in prefs */
- if (cfg->version == 0.0)
- {
- /* most likely prefs file written by V0.50 */
- /* I added two new PANED elements since V0.50 --> shift */
- gint i;
- for (i=PANED_NUM_ST-1; i>=0; --i)
- {
- prefs_set_paned_pos (PANED_NUM_GLADE + i,
- prefs_get_paned_pos (PANED_NUM_GLADE + i - 2));
- }
- prefs_set_paned_pos (PANED_STATUS1, -1);
- prefs_set_paned_pos (PANED_STATUS2, -1);
- }
-
- /* set statusbar paned to a decent value if unset */
- if (prefs_get_paned_pos (PANED_STATUS1) == -1)
- {
- gint x,y;
- prefs_get_size_gtkpod (&x, &y);
- /* set to about 2/3 of the window width */
- if (x>0) prefs_set_paned_pos (PANED_STATUS1, 20*x/30);
- }
- /* set statusbar paned to a decent value if unset */
- if (prefs_get_paned_pos (PANED_STATUS2) == -1)
- {
- gint x,y,p;
- prefs_get_size_gtkpod (&x, &y);
- p = prefs_get_paned_pos (PANED_STATUS1);
- /* set to about half of the remaining window */
- if (x>0) prefs_set_paned_pos (PANED_STATUS2, (x-p)/2 );
- }
}
/* Read Preferences and initialise the cfg-struct */
@@ -2363,9 +2357,6 @@
if(!fp)
fp = stderr;
- /* update column widths, x,y-size of main window and GtkPaned
- * positions */
- display_update_default_sizes ();
if (cfg->charset)
{
@@ -2390,11 +2381,6 @@
fprintf(fp, "parsetags_template=%s\n",cfg->parsetags_template);
fprintf(fp, "coverart=%d\n", prefs_get_coverart());
fprintf(fp, "coverart_template=%s\n",cfg->coverart_template);
- fprintf(fp, _("# position of sliders (paned): playlists, above tracks,\n#
between sort tabs, and in statusbar.\n"));
- for (i=0; i<PANED_NUM; ++i)
- {
- fprintf(fp, "paned_pos_%d=%d\n", i, prefs_get_paned_pos (i));
- }
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());
@@ -2872,27 +2858,6 @@
}
}
-/* get position of GtkPaned element nr. "i" */
-/* return value: -1: don't change position */
-gint prefs_get_paned_pos (gint i)
-{
- if (i < PANED_NUM)
- return cfg->paned_pos[i];
- else
- {
- g_warning ("Programming error: prefs_get_paned_pos: arg out of range
(%d)\n", i);
- return 100; /* something reasonable? */
- }
-}
-
-/* set position of GtkPaned element nr. "i" */
-void prefs_set_paned_pos (gint i, gint pos)
-{
- if (i < PANED_NUM)
- cfg->paned_pos[i] = pos;
-}
-
-
/* 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.130
retrieving revision 1.131
diff -u -d -r1.130 -r1.131
--- prefs.h 7 Jun 2006 05:03:43 -0000 1.130
+++ prefs.h 8 Jun 2006 04:31:44 -0000 1.131
@@ -139,7 +139,6 @@
gboolean coverart; /* Read coverart when adding files? */
gchar *coverart_template; /* template for coverart filename */
gboolean autosettags[TM_NUM_TAGS_PREFS]; /* autoset empty tags to filename?*/
- gint paned_pos[PANED_NUM]; /* position of the GtkPaned elements */
gboolean display_toolbar; /* should toolbar be displayed */
GtkToolbarStyle toolbar_style;/* style of toolbar */
@@ -342,7 +341,6 @@
void prefs_set_size_dirbr (gint x, gint y);
void prefs_set_size_prefs (gint x, gint y);
void prefs_set_size_info (gint x, gint y);
-void prefs_set_paned_pos (gint i, gint pos);
void prefs_set_statusbar_timeout (guint32 val);
void prefs_set_automount(gboolean val);
void prefs_set_info_window(gboolean val);
@@ -367,7 +365,6 @@
void prefs_get_size_info (gint *x, gint *y);
gboolean prefs_get_md5tracks(void);
gboolean prefs_get_block_display(void);
-gint prefs_get_paned_pos (gint i);
guint32 prefs_get_statusbar_timeout (void);
gboolean prefs_get_display_toolbar (void);
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2