The following commit has been merged in the master branch:
commit 47bb8ccf1d8ae277770a26df9e3c624d8bb0d402
Author: Miriam Ruiz <[email protected]>
Date:   Wed Apr 29 15:54:45 2009 +0200

    Open filter configuration according to the XDG Base Directory Spec

diff --git a/GamesOptions.h b/GamesOptions.h
index 53a5f9b..43c1fa4 100644
--- a/GamesOptions.h
+++ b/GamesOptions.h
@@ -32,19 +32,20 @@ public:
        BoolOption* out_debug;
        BoolOption* out_verbose;
        StringOption* gui;
+       StringOption* filter;
        StringOption* gowhere;
        StringOption* mainFacet;
        StringOption* secondaryFacet;
        StringOption* ftags;
 
        GamesOptions() 
-               : StandardParserWithManpage("goplay", VERSION, 1, "Enrico Zini 
<[email protected]> and Miriam Ruiz <[email protected]>")
+               : StandardParserWithManpage("goplay", VERSION, 1, "Enrico Zini 
<[email protected]> and Miriam Ruiz <[email protected]>")
        {
                usage = "[options and arguments]";
                description = "Debian game browser";
                longDescription =
-                       "GoPlay! is a Graphical User Interface (GUI) that uses 
DebTags"
-                       " for finding games in Debian easily.\n";
+                       "GoFind! is a Graphical User Interface (GUI) that uses 
DebTags"
+                       " for finding programs in Debian easily.\n";
 
                // add( name, shortName, longName, usage, description )
 
@@ -54,6 +55,8 @@ public:
                                                "enable debugging output 
(including verbose output)");
                gui = add<StringOption>("gui", 0, "gui", "plugin",
                                                "select the user interface 
flavour. ");
+               filter = add<StringOption>("filter", 0, "filter", "file",
+                                               "select the filter 
configuration file. ");
                gowhere = add<StringOption>("go", 0, "go", "where",
                                                "change the interface flavour. "
                                                "Available flavours are: play, 
learn, admin, net, office, safe, web");
diff --git a/gofind.cpp b/gofind.cpp
index 7416a5e..a25ec7b 100644
--- a/gofind.cpp
+++ b/gofind.cpp
@@ -192,14 +192,26 @@ int main(int argc, const char* argv[])
                        pkgdata.globalFilter = fquery;
                }
 
-               pkgdata.GetPackageFilter().Clean();
-               xdgHandle xdg_handle;
-               if (xdgInitHandle(&xdg_handle))
+               if (opts.filter->isSet())
                {
-                       pkgdata.GetPackageFilter().Load("filter.cfg");
-                       xdgWipeHandle(&xdg_handle);
+                       
pkgdata.GetPackageFilter().Load(opts.filter->stringValue().c_str());
+               }
+               else
+               {
+                       pkgdata.GetPackageFilter().Clean();
+                       xdgHandle xdg_handle;
+                       if (xdgInitHandle(&xdg_handle))
+                       {
+                               FILE *fd=xdgConfigOpen("gofind/filter.cfg", 
"rb", &xdg_handle);
+                               if (fd)
+                               {
+                                       pkgdata.GetPackageFilter().Load(fd);
+                                       fclose(fd);
+                               }
+                               xdgWipeHandle(&xdg_handle);
+                       }
+                       else std::cerr << "Error initializing XDG Handle" << 
std::endl;
                }
-               else std::cerr << "Error initializing XDG Handle" << std::endl;
 
                /*
                cerr << " *** Initial:" << endl;

-- 
Development fot GoFind!

_______________________________________________
Pkg-games-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/pkg-games-commits

Reply via email to