Keripo Test Account
Contributor
Joined: 11 Apr 2006
Location: Ontario, Canada
|
Posted:
Wed Feb 13, 2008 1:55 am |
|
Update: With revision 2402, podzilla2 now saves the scheme file selection as a setting. Yay for flexibility!
Right now, the only thing preventing podzilla 2 from being completely
Linux dependent (i.e. can save all its config files, etc. on a FAT
partition) is the scheme symlink. At the moment, schemes work by
creating a symlink to another scheme file (e.g. equivalent of "ln -s
/usr/share/schemes/mono.cs default.cs" and reading the symlink every
time. The location of this "default.cs" file must be located in the
Linux partition since it is a symbolic link, which cannot be created on a
FAT partition.
To find a way around that, I've tried to patch podzilla2 such that it
instead creates a hard copy of the scheme file (e.g. duplicates the
target scheme file's content to the "default.cs" file). Here's my
current patch-in-progress:
(A more colourful pastebin copy can be found here)
Code: |
Index: appearance.c
===================================================================
--- appearance.c (revision 2399)
+++ appearance.c (working copy)
@@ -38,7 +38,19 @@
{
if (save) {
unlink (SCHEMESDIR "default.cs");
- symlink (file, SCHEMESDIR "default.cs");
+
+ static char scheme[256];
+ sprintf (scheme, "%s%s", SCHEMESDIR, file);
+
+ FILE *fin = fopen(scheme, "r");
+ FILE *fout = fopen(SCHEMESDIR "default.cs", "w");
+ char line[256];
+ while (fgets(line, 256, fin) != NULL) {
+ fputs (line, fout);
+ }
+
+ fclose(fin);
+ fclose(fout);
}
ttk_epoch++;
@@ -72,7 +84,7 @@
TWindow *pz_select_color_scheme()
{
- char linktarget[256];
+ char linktarget[] = SCHEMESDIR "default.cs";
TWindow *ret = ttk_new_window();
TWidget *menu = ttk_new_menu_widget (0, ttk_menufont,
ttk_screen->w - ttk_screen->wx,
@@ -80,11 +92,6 @@
menu->scroll = apsc_scroll;
menu->button = apsc_button;
- if (readlink (SCHEMESDIR "default.cs", linktarget, 256) < 0) {
- pz_perror ("reading default.cs symlink");
- linktarget[0] = 0;
- }
-
int odfd = open (".", O_RDONLY);
chdir (SCHEMESDIR);
DIR *dp = opendir (".");
Index: pz.c
===================================================================
--- pz.c (revision 2399)
+++ pz.c (working copy)
@@ -548,7 +548,14 @@
#endif
if (access (SCHEMESDIR "default.cs", R_OK) < 0)
- symlink ("mono.cs", SCHEMESDIR "default.cs");
+ {
+ char line[256];
+ FILE *fin = fopen(SCHEMESDIR "mono.cs", "r");
+ FILE *fout = fopen(SCHEMESDIR "default.cs", "w");
+ while (fgets(line, 256, fin) != NULL) {
+ fputs (line, fout);
+ }
+ }
if ((first = ttk_init()) == 0) {
fprintf(stderr, _("ttk_init failed\n"));
|
While this method does seem to work, there are problems with TTK. For
the first time (i.e. no previous default.cs file), podzilla2 will load
with a blank scheme. If podzilla2 is restarted without touching the
scheme settings, however, the default mono.cs scheme file will be loaded
as wanted. The second issue is that, during startup, the module loading
text (e.g. the module's name, etc.) do not show. This, however, doesn't
interfere with anything but is still an issue nevertheless.
I'd very much like help with this patch. I'm also not very familiar with
TTK internals but the issues could possibly be due to TTK (expecting a
symlink). While the current scheme loading/saving mechanism works file,
making such a change will free podzilla 2 of Linux-partition dependency
(i.e. all files can be fully kept on a FAT partition). I am open to any
ideas and possible solutions, thanks.
~Keripo
Edit: For the curious, heres a compiled pz2 binary: http://www.mediafire.com/?dpgnidy1sus |
_________________ Project ZeroSlackr
http://sourceforge.net/projects/zeroslackr/
http://ipodlinux.org/forums/viewtopic.php?t=29636 |
|