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 module gio.DBusMenuModel;
26 
27 private import gio.DBusConnection;
28 private import gio.MenuModel;
29 private import gio.c.functions;
30 public  import gio.c.types;
31 private import glib.ConstructionException;
32 private import glib.Str;
33 private import gobject.ObjectG;
34 
35 
36 /**
37  * #GDBusMenuModel is an implementation of #GMenuModel that can be used
38  * as a proxy for a menu model that is exported over D-Bus with
39  * g_dbus_connection_export_menu_model().
40  */
41 public class DBusMenuModel : MenuModel
42 {
43 	/** the main Gtk struct */
44 	protected GDBusMenuModel* gDBusMenuModel;
45 
46 	/** Get the main Gtk struct */
47 	public GDBusMenuModel* getDBusMenuModelStruct(bool transferOwnership = false)
48 	{
49 		if (transferOwnership)
50 			ownedRef = false;
51 		return gDBusMenuModel;
52 	}
53 
54 	/** the main Gtk struct as a void* */
55 	protected override void* getStruct()
56 	{
57 		return cast(void*)gDBusMenuModel;
58 	}
59 
60 	/**
61 	 * Sets our main struct and passes it to the parent class.
62 	 */
63 	public this (GDBusMenuModel* gDBusMenuModel, bool ownedRef = false)
64 	{
65 		this.gDBusMenuModel = gDBusMenuModel;
66 		super(cast(GMenuModel*)gDBusMenuModel, ownedRef);
67 	}
68 
69 	/**
70 	 * See_Also: get().
71 	 */
72 	this(DBusConnection connection, string busName, string objectPath)
73 	{
74 		auto p =  g_dbus_menu_model_get((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(busName), Str.toStringz(objectPath));
75 
76 		if(p is null)
77 		{
78 			throw new ConstructionException("null returned by g_dbus_menu_model_get");
79 		}
80 
81 		this(cast(GDBusMenuModel*) p, true);
82 	}
83 
84 	/**
85 	 */
86 
87 	/** */
88 	public static GType getType()
89 	{
90 		return g_dbus_menu_model_get_type();
91 	}
92 
93 	/**
94 	 * Obtains a #GDBusMenuModel for the menu model which is exported
95 	 * at the given @bus_name and @object_path.
96 	 *
97 	 * The thread default main context is taken at the time of this call.
98 	 * All signals on the menu model (and any linked models) are reported
99 	 * with respect to this context.  All calls on the returned menu model
100 	 * (and linked models) must also originate from this same context, with
101 	 * the thread default main context unchanged.
102 	 *
103 	 * Params:
104 	 *     connection = a #GDBusConnection
105 	 *     busName = the bus name which exports the menu model
106 	 *         or %NULL if @connection is not a message bus connection
107 	 *     objectPath = the object path at which the menu model is exported
108 	 *
109 	 * Returns: a #GDBusMenuModel object. Free with
110 	 *     g_object_unref().
111 	 *
112 	 * Since: 2.32
113 	 */
114 	public static DBusMenuModel get(DBusConnection connection, string busName, string objectPath)
115 	{
116 		auto __p = g_dbus_menu_model_get((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(busName), Str.toStringz(objectPath));
117 
118 		if(__p is null)
119 		{
120 			return null;
121 		}
122 
123 		return ObjectG.getDObject!(DBusMenuModel)(cast(GDBusMenuModel*) __p, true);
124 	}
125 }