1 module webkit2.ApplicationInfo;
2 
3 private import glib.ConstructionException;
4 private import glib.Str;
5 private import gobject.ObjectG;
6 private import webkit2.c.functions;
7 public  import webkit2.c.types;
8 
9 
10 /** */
11 public class ApplicationInfo
12 {
13 	/** the main Gtk struct */
14 	protected WebKitApplicationInfo* webKitApplicationInfo;
15 	protected bool ownedRef;
16 
17 	/** Get the main Gtk struct */
18 	public WebKitApplicationInfo* getApplicationInfoStruct(bool transferOwnership = false)
19 	{
20 		if (transferOwnership)
21 			ownedRef = false;
22 		return webKitApplicationInfo;
23 	}
24 
25 	/** the main Gtk struct as a void* */
26 	protected void* getStruct()
27 	{
28 		return cast(void*)webKitApplicationInfo;
29 	}
30 
31 	/**
32 	 * Sets our main struct and passes it to the parent class.
33 	 */
34 	public this (WebKitApplicationInfo* webKitApplicationInfo, bool ownedRef = false)
35 	{
36 		this.webKitApplicationInfo = webKitApplicationInfo;
37 		this.ownedRef = ownedRef;
38 	}
39 
40 	~this ()
41 	{
42 		if ( ownedRef )
43 			webkit_application_info_unref(webKitApplicationInfo);
44 	}
45 
46 
47 	/** */
48 	public static GType getType()
49 	{
50 		return webkit_application_info_get_type();
51 	}
52 
53 	/**
54 	 * Creates a new #WebKitApplicationInfo
55 	 *
56 	 * Returns: the newly created #WebKitApplicationInfo.
57 	 *
58 	 * Since: 2.18
59 	 *
60 	 * Throws: ConstructionException GTK+ fails to create the object.
61 	 */
62 	public this()
63 	{
64 		auto __p = webkit_application_info_new();
65 
66 		if(__p is null)
67 		{
68 			throw new ConstructionException("null returned by new");
69 		}
70 
71 		this(cast(WebKitApplicationInfo*) __p);
72 	}
73 
74 	/**
75 	 * Get the name of the application. If webkit_application_info_set_name() hasn't been
76 	 * called with a valid name, this returns g_get_prgname().
77 	 *
78 	 * Returns: the application name
79 	 *
80 	 * Since: 2.18
81 	 */
82 	public string getName()
83 	{
84 		return Str.toString(webkit_application_info_get_name(webKitApplicationInfo));
85 	}
86 
87 	/**
88 	 * Get the application version previously set with webkit_application_info_set_version().
89 	 *
90 	 * Params:
91 	 *     major = return location for the major version number
92 	 *     minor = return location for the minor version number
93 	 *     micro = return location for the micro version number
94 	 *
95 	 * Since: 2.18
96 	 */
97 	public void getVersion(out ulong major, out ulong minor, out ulong micro)
98 	{
99 		webkit_application_info_get_version(webKitApplicationInfo, &major, &minor, &micro);
100 	}
101 
102 	alias doref = ref_;
103 	/**
104 	 * Atomically increments the reference count of @info by one. This
105 	 * function is MT-safe and may be called from any thread.
106 	 *
107 	 * Returns: The passed in #WebKitApplicationInfo
108 	 *
109 	 * Since: 2.18
110 	 */
111 	public ApplicationInfo ref_()
112 	{
113 		auto __p = webkit_application_info_ref(webKitApplicationInfo);
114 
115 		if(__p is null)
116 		{
117 			return null;
118 		}
119 
120 		return ObjectG.getDObject!(ApplicationInfo)(cast(WebKitApplicationInfo*) __p, true);
121 	}
122 
123 	/**
124 	 * Set the name of the application. If not provided, or %NULL is passed,
125 	 * g_get_prgname() will be used.
126 	 *
127 	 * Params:
128 	 *     name = the application name
129 	 *
130 	 * Since: 2.18
131 	 */
132 	public void setName(string name)
133 	{
134 		webkit_application_info_set_name(webKitApplicationInfo, Str.toStringz(name));
135 	}
136 
137 	/**
138 	 * Set the application version. If the application doesn't use the format
139 	 * major.minor.micro you can pass 0 as the micro to use major.minor, or pass
140 	 * 0 as both micro and minor to use only major number. Any other format must
141 	 * be converted to major.minor.micro so that it can be used in version comparisons.
142 	 *
143 	 * Params:
144 	 *     major = the major version number
145 	 *     minor = the minor version number
146 	 *     micro = the micro version number
147 	 *
148 	 * Since: 2.18
149 	 */
150 	public void setVersion(ulong major, ulong minor, ulong micro)
151 	{
152 		webkit_application_info_set_version(webKitApplicationInfo, major, minor, micro);
153 	}
154 
155 	/**
156 	 * Atomically decrements the reference count of @info by one. If the
157 	 * reference count drops to 0, all memory allocated by the #WebKitApplicationInfo is
158 	 * released. This function is MT-safe and may be called from any
159 	 * thread.
160 	 *
161 	 * Since: 2.18
162 	 */
163 	public void unref()
164 	{
165 		webkit_application_info_unref(webKitApplicationInfo);
166 	}
167 }