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