r4567: Get ATK headers through Zero Install.
[rox-filer/translations.git] / ROX-Filer / src / appinfo.c
blobfa8e728497b52472e3f1e3f1f24e41478ac76923
1 /*
2 * ROX-Filer, filer for the ROX desktop project
3 * Copyright (C) 2006, Thomas Leonard and others (see changelog for details).
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
17 * Place, Suite 330, Boston, MA 02111-1307 USA
20 /* appinfo.c - querying the XMLwrapper.xml files */
22 /* Any valid application directory may contain a file called XMLwrapper.xml.
23 * The format is:
25 * <?xml version="1.0"?>
26 * <AppInfo>
27 * <Summary>Tooltip text</Summary>
28 * <About>
29 * <Purpose>...</Purpose>
30 * <Version>...</Version>
31 * <Authors>...</Authors>
32 * <License>...</License>
33 * <Homepage>...</Homepage>
34 * ...
35 * </About>
36 * <AppMenu>
37 * <Item option="...">
38 * <Label xml:lang='en'>...</Label>
39 * </Item>
40 * ...
41 * </AppMenu>
42 * <ROX:CanSetBackdrop/>
43 * </AppInfo>
46 #include "config.h"
48 #include <string.h>
50 #include "global.h"
52 #include "appinfo.h"
53 #include "fscache.h"
54 #include "type.h"
55 #include "diritem.h"
56 #include "support.h"
57 #include "xml.h"
59 /****************************************************************
60 * EXTERNAL INTERFACE *
61 ****************************************************************/
63 /* Load the XMLwrapper file for this application.
65 * Returns a pointer to the XMLwrapper structure, or NULL if this isn't
66 * an application with a valid XMLwrapper file.
68 * g_object_unref() the result.
70 XMLwrapper *appinfo_get(const gchar *app_dir, DirItem *item)
72 XMLwrapper *ai;
73 guchar *tmp;
75 /* Is it even an application directory? */
76 if (item->base_type != TYPE_DIRECTORY ||
77 !(item->flags & ITEM_FLAG_APPDIR))
78 return NULL; /* Not an application */
80 tmp = g_strconcat(app_dir, "/" APPINFO_FILENAME, NULL);
81 ai = xml_cache_load(tmp);
82 g_free(tmp);
84 return ai;