1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
3 obt/link.c for the Openbox window manager
4 Copyright (c) 2009 Dana Jansens
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 See the COPYING file for a copy of the GNU General Public License.
20 #include "obt/ddparse.h"
27 gchar
*name
; /*!< Specific name for the object (eg Firefox) */
28 gchar
*generic
; /*!< Generic name for the object (eg Web Browser) */
29 gchar
*comment
; /*!< Comment/description to display for the object */
30 gchar
*icon
; /*!< Name/path for an icon for the object */
34 gchar
*exec
; /*!< Executable to run for the app */
35 gchar
*wdir
; /*!< Working dir to run the app in */
36 gboolean term
; /*!< Run the app in a terminal or not */
39 /* XXX gchar**? or something better, a mime struct.. maybe
40 glib has something i can use. */
41 gchar
**mime
; /*!< Mime types the app can open */
43 ObtLinkAppStartup startup
;
44 gchar
*startup_wmclass
;
54 ObtLink
* obt_link_from_ddfile(const gchar
*name
, GSList
*paths
)
57 GHashTable
*groups
, *keys
;
60 groups
= obt_ddparse_file(name
, paths
);
61 if (!groups
) return NULL
;
62 g
= g_hash_table_lookup(groups
, "Desktop Entry");
64 g_hash_table_destroy(groups
);
68 keys
= obt_ddparse_group_keys(g
);
70 lnk
= g_slice_new(ObtLink
);
72 /* XXX turn the values in the .desktop file into an ObtLink */
77 void obt_link_ref(ObtLink
*dd
)
82 void obt_link_unref(ObtLink
*dd
)
85 g_slice_free(ObtLink
, dd
);