]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - sdl_gui.c
Change dbinfo1 stat item and use it from afs.
[paraslash.git] / sdl_gui.c
index 97d0573a8e3b455a95e26139a9c1ee30c30682e8..9668fad1c9b58f4b78ae04a4427eb6e43f4fa5bb 100644 (file)
--- a/sdl_gui.c
+++ b/sdl_gui.c
@@ -1,25 +1,16 @@
 /*
- * Copyright (C) 2003-2006 Andre Noll <maan@systemlinux.org>
+ * Copyright (C) 2003-2007 Andre Noll <maan@systemlinux.org>
  *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     This program is distributed in the hope that it will be useful,
- *     but WITHOUT ANY WARRANTY; without even the implied warranty of
- *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *     GNU General Public License for more details.
- *
- *     You should have received a copy of the GNU General Public License
- *     along with this program; if not, write to the Free Software
- *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Licensed under the GPL v2. For licencing details see COPYING.
  */
 
 /** \file sdl_gui.c SDL-based interface for paraslash */
 
+#include <sys/types.h>
+#include <dirent.h>
+
 #include "para.h"
-#include "string.h"
+#include "gui_common.h"
 #include "fd.h"
 
 
@@ -290,18 +281,18 @@ static void init_stat_items(void)
        s[SI_AUDIO_INFO3].font = N_YELLOW;
        s[SI_AUDIO_INFO3].align = CENTER;
 
-       s[SI_DBINFO1].name = "dbinfo1:";
-       s[SI_DBINFO1].prefix = "";
-       s[SI_DBINFO1].postfix = "";
-       s[SI_DBINFO1].x = 0;
-       s[SI_DBINFO1].y = 83;
-       s[SI_DBINFO1].w = 100;
-       s[SI_DBINFO1].h = FONT_HEIGHT;
-       s[SI_DBINFO1].r = 0;
-       s[SI_DBINFO1].g = 0;
-       s[SI_DBINFO1].b = 0;
-       s[SI_DBINFO1].font = N_YELLOW;
-       s[SI_DBINFO1].align = CENTER;
+       s[SI_AFS_MODE].name = "afs_mode:";
+       s[SI_AFS_MODE].prefix = "";
+       s[SI_AFS_MODE].postfix = "";
+       s[SI_AFS_MODE].x = 0;
+       s[SI_AFS_MODE].y = 83;
+       s[SI_AFS_MODE].w = 100;
+       s[SI_AFS_MODE].h = FONT_HEIGHT;
+       s[SI_AFS_MODE].r = 0;
+       s[SI_AFS_MODE].g = 0;
+       s[SI_AFS_MODE].b = 0;
+       s[SI_AFS_MODE].font = N_YELLOW;
+       s[SI_AFS_MODE].align = CENTER;
 
        s[SI_DBINFO2].prefix = "";
        s[SI_DBINFO2].postfix = "";
@@ -672,17 +663,18 @@ static void do_update(int i)
  * Check if buf is a known status line. If so call do_update and return 1.
  * Return 0 otherwise.
  */
-void update_status(char *buf)
+int update_status(char *buf, __a_unused void *data)
 {
        int i;
 
        i = stat_line_valid(buf);
        if (i < 0)
-               return;
+               return 1;
        //free(stat_items[i].content);
        stat_items[i].content = para_strdup(buf +
                strlen(status_item_list[i]) + 1);
        do_update(i);
+       return 1;
 }
 
 /*
@@ -743,6 +735,7 @@ int main(int argc, char *argv[])
        SDLKey sym;
 
        sdl_gui_cmdline_parser(argc, argv, &args_info);
+       HANDLE_VERSION_FLAG("sdl_gui", args_info);
        ret = configfile_exists();
 //     printf("w=%i,h=%i,ret=%i, cf=%s\n", width, height, ret, args_info.config_file_arg);
 
@@ -751,9 +744,16 @@ int main(int argc, char *argv[])
                        args_info.config_file_arg);
                exit(EXIT_FAILURE);
        }
-       if (ret)
-               sdl_gui_cmdline_parser_configfile(args_info.config_file_arg,
-                       &args_info, 0, 0, 0);
+       if (ret) {
+               struct sdl_gui_cmdline_parser_params params = {
+                       .override = 0,
+                       .initialize = 0,
+                       .check_required = 0,
+                       .check_ambiguity = 0
+               };
+               sdl_gui_cmdline_parser_config_file(args_info.config_file_arg,
+                       &args_info, &params);
+       }
        signal(SIGCHLD, SIG_IGN);
        width = args_info.width_arg;
        height = args_info.height_arg;