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  = GDBusMenuModel.html
27  * outPack = gio
28  * outFile = DBusMenuModel
29  * strct   = GDBusMenuModel
30  * realStrct=
31  * ctorStrct=
32  * clss    = DBusMenuModel
33  * interf  = 
34  * class Code: Yes
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- g_menu_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- gio.DBusConnection
48  * structWrap:
49  * 	- GDBusConnection* -> DBusConnection
50  * 	- GDBusMenuModel* -> DBusMenuModel
51  * module aliases:
52  * local aliases:
53  * overrides:
54  */
55 
56 module gio.DBusMenuModel;
57 
58 public  import gtkc.giotypes;
59 
60 private import gtkc.gio;
61 private import glib.ConstructionException;
62 private import gobject.ObjectG;
63 
64 private import glib.Str;
65 private import gio.DBusConnection;
66 
67 
68 private import gio.MenuModel;
69 
70 /**
71  * GDBusMenuModel is an implementation of GMenuModel that can be used
72  * as a proxy for a menu model that is exported over D-Bus with
73  * g_dbus_connection_export_menu_model().
74  */
75 public class DBusMenuModel : MenuModel
76 {
77 	
78 	/** the main Gtk struct */
79 	protected GDBusMenuModel* gDBusMenuModel;
80 	
81 	
82 	/** Get the main Gtk struct */
83 	public GDBusMenuModel* getDBusMenuModelStruct()
84 	{
85 		return gDBusMenuModel;
86 	}
87 	
88 	
89 	/** the main Gtk struct as a void* */
90 	protected override void* getStruct()
91 	{
92 		return cast(void*)gDBusMenuModel;
93 	}
94 	
95 	/**
96 	 * Sets our main struct and passes it to the parent class
97 	 */
98 	public this (GDBusMenuModel* gDBusMenuModel)
99 	{
100 		super(cast(GMenuModel*)gDBusMenuModel);
101 		this.gDBusMenuModel = gDBusMenuModel;
102 	}
103 	
104 	protected override void setStruct(GObject* obj)
105 	{
106 		super.setStruct(obj);
107 		gDBusMenuModel = cast(GDBusMenuModel*)obj;
108 	}
109 	
110 	/**
111 	 * See_Also: get().
112 	 */
113 	this(DBusConnection connection, string busName, string objectPath)
114 	{
115 		auto p =  g_dbus_menu_model_get((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(busName), Str.toStringz(objectPath));
116 		
117 		if(p is null)
118 		{
119 			throw new ConstructionException("null returned by g_dbus_menu_model_get");
120 		}
121 		
122 		this(cast(GDBusMenuModel*) p);
123 	}
124 	
125 	/**
126 	 */
127 	
128 	/**
129 	 * Obtains a GDBusMenuModel for the menu model which is exported
130 	 * at the given bus_name and object_path.
131 	 * The thread default main context is taken at the time of this call.
132 	 * All signals on the menu model (and any linked models) are reported
133 	 * with respect to this context. All calls on the returned menu model
134 	 * (and linked models) must also originate from this same context, with
135 	 * the thread default main context unchanged.
136 	 * Since 2.32
137 	 * Params:
138 	 * connection = a GDBusConnection
139 	 * busName = the bus name which exports the menu model
140 	 * objectPath = the object path at which the menu model is exported
141 	 * Returns: a GDBusMenuModel object. Free with g_object_unref(). [transfer full]
142 	 */
143 	public static DBusMenuModel gDbusMenuModelGet(DBusConnection connection, string busName, string objectPath)
144 	{
145 		// GDBusMenuModel * g_dbus_menu_model_get (GDBusConnection *connection,  const gchar *bus_name,  const gchar *object_path);
146 		auto p = g_dbus_menu_model_get((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(busName), Str.toStringz(objectPath));
147 		
148 		if(p is null)
149 		{
150 			return null;
151 		}
152 		
153 		return ObjectG.getDObject!(DBusMenuModel)(cast(GDBusMenuModel*) p);
154 	}
155 }