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