| 1 |
/* |
|---|
| 2 |
* This file is part of gtkD. |
|---|
| 3 |
* |
|---|
| 4 |
* gtkD is free software; you can redistribute it and/or modify |
|---|
| 5 |
* it under the terms of the GNU Lesser General Public License |
|---|
| 6 |
* as published by the Free Software Foundation; either version 3 |
|---|
| 7 |
* of the License, or (at your option) any later version, with |
|---|
| 8 |
* some exceptions, please read the COPYING file. |
|---|
| 9 |
* |
|---|
| 10 |
* gtkD is distributed in the hope that it will be useful, |
|---|
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 |
* GNU Lesser General Public License for more details. |
|---|
| 14 |
* |
|---|
| 15 |
* You should have received a copy of the GNU Lesser General Public License |
|---|
| 16 |
* along with gtkD; if not, write to the Free Software |
|---|
| 17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA |
|---|
| 18 |
*/ |
|---|
| 19 |
|
|---|
| 20 |
// generated automatically - do not change |
|---|
| 21 |
// find conversion definition on APILookup.txt |
|---|
| 22 |
// implement new conversion functionalities on the wrap.utils pakage |
|---|
| 23 |
|
|---|
| 24 |
/* |
|---|
| 25 |
* Conversion parameters: |
|---|
| 26 |
* inFile = gio-Desktop-file-based-GAppInfo.html |
|---|
| 27 |
* outPack = gio |
|---|
| 28 |
* outFile = DesktopAppInfo |
|---|
| 29 |
* strct = GDesktopAppInfo |
|---|
| 30 |
* realStrct= |
|---|
| 31 |
* ctorStrct= |
|---|
| 32 |
* clss = DesktopAppInfo |
|---|
| 33 |
* interf = |
|---|
| 34 |
* class Code: Yes |
|---|
| 35 |
* interface Code: No |
|---|
| 36 |
* template for: |
|---|
| 37 |
* extend = |
|---|
| 38 |
* implements: |
|---|
| 39 |
* - AppInfoIF |
|---|
| 40 |
* prefixes: |
|---|
| 41 |
* - g_desktop_app_info_ |
|---|
| 42 |
* omit structs: |
|---|
| 43 |
* omit prefixes: |
|---|
| 44 |
* omit code: |
|---|
| 45 |
* - g_desktop_app_info_new_from_filename |
|---|
| 46 |
* omit signals: |
|---|
| 47 |
* imports: |
|---|
| 48 |
* - glib.KeyFile |
|---|
| 49 |
* - gio.AppInfo |
|---|
| 50 |
* - gio.AppInfoIF |
|---|
| 51 |
* - gio.AppInfoT |
|---|
| 52 |
* - gio.AppInfoIF |
|---|
| 53 |
* structWrap: |
|---|
| 54 |
* - GAppInfo* -> AppInfoIF |
|---|
| 55 |
* - GKeyFile* -> KeyFile |
|---|
| 56 |
* module aliases: |
|---|
| 57 |
* local aliases: |
|---|
| 58 |
* overrides: |
|---|
| 59 |
*/ |
|---|
| 60 |
|
|---|
| 61 |
module gio.DesktopAppInfo; |
|---|
| 62 |
|
|---|
| 63 |
public import gtkc.giotypes; |
|---|
| 64 |
|
|---|
| 65 |
private import gtkc.gio; |
|---|
| 66 |
private import glib.ConstructionException; |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
private import glib.KeyFile; |
|---|
| 70 |
private import gio.AppInfo; |
|---|
| 71 |
private import gio.AppInfoIF; |
|---|
| 72 |
private import gio.AppInfoT; |
|---|
| 73 |
private import gio.AppInfoIF; |
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
private import gobject.ObjectG; |
|---|
| 78 |
|
|---|
| 79 |
/** |
|---|
| 80 |
* Description |
|---|
| 81 |
* GDesktopAppInfo is an implementation of GAppInfo based on |
|---|
| 82 |
* desktop files. |
|---|
| 83 |
* Note that <gio/gdesktopappinfo.h> belongs to |
|---|
| 84 |
* the UNIX-specific GIO interfaces, thus you have to use the |
|---|
| 85 |
* gio-unix-2.0.pc pkg-config file when using it. |
|---|
| 86 |
*/ |
|---|
| 87 |
public class DesktopAppInfo : ObjectG, AppInfoIF |
|---|
| 88 |
{ |
|---|
| 89 |
|
|---|
| 90 |
/** the main Gtk struct */ |
|---|
| 91 |
protected GDesktopAppInfo* gDesktopAppInfo; |
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 |
public GDesktopAppInfo* getDesktopAppInfoStruct() |
|---|
| 95 |
{ |
|---|
| 96 |
return gDesktopAppInfo; |
|---|
| 97 |
} |
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
/** the main Gtk struct as a void* */ |
|---|
| 101 |
protected override void* getStruct() |
|---|
| 102 |
{ |
|---|
| 103 |
return cast(void*)gDesktopAppInfo; |
|---|
| 104 |
} |
|---|
| 105 |
|
|---|
| 106 |
/** |
|---|
| 107 |
* Sets our main struct and passes it to the parent class |
|---|
| 108 |
*/ |
|---|
| 109 |
public this (GDesktopAppInfo* gDesktopAppInfo) |
|---|
| 110 |
{ |
|---|
| 111 |
if(gDesktopAppInfo is null) |
|---|
| 112 |
{ |
|---|
| 113 |
this = null; |
|---|
| 114 |
return; |
|---|
| 115 |
} |
|---|
| 116 |
//Check if there already is a D object for this gtk struct |
|---|
| 117 |
void* ptr = getDObject(cast(GObject*)gDesktopAppInfo); |
|---|
| 118 |
if( ptr !is null ) |
|---|
| 119 |
{ |
|---|
| 120 |
this = cast(DesktopAppInfo)ptr; |
|---|
| 121 |
return; |
|---|
| 122 |
} |
|---|
| 123 |
super(cast(GObject*)gDesktopAppInfo); |
|---|
| 124 |
this.gDesktopAppInfo = gDesktopAppInfo; |
|---|
| 125 |
} |
|---|
| 126 |
|
|---|
| 127 |
protected override void setStruct(GObject* obj) |
|---|
| 128 |
{ |
|---|
| 129 |
super.setStruct(obj); |
|---|
| 130 |
gDesktopAppInfo = cast(GDesktopAppInfo*)obj; |
|---|
| 131 |
} |
|---|
| 132 |
|
|---|
| 133 |
// add the AppInfo capabilities |
|---|
| 134 |
mixin AppInfoT!(GDesktopAppInfo); |
|---|
| 135 |
|
|---|
| 136 |
public static DesktopAppInfo createFromFilename(string filename) |
|---|
| 137 |
{ |
|---|
| 138 |
return new DesktopAppInfo(g_desktop_app_info_new_from_filename(Str.toStringz(filename))); |
|---|
| 139 |
} |
|---|
| 140 |
|
|---|
| 141 |
/** |
|---|
| 142 |
*/ |
|---|
| 143 |
|
|---|
| 144 |
/** |
|---|
| 145 |
* Creates a new GDesktopAppInfo. |
|---|
| 146 |
* Since 2.18 |
|---|
| 147 |
* Params: |
|---|
| 148 |
* keyFile = an opened GKeyFile |
|---|
| 149 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 150 |
*/ |
|---|
| 151 |
public this (KeyFile keyFile) |
|---|
| 152 |
{ |
|---|
| 153 |
// GDesktopAppInfo * g_desktop_app_info_new_from_keyfile (GKeyFile *key_file); |
|---|
| 154 |
auto p = g_desktop_app_info_new_from_keyfile((keyFile is null) ? null : keyFile.getKeyFileStruct()); |
|---|
| 155 |
if(p is null) |
|---|
| 156 |
{ |
|---|
| 157 |
throw new ConstructionException("null returned by g_desktop_app_info_new_from_keyfile((keyFile is null) ? null : keyFile.getKeyFileStruct())"); |
|---|
| 158 |
} |
|---|
| 159 |
this(cast(GDesktopAppInfo*) p); |
|---|
| 160 |
} |
|---|
| 161 |
|
|---|
| 162 |
/** |
|---|
| 163 |
* Creates a new GDesktopAppInfo based on a desktop file id. |
|---|
| 164 |
* A desktop file id is the basename of the desktop file, including the |
|---|
| 165 |
* .desktop extension. GIO is looking for a desktop file with this name |
|---|
| 166 |
* in the applications subdirectories of the XDG data |
|---|
| 167 |
* directories (i.e. the directories specified in the |
|---|
| 168 |
* XDG_DATA_HOME and XDG_DATA_DIRS environment |
|---|
| 169 |
* variables). GIO also supports the prefix-to-subdirectory mapping that is |
|---|
| 170 |
* described in the Menu Spec |
|---|
| 171 |
* (i.e. a desktop id of kde-foo.desktop will match |
|---|
| 172 |
* /usr/share/applications/kde/foo.desktop). |
|---|
| 173 |
* Params: |
|---|
| 174 |
* desktopId = the desktop file id |
|---|
| 175 |
* Throws: ConstructionException GTK+ fails to create the object. |
|---|
| 176 |
*/ |
|---|
| 177 |
public this (string desktopId) |
|---|
| 178 |
{ |
|---|
| 179 |
// GDesktopAppInfo * g_desktop_app_info_new (const char *desktop_id); |
|---|
| 180 |
auto p = g_desktop_app_info_new(Str.toStringz(desktopId)); |
|---|
| 181 |
if(p is null) |
|---|
| 182 |
{ |
|---|
| 183 |
throw new ConstructionException("null returned by g_desktop_app_info_new(Str.toStringz(desktopId))"); |
|---|
| 184 |
} |
|---|
| 185 |
this(cast(GDesktopAppInfo*) p); |
|---|
| 186 |
} |
|---|
| 187 |
|
|---|
| 188 |
/** |
|---|
| 189 |
* When info was created from a known filename, return it. In some |
|---|
| 190 |
* situations such as the GDesktopAppInfo returned from |
|---|
| 191 |
* g_desktop_app_info_new_from_keyfile(), this function will return NULL. |
|---|
| 192 |
* Since 2.24 |
|---|
| 193 |
* Returns: The full path to the file for info, or NULL if not known. |
|---|
| 194 |
*/ |
|---|
| 195 |
public string getFilename() |
|---|
| 196 |
{ |
|---|
| 197 |
// const char * g_desktop_app_info_get_filename (GDesktopAppInfo *info); |
|---|
| 198 |
return Str.toString(g_desktop_app_info_get_filename(gDesktopAppInfo)); |
|---|
| 199 |
} |
|---|
| 200 |
|
|---|
| 201 |
/** |
|---|
| 202 |
* A desktop file is hidden if the Hidden key in it is |
|---|
| 203 |
* set to True. |
|---|
| 204 |
* Returns: TRUE if hidden, FALSE otherwise. |
|---|
| 205 |
*/ |
|---|
| 206 |
public int getIsHidden() |
|---|
| 207 |
{ |
|---|
| 208 |
// gboolean g_desktop_app_info_get_is_hidden (GDesktopAppInfo *info); |
|---|
| 209 |
return g_desktop_app_info_get_is_hidden(gDesktopAppInfo); |
|---|
| 210 |
} |
|---|
| 211 |
|
|---|
| 212 |
/** |
|---|
| 213 |
* Sets the name of the desktop that the application is running in. |
|---|
| 214 |
* This is used by g_app_info_should_show() to evaluate the |
|---|
| 215 |
* OnlyShowIn and NotShowIn |
|---|
| 216 |
* desktop entry fields. |
|---|
| 217 |
* The Desktop |
|---|
| 218 |
* Params: |
|---|
| 219 |
* desktopEnv = a string specifying what desktop this is |
|---|
| 220 |
*/ |
|---|
| 221 |
public static void setDesktopEnv(string desktopEnv) |
|---|
| 222 |
{ |
|---|
| 223 |
// void g_desktop_app_info_set_desktop_env (const char *desktop_env); |
|---|
| 224 |
g_desktop_app_info_set_desktop_env(Str.toStringz(desktopEnv)); |
|---|
| 225 |
} |
|---|
| 226 |
} |
|---|