Frameworks/libpurple.framework/Versions/0.6.2/Headers/desktopitem.h
author Zachary West <zacw@adium.im>
Fri Aug 21 13:25:11 2009 -0700 (2009-08-21)
changeset 2592 e8d15275025e
parent 1739 Frameworks/libpurple.framework/Versions/0.6.0/Headers/desktopitem.h@8b0daad9656c
permissions -rw-r--r--
im.pidgin.adium.1-4 at 267c6165e02e34318a1823960bd04c0639952f73
Evan@653
     1
/**
Evan@653
     2
 * @file desktopitem.h Functions for managing .desktop files
Evan@653
     3
 * @ingroup core
Evan@653
     4
 */
Evan@653
     5
Evan@653
     6
/* Purple is the legal property of its developers, whose names are too numerous
Evan@653
     7
 * to list here.  Please refer to the COPYRIGHT file distributed with this
Evan@653
     8
 * source distribution.
Evan@653
     9
 *
Evan@653
    10
 * This program is free software; you can redistribute it and/or modify
Evan@653
    11
 * it under the terms of the GNU General Public License as published by
Evan@653
    12
 * the Free Software Foundation; either version 2 of the License, or
Evan@653
    13
 * (at your option) any later version.
Evan@653
    14
 *
Evan@653
    15
 * This program is distributed in the hope that it will be useful,
Evan@653
    16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Evan@653
    17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Evan@653
    18
 * GNU General Public License for more details.
Evan@653
    19
 *
Evan@653
    20
 * You should have received a copy of the GNU General Public License
Evan@653
    21
 * along with this program; if not, write to the Free Software
Evan@653
    22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
Evan@653
    23
 *
Evan@653
    24
 */
Evan@653
    25
Evan@653
    26
/*
Evan@653
    27
 * The following code has been adapted from gnome-desktop-item.[ch],
Evan@653
    28
 * as found on gnome-desktop-2.8.1.
Evan@653
    29
 *
Evan@653
    30
 *   Copyright (C) 2004 by Alceste Scalas <alceste.scalas@gmx.net>.
Evan@653
    31
 *
Evan@653
    32
 * Original copyright notice:
Evan@653
    33
 *
Evan@653
    34
 * Copyright (C) 1999, 2000 Red Hat Inc.
Evan@653
    35
 * Copyright (C) 2001 Sid Vicious
Evan@653
    36
 * All rights reserved.
Evan@653
    37
 *
Evan@653
    38
 * This file is part of the Gnome Library.
Evan@653
    39
 *
Evan@653
    40
 * The Gnome Library is free software; you can redistribute it and/or
Evan@653
    41
 * modify it under the terms of the GNU Library General Public License as
Evan@653
    42
 * published by the Free Software Foundation; either version 2 of the
Evan@653
    43
 * License, or (at your option) any later version.
Evan@1427
    44
 *
Evan@653
    45
 * The Gnome Library is distributed in the hope that it will be useful,
Evan@653
    46
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Evan@653
    47
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Evan@653
    48
 * Library General Public License for more details.
Evan@1427
    49
 *
Evan@653
    50
 * You should have received a copy of the GNU Library General Public
Evan@653
    51
 * License along with the Gnome Library; see the file COPYING.LIB.  If not,
Evan@653
    52
 * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Evan@653
    53
 * Boston, MA 02111-1301, USA.
Evan@653
    54
 */
Evan@653
    55
Evan@653
    56
#ifndef _PURPLE_DESKTOP_ITEM_H_
Evan@653
    57
#define _PURPLE_DESKTOP_ITEM_H_
Evan@653
    58
Evan@653
    59
#include <glib.h>
Evan@653
    60
#include <glib-object.h>
Evan@653
    61
Evan@653
    62
G_BEGIN_DECLS
Evan@653
    63
Evan@653
    64
typedef enum {
Evan@653
    65
	PURPLE_DESKTOP_ITEM_TYPE_NULL = 0 /* This means its NULL, that is, not
Evan@653
    66
					  * set */,
Evan@653
    67
	PURPLE_DESKTOP_ITEM_TYPE_OTHER /* This means it's not one of the below
Evan@653
    68
					 strings types, and you must get the
Evan@653
    69
					 Type attribute. */,
Evan@653
    70
Evan@653
    71
	/* These are the standard compliant types: */
Evan@653
    72
	PURPLE_DESKTOP_ITEM_TYPE_APPLICATION,
Evan@653
    73
	PURPLE_DESKTOP_ITEM_TYPE_LINK,
Evan@653
    74
	PURPLE_DESKTOP_ITEM_TYPE_FSDEVICE,
Evan@653
    75
	PURPLE_DESKTOP_ITEM_TYPE_MIME_TYPE,
Evan@653
    76
	PURPLE_DESKTOP_ITEM_TYPE_DIRECTORY,
Evan@653
    77
	PURPLE_DESKTOP_ITEM_TYPE_SERVICE,
Evan@653
    78
	PURPLE_DESKTOP_ITEM_TYPE_SERVICE_TYPE
Evan@653
    79
} PurpleDesktopItemType;
Evan@653
    80
Evan@653
    81
typedef struct _PurpleDesktopItem PurpleDesktopItem;
Evan@653
    82
Evan@653
    83
#define PURPLE_TYPE_DESKTOP_ITEM         (purple_desktop_item_get_type ())
Evan@653
    84
GType purple_desktop_item_get_type       (void);
Evan@653
    85
Evan@653
    86
/* standard */
Evan@653
    87
#define PURPLE_DESKTOP_ITEM_ENCODING	"Encoding" /* string */
Evan@653
    88
#define PURPLE_DESKTOP_ITEM_VERSION	"Version"  /* numeric */
Evan@653
    89
#define PURPLE_DESKTOP_ITEM_NAME		"Name" /* localestring */
Evan@653
    90
#define PURPLE_DESKTOP_ITEM_GENERIC_NAME	"GenericName" /* localestring */
Evan@653
    91
#define PURPLE_DESKTOP_ITEM_TYPE		"Type" /* string */
Evan@653
    92
#define PURPLE_DESKTOP_ITEM_FILE_PATTERN "FilePattern" /* regexp(s) */
Evan@653
    93
#define PURPLE_DESKTOP_ITEM_TRY_EXEC	"TryExec" /* string */
Evan@653
    94
#define PURPLE_DESKTOP_ITEM_NO_DISPLAY	"NoDisplay" /* boolean */
Evan@653
    95
#define PURPLE_DESKTOP_ITEM_COMMENT	"Comment" /* localestring */
Evan@653
    96
#define PURPLE_DESKTOP_ITEM_EXEC		"Exec" /* string */
Evan@653
    97
#define PURPLE_DESKTOP_ITEM_ACTIONS	"Actions" /* strings */
Evan@653
    98
#define PURPLE_DESKTOP_ITEM_ICON		"Icon" /* string */
Evan@653
    99
#define PURPLE_DESKTOP_ITEM_MINI_ICON	"MiniIcon" /* string */
Evan@653
   100
#define PURPLE_DESKTOP_ITEM_HIDDEN	"Hidden" /* boolean */
Evan@653
   101
#define PURPLE_DESKTOP_ITEM_PATH		"Path" /* string */
Evan@653
   102
#define PURPLE_DESKTOP_ITEM_TERMINAL	"Terminal" /* boolean */
Evan@653
   103
#define PURPLE_DESKTOP_ITEM_TERMINAL_OPTIONS "TerminalOptions" /* string */
Evan@653
   104
#define PURPLE_DESKTOP_ITEM_SWALLOW_TITLE "SwallowTitle" /* string */
Evan@653
   105
#define PURPLE_DESKTOP_ITEM_SWALLOW_EXEC	"SwallowExec" /* string */
Evan@653
   106
#define PURPLE_DESKTOP_ITEM_MIME_TYPE	"MimeType" /* regexp(s) */
Evan@653
   107
#define PURPLE_DESKTOP_ITEM_PATTERNS	"Patterns" /* regexp(s) */
Evan@653
   108
#define PURPLE_DESKTOP_ITEM_DEFAULT_APP	"DefaultApp" /* string */
Evan@653
   109
#define PURPLE_DESKTOP_ITEM_DEV		"Dev" /* string */
Evan@653
   110
#define PURPLE_DESKTOP_ITEM_FS_TYPE	"FSType" /* string */
Evan@653
   111
#define PURPLE_DESKTOP_ITEM_MOUNT_POINT	"MountPoint" /* string */
Evan@653
   112
#define PURPLE_DESKTOP_ITEM_READ_ONLY	"ReadOnly" /* boolean */
Evan@653
   113
#define PURPLE_DESKTOP_ITEM_UNMOUNT_ICON "UnmountIcon" /* string */
Evan@653
   114
#define PURPLE_DESKTOP_ITEM_SORT_ORDER	"SortOrder" /* strings */
Evan@653
   115
#define PURPLE_DESKTOP_ITEM_URL		"URL" /* string */
Evan@653
   116
#define PURPLE_DESKTOP_ITEM_DOC_PATH	"X-GNOME-DocPath" /* string */
Evan@653
   117
Evan@653
   118
/**
Evan@653
   119
 * This function loads 'filename' and turns it into a PurpleDesktopItem.
Evan@653
   120
 *
Evan@653
   121
 * @param filename The filename or directory path to load the PurpleDesktopItem from
Evan@653
   122
 *
Evan@653
   123
 * @return The newly loaded item, or NULL on error.
Evan@653
   124
 */
Evan@653
   125
PurpleDesktopItem *purple_desktop_item_new_from_file (const char *filename);
Evan@653
   126
Evan@653
   127
/**
Evan@653
   128
 * Gets the type attribute (the 'Type' field) of the item.  This should
Evan@653
   129
 * usually be 'Application' for an application, but it can be 'Directory'
Evan@653
   130
 * for a directory description.  There are other types available as well.
Evan@653
   131
 * The type usually indicates how the desktop item should be handeled and
Evan@653
   132
 * how the 'Exec' field should be handeled.
Evan@653
   133
 *
Evan@653
   134
 * @param item A desktop item
Evan@653
   135
 *
Evan@653
   136
 * @return The type of the specified 'item'. The returned memory
Evan@653
   137
 * remains owned by the PurpleDesktopItem and should not be freed.
Evan@653
   138
 */
Evan@653
   139
PurpleDesktopItemType purple_desktop_item_get_entry_type (const PurpleDesktopItem *item);
Evan@653
   140
Evan@653
   141
/**
Evan@653
   142
 * Gets the value of an attribute of the item, as a string.
Evan@653
   143
 *
Evan@653
   144
 * @param item A desktop item
Evan@653
   145
 * @param attr The attribute to look for
Evan@653
   146
 *
Evan@653
   147
 * @return The value of the specified item attribute.
Evan@653
   148
 */
Evan@653
   149
const char *purple_desktop_item_get_string (const PurpleDesktopItem *item,
Evan@653
   150
					  const char *attr);
Evan@653
   151
Evan@653
   152
/**
Evan@653
   153
 * Creates a copy of a PurpleDesktopItem.  The new copy has a refcount of 1.
Evan@653
   154
 * Note: Section stack is NOT copied.
Evan@653
   155
 *
Evan@653
   156
 * @param item The item to be copied
Evan@653
   157
 *
Evan@1427
   158
 * @return The new copy
Evan@653
   159
 */
Evan@653
   160
PurpleDesktopItem *purple_desktop_item_copy (const PurpleDesktopItem *item);
Evan@653
   161
Evan@653
   162
/**
Evan@653
   163
 * Decreases the reference count of the specified item, and destroys
Evan@653
   164
 * the item if there are no more references left.
Evan@653
   165
 *
Evan@653
   166
 * @param item A desktop item
Evan@653
   167
 */
Evan@653
   168
void purple_desktop_item_unref (PurpleDesktopItem *item);
Evan@653
   169
Evan@653
   170
G_END_DECLS
Evan@653
   171
Evan@653
   172
#endif /* _PURPLE_DESKTOP_ITEM_H_ */