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 
65 private import glib.Str;
66 private import gio.DBusConnection;
67 
68 
69 
70 private import gio.MenuModel;
71 
72 /**
73  * GDBusMenuModel is an implementation of GMenuModel that can be used
74  * as a proxy for a menu model that is exported over D-Bus with
75  * g_dbus_connection_export_menu_model().
76  */
77 public class DBusMenuModel : MenuModel
78 {
79 	
80 	/** the main Gtk struct */
81 	protected GDBusMenuModel* gDBusMenuModel;
82 	
83 	
84 	public GDBusMenuModel* getDBusMenuModelStruct()
85 	{
86 		return gDBusMenuModel;
87 	}
88 	
89 	
90 	/** the main Gtk struct as a void* */
91 	protected override void* getStruct()
92 	{
93 		return cast(void*)gDBusMenuModel;
94 	}
95 	
96 	/**
97 	 * Sets our main struct and passes it to the parent class
98 	 */
99 	public this (GDBusMenuModel* gDBusMenuModel)
100 	{
101 		super(cast(GMenuModel*)gDBusMenuModel);
102 		this.gDBusMenuModel = gDBusMenuModel;
103 	}
104 	
105 	protected override void setStruct(GObject* obj)
106 	{
107 		super.setStruct(obj);
108 		gDBusMenuModel = cast(GDBusMenuModel*)obj;
109 	}
110 	
111 	/**
112 	 * See_Also: get().
113 	 */
114 	this(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 			throw new ConstructionException("null returned by g_dbus_menu_model_get");
121 		}
122 		
123 		this(cast(GDBusMenuModel*) p);
124 	}
125 	
126 	/**
127 	 */
128 	
129 	/**
130 	 * Obtains a GDBusMenuModel for the menu model which is exported
131 	 * at the given bus_name and object_path.
132 	 * The thread default main context is taken at the time of this call.
133 	 * All signals on the menu model (and any linked models) are reported
134 	 * with respect to this context. All calls on the returned menu model
135 	 * (and linked models) must also originate from this same context, with
136 	 * the thread default main context unchanged.
137 	 * Since 2.32
138 	 * Params:
139 	 * connection = a GDBusConnection
140 	 * busName = the bus name which exports the menu model
141 	 * objectPath = the object path at which the menu model is exported
142 	 * Returns: a GDBusMenuModel object. Free with g_object_unref(). [transfer full]
143 	 */
144 	public static DBusMenuModel gDbusMenuModelGet(DBusConnection connection, string busName, string objectPath)
145 	{
146 		// GDBusMenuModel * g_dbus_menu_model_get (GDBusConnection *connection,  const gchar *bus_name,  const gchar *object_path);
147 		auto p = g_dbus_menu_model_get((connection is null) ? null : connection.getDBusConnectionStruct(), Str.toStringz(busName), Str.toStringz(objectPath));
148 		
149 		if(p is null)
150 		{
151 			return null;
152 		}
153 		
154 		return ObjectG.getDObject!(DBusMenuModel)(cast(GDBusMenuModel*) p);
155 	}
156 }