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 peas.PluginManagerView; 26 27 private import glib.ConstructionException; 28 private import gobject.ObjectG; 29 private import gobject.Signals; 30 private import gtk.BuildableIF; 31 private import gtk.BuildableT; 32 private import gtk.Menu; 33 private import gtk.ScrollableIF; 34 private import gtk.ScrollableT; 35 private import gtk.TreeView; 36 private import gtk.Widget; 37 public import gtkc.gdktypes; 38 private import peas.Engine; 39 private import peas.PluginInfo; 40 private import peasc.peas; 41 public import peasc.peastypes; 42 43 44 /** 45 * The #PeasGtkPluginManagerView structure contains only private data 46 * and should only be accessed using the provided API. 47 */ 48 public class PluginManagerView : TreeView 49 { 50 /** the main Gtk struct */ 51 protected PeasGtkPluginManagerView* peasGtkPluginManagerView; 52 53 /** Get the main Gtk struct */ 54 public PeasGtkPluginManagerView* getPluginManagerViewStruct() 55 { 56 return peasGtkPluginManagerView; 57 } 58 59 /** the main Gtk struct as a void* */ 60 protected override void* getStruct() 61 { 62 return cast(void*)peasGtkPluginManagerView; 63 } 64 65 protected override void setStruct(GObject* obj) 66 { 67 peasGtkPluginManagerView = cast(PeasGtkPluginManagerView*)obj; 68 super.setStruct(obj); 69 } 70 71 /** 72 * Sets our main struct and passes it to the parent class. 73 */ 74 public this (PeasGtkPluginManagerView* peasGtkPluginManagerView, bool ownedRef = false) 75 { 76 this.peasGtkPluginManagerView = peasGtkPluginManagerView; 77 super(cast(GtkTreeView*)peasGtkPluginManagerView, ownedRef); 78 } 79 80 81 /** */ 82 public static GType getType() 83 { 84 return peas_gtk_plugin_manager_view_get_type(); 85 } 86 87 /** 88 * Creates a new plugin manager view for the given #PeasEngine. 89 * 90 * If @engine is %NULL, then the default engine will be used. 91 * 92 * Params: 93 * engine = A #PeasEngine, or %NULL. 94 * 95 * Return: the new #PeasGtkPluginManagerView. 96 * 97 * Throws: ConstructionException GTK+ fails to create the object. 98 */ 99 public this(Engine engine) 100 { 101 auto p = peas_gtk_plugin_manager_view_new((engine is null) ? null : engine.getEngineStruct()); 102 103 if(p is null) 104 { 105 throw new ConstructionException("null returned by new"); 106 } 107 108 this(cast(PeasGtkPluginManagerView*) p); 109 } 110 111 /** 112 * Returns the currently selected plugin, or %NULL if a plugin is not selected. 113 * 114 * Return: the selected plugin. 115 */ 116 public PluginInfo getSelectedPlugin() 117 { 118 auto p = peas_gtk_plugin_manager_view_get_selected_plugin(peasGtkPluginManagerView); 119 120 if(p is null) 121 { 122 return null; 123 } 124 125 return ObjectG.getDObject!(PluginInfo)(cast(PeasPluginInfo*) p); 126 } 127 128 /** 129 * Returns if builtin plugins should be shown. 130 * 131 * Deprecated: Use hidden plugins instead. 132 * 133 * Return: if builtin plugins should be shown. 134 */ 135 public bool getShowBuiltin() 136 { 137 return peas_gtk_plugin_manager_view_get_show_builtin(peasGtkPluginManagerView) != 0; 138 } 139 140 /** 141 * Selects the given plugin. 142 * 143 * Params: 144 * info = A #PeasPluginInfo. 145 */ 146 public void setSelectedPlugin(PluginInfo info) 147 { 148 peas_gtk_plugin_manager_view_set_selected_plugin(peasGtkPluginManagerView, (info is null) ? null : info.getPluginInfoStruct()); 149 } 150 151 /** 152 * Sets if builtin plugins should be shown. 153 * 154 * Deprecated: Use hidden plugins instead. 155 * 156 * Params: 157 * showBuiltin = If builtin plugins should be shown. 158 */ 159 public void setShowBuiltin(bool showBuiltin) 160 { 161 peas_gtk_plugin_manager_view_set_show_builtin(peasGtkPluginManagerView, showBuiltin); 162 } 163 164 int[string] connectedSignals; 165 166 void delegate(Menu, PluginManagerView)[] onPopulatePopupListeners; 167 /** 168 * The ::populate-popup signal is emitted before showing the context 169 * menu of the view. If you need to add items to the context menu, 170 * connect to this signal and add your menuitems to the @menu. 171 * 172 * Params: 173 * menu = A #GtkMenu. 174 */ 175 void addOnPopulatePopup(void delegate(Menu, PluginManagerView) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0) 176 { 177 if ( "populate-popup" !in connectedSignals ) 178 { 179 Signals.connectData( 180 this, 181 "populate-popup", 182 cast(GCallback)&callBackPopulatePopup, 183 cast(void*)this, 184 null, 185 connectFlags); 186 connectedSignals["populate-popup"] = 1; 187 } 188 onPopulatePopupListeners ~= dlg; 189 } 190 extern(C) static void callBackPopulatePopup(PeasGtkPluginManagerView* pluginmanagerviewStruct, GtkMenu* menu, PluginManagerView _pluginmanagerview) 191 { 192 foreach ( void delegate(Menu, PluginManagerView) dlg; _pluginmanagerview.onPopulatePopupListeners ) 193 { 194 dlg(ObjectG.getDObject!(Menu)(menu), _pluginmanagerview); 195 } 196 } 197 }