r4255: Make Path optional in PanelRemove SOAP call, allowing removal of items based
[rox-filer/translations.git] / ROX-Filer / src / appinfo.c
blob9993c6294345f285a1e2c63caa7204f63d872939
1 /*
2 * $Id$
4 * ROX-Filer, filer for the ROX desktop project
5 * Copyright (C) 2005, the ROX-Filer team.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation; either version 2 of the License, or (at your option)
10 * any later version.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 * Place, Suite 330, Boston, MA 02111-1307 USA
22 /* appinfo.c - querying the XMLwrapper.xml files */
24 /* Any valid application directory may contain a file called XMLwrapper.xml.
25 * The format is:
27 * <?xml version="1.0"?>
28 * <AppInfo>
29 * <Summary>Tooltip text</Summary>
30 * <About>
31 * <Purpose>...</Purpose>
32 * <Version>...</Version>
33 * <Authors>...</Authors>
34 * <License>...</License>
35 * <Homepage>...</Homepage>
36 * ...
37 * </About>
38 * <AppMenu>
39 * <Item option="...">
40 * <Label xml:lang='en'>...</Label>
41 * </Item>
42 * ...
43 * </AppMenu>
44 * <ROX:CanSetBackdrop/>
45 * </AppInfo>
48 #include "config.h"
50 #include <string.h>
52 #include "global.h"
54 #include "appinfo.h"
55 #include "fscache.h"
56 #include "type.h"
57 #include "diritem.h"
58 #include "support.h"
59 #include "xml.h"
61 /****************************************************************
62 * EXTERNAL INTERFACE *
63 ****************************************************************/
65 /* Load the XMLwrapper file for this application.
67 * Returns a pointer to the XMLwrapper structure, or NULL if this isn't
68 * an application with a valid XMLwrapper file.
70 * g_object_unref() the result.
72 XMLwrapper *appinfo_get(const gchar *app_dir, DirItem *item)
74 XMLwrapper *ai;
75 guchar *tmp;
77 /* Is it even an application directory? */
78 if (item->base_type != TYPE_DIRECTORY ||
79 !(item->flags & ITEM_FLAG_APPDIR))
80 return NULL; /* Not an application */
82 tmp = g_strconcat(app_dir, "/" APPINFO_FILENAME, NULL);
83 ai = xml_cache_load(tmp);
84 g_free(tmp);
86 return ai;