summaryrefslogtreecommitdiff
path: root/libmenu/desktop-entries.h
blob: 4c86b4c2cd1f40d3072887192622686a97778368 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
 * Copyright (C) 2002 - 2004 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __DESKTOP_ENTRIES_H__
#define __DESKTOP_ENTRIES_H__

#include <gio/gdesktopappinfo.h>

G_BEGIN_DECLS

typedef enum {
	DESKTOP_ENTRY_INVALID = 0,
	DESKTOP_ENTRY_DESKTOP,
	DESKTOP_ENTRY_DIRECTORY
} DesktopEntryType;

typedef struct DesktopEntry DesktopEntry;

DesktopEntry* desktop_entry_new(const char* path);

DesktopEntry* desktop_entry_ref(DesktopEntry* entry);
DesktopEntry* desktop_entry_copy(DesktopEntry* entry);
DesktopEntry* desktop_entry_reload(DesktopEntry* entry);
void desktop_entry_unref(DesktopEntry* entry);

DesktopEntryType  desktop_entry_get_type     (DesktopEntry *entry);
const char       *desktop_entry_get_path     (DesktopEntry *entry);
const char       *desktop_entry_get_basename (DesktopEntry *entry);
const char       *desktop_entry_get_name     (DesktopEntry *entry);
const char       *desktop_entry_get_generic_name (DesktopEntry *entry);
const char       *desktop_entry_get_comment  (DesktopEntry *entry);
GIcon            *desktop_entry_get_icon     (DesktopEntry *entry);
gboolean          desktop_entry_get_hidden   (DesktopEntry *entry);
gboolean          desktop_entry_get_no_display (DesktopEntry *entry);
gboolean          desktop_entry_get_show_in  (DesktopEntry *entry);

/* Only valid for DESKTOP_ENTRY_DESKTOP */
GDesktopAppInfo  *desktop_entry_get_app_info (DesktopEntry *entry);
gboolean desktop_entry_has_categories (DesktopEntry *entry);
gboolean desktop_entry_has_category   (DesktopEntry *entry,
                                       const char   *category);

void desktop_entry_add_legacy_category(DesktopEntry* src);

typedef struct DesktopEntrySet DesktopEntrySet;

DesktopEntrySet* desktop_entry_set_new(void);
DesktopEntrySet* desktop_entry_set_ref(DesktopEntrySet* set);
void desktop_entry_set_unref(DesktopEntrySet* set);

void desktop_entry_set_add_entry(DesktopEntrySet* set, DesktopEntry* entry, const char* file_id);
DesktopEntry* desktop_entry_set_lookup(DesktopEntrySet* set, const char* file_id);
int desktop_entry_set_get_count(DesktopEntrySet* set);

void desktop_entry_set_union(DesktopEntrySet* set, DesktopEntrySet* with);
void desktop_entry_set_intersection(DesktopEntrySet* set, DesktopEntrySet* with);
void desktop_entry_set_subtract(DesktopEntrySet* set, DesktopEntrySet* other);
void desktop_entry_set_swap_contents(DesktopEntrySet* a, DesktopEntrySet* b);

typedef void (*DesktopEntrySetForeachFunc) (const char* file_id, DesktopEntry* entry, gpointer user_data);

void desktop_entry_set_foreach(DesktopEntrySet* set, DesktopEntrySetForeachFunc func, gpointer user_data);

G_END_DECLS

#endif /* __DESKTOP_ENTRIES_H__ */