edelib 2.1.0
DesktopFile.h
1/*
2 * $Id: DesktopFile.h 3576 2014-06-20 10:04:55Z karijes $
3 *
4 * .desktop file reader and writer
5 * Copyright (c) 2005-2014 edelib authors
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef __EDELIB_DESKTOPFILE_H__
22#define __EDELIB_DESKTOPFILE_H__
23
24#include "Config.h"
25#include "String.h"
26#include "List.h"
27
28EDELIB_NS_BEGIN
29
40
51
74class EDELIB_API DesktopFile : public Config {
75private:
76 unsigned int errcode;
77 DesktopFileType dtype;
78
79public:
84
89
95 bool load(const char* fname);
96
102 bool save(const char* fname);
103
109
119 operator bool(void) const { return ((errcode == DESK_FILE_SUCCESS) ? 1 : 0); }
120
125
132 bool name(char* val, int len);
133
140 bool generic_name(char* val, int len);
141
148 bool comment(char* val, int len);
149
155 bool icon(char* val, int len);
156
164 bool exec(char* val, int len);
165
174 bool try_exec(bool& program_found);
175
180 bool path(char* val, int len);
181
186 bool url(char* val, int len);
187
191 bool mime_type(char* val, int len);
192
196 bool no_display(void);
197
201 bool hidden(void);
202
206 bool terminal(void);
207
211 bool startup_notify(void);
212
216 bool only_show_in(char* val, int len);
217
223
228 bool not_show_in(char* val, int len);
229
235
240
244 void set_name(const char* val);
245
249 void set_generic_name(const char* val);
250
254 void set_comment(const char* val);
255
259 void set_icon(const char* val);
260
264 void set_exec(const char* val);
265
269 void set_try_exec(const char* val);
270
274 void set_path(const char* val);
275
279 void set_url(const char* val);
280
284 void set_mime_type(const char* val);
285
289 void set_no_display(bool val);
290
294 void set_hidden(bool val);
295
299 void set_terminal(bool val);
300
304 void set_startup_notify(bool val);
305
311
317};
318
319EDELIB_NS_END
320#endif
A config file reader.
Definition Config.h:112
.desktop file reader and writer
Definition DesktopFile.h:74
void set_exec(const char *val)
void create_new(DesktopFileType t)
bool name(char *val, int len)
bool icon(char *val, int len)
void set_icon(const char *val)
bool url(char *val, int len)
bool path(char *val, int len)
void set_try_exec(const char *val)
bool not_show_in(char *val, int len)
bool only_show_in(list< String > &lst)
void set_hidden(bool val)
bool startup_notify(void)
bool mime_type(char *val, int len)
void set_terminal(bool val)
bool comment(char *val, int len)
void set_path(const char *val)
void set_name(const char *val)
void set_no_display(bool val)
bool only_show_in(char *val, int len)
bool try_exec(bool &program_found)
void set_url(const char *val)
void set_comment(const char *val)
void set_generic_name(const char *val)
bool exec(char *val, int len)
void set_not_show_in(const list< String > &lst)
void set_startup_notify(bool val)
void set_mime_type(const char *val)
bool not_show_in(list< String > &lst)
bool save(const char *fname)
void set_type(DesktopFileType t)
bool generic_name(char *val, int len)
void set_only_show_in(const list< String > &lst)
bool no_display(void)
DesktopFileType type(void)
bool load(const char *fname)
Linked list class.
Definition List.h:160
DesktopFileType
Reported file type from DesktopFile::type()
Definition DesktopFile.h:45
@ DESK_FILE_TYPE_UNKNOWN
Unknown type (Type key)
Definition DesktopFile.h:46
@ DESK_FILE_TYPE_LINK
Link type.
Definition DesktopFile.h:48
@ DESK_FILE_TYPE_DIRECTORY
Directory type.
Definition DesktopFile.h:49
@ DESK_FILE_TYPE_APPLICATION
Application type.
Definition DesktopFile.h:47
DesktopFileErrors
Error codes from DesktopFile class.
Definition DesktopFile.h:34
@ DESK_FILE_EMPTY
file not loaded
Definition DesktopFile.h:36
@ DESK_FILE_ERR_BAD
malformed file, or not .desktop file
Definition DesktopFile.h:38
@ DESK_FILE_ERR_FILE
trouble accessing config file or directory
Definition DesktopFile.h:37
@ DESK_FILE_SUCCESS
successful operation
Definition DesktopFile.h:35