public void OnAboutClicked(object o, EventArgs args) { TreeModel model; TreeIter iter; if (pluginTreeView.Selection.GetSelected(out model, out iter)) { string name = (string)pluginStore.GetValue(iter, 1); ViewPlugin vp = Global.Plugins.GetViewPlugin(name, conn.Settings.Name); if (vp != null) { Gtk.AboutDialog ab = new Gtk.AboutDialog(); ab.Authors = vp.Authors; ab.Comments = vp.Description; ab.Copyright = vp.Copyright; ab.ProgramName = vp.Name; ab.Version = vp.Version; ab.Icon = vp.Icon; ab.Run(); ab.Destroy(); } } }
void LoadPluginsFromFile(string fileName) { Assembly asm = Assembly.LoadFrom(fileName); Type [] types = asm.GetTypes(); foreach (Type type in types) { if (type.IsSubclassOf(typeof(ViewPlugin))) { ViewPlugin plugin = (ViewPlugin)Activator.CreateInstance(type); if (plugin == null) { continue; } viewPluginList.Add(plugin); viewPluginHash.Add(plugin.MenuLabel, plugin.Name); Log.Debug("Loaded plugin: {0}", type.FullName); } else if (type.IsSubclassOf(typeof(AttributeViewPlugin))) { AttributeViewPlugin plugin = (AttributeViewPlugin)Activator.CreateInstance(type); if (plugin == null) { continue; } attrPluginList.Add(plugin); Log.Debug("Loaded plugin: {0}", type.FullName); } } }
void OnViewSelected(object o, ViewSelectedEventArgs args) { ViewPlugin vp = Global.Plugins.GetViewPlugin(args.Name, args.ConnectionName); Connection conn = null; if (vp == null) { if (viewDataTreeView != null) { viewDataTreeView.Destroy(); viewDataTreeView = null; } if (serverInfoView != null) { serverInfoView.Destroy(); serverInfoView = null; } conn = Global.Connections [args.ConnectionName]; serverInfoView = new ServerInfoView(conn); valuesScrolledWindow.AddWithViewport(serverInfoView); valuesScrolledWindow.ShowAll(); ToggleButtons(false); UpdateStatusBar(); return; } CleanupView(); if (viewDataTreeView == null) { if (serverInfoView != null) { serverInfoView.Destroy(); serverInfoView = null; } conn = Global.Connections [args.ConnectionName]; viewDataTreeView = new ViewDataTreeView(conn, mainWindow); valuesScrolledWindow.AddWithViewport(viewDataTreeView); valuesScrolledWindow.ShowAll(); } viewDataTreeView.ConfigureView(vp); viewDataTreeView.Populate(); SetupToolbar(vp); GenerateNewMenu(conn); UpdateStatusBar(); }
public PluginConfigureDialog(Connection connection, string pluginName) { conn = connection; colNames = new List <string> (); colAttrs = new List <string> (); ui = new Glade.XML(null, "lat.glade", "pluginConfigureDialog", null); ui.Autoconnect(this); columnStore = new ListStore(typeof(string), typeof(string)); CellRendererText cell = new CellRendererText(); cell.Editable = true; cell.Edited += new EditedHandler(OnNameEdit); columnsTreeView.AppendColumn("Name", cell, "text", 0); cell = new CellRendererText(); cell.Editable = true; cell.Edited += new EditedHandler(OnAttributeEdit); columnsTreeView.AppendColumn("Attribute", cell, "text", 1); columnsTreeView.Model = columnStore; vp = Global.Plugins.GetViewPlugin(pluginName, connection.Settings.Name); if (vp != null) { for (int i = 0; i < vp.ColumnNames.Length; i++) { columnStore.AppendValues(vp.ColumnNames[i], vp.ColumnAttributes[i]); colNames.Add(vp.ColumnNames[i]); colAttrs.Add(vp.ColumnAttributes[i]); } filterEntry.Text = vp.Filter; if (vp.DefaultNewContainer != "") { newContainerButton.Label = vp.DefaultNewContainer; } if (vp.SearchBase != "") { searchBaseButton.Label = vp.SearchBase; } } else { Log.Error("Unable to find view plugin {0}", pluginName); } pluginConfigureDialog.Icon = Global.latIcon; pluginConfigureDialog.Resize(300, 400); pluginConfigureDialog.Run(); pluginConfigureDialog.Destroy(); }
public UserDefaultValuesDialog(ViewPlugin plugin, Connection connection) { vp = plugin; conn = connection; ui = new Glade.XML(null, "dialogs.glade", "defaultValuesDialog", null); ui.Autoconnect(this); passwordEntry.Sensitive = false; SetDefaultValues(); defaultValuesDialog.Run(); defaultValuesDialog.Destroy(); }
public void ShowNewItemDialog(string viewName) { viewPlugin = null; viewPlugin = Global.Plugins.GetViewPlugin(viewName, conn.Settings.Name); if (viewPlugin == null) { return; } ConfigureView(viewPlugin); viewPlugin.OnAddEntry(conn); Populate(); }
void SetupToolbar(ViewPlugin vp) { string tipMsg = null; tipMsg = String.Format("Create a new {0}", vp.Name.ToLower()); newMenuToolButton.TooltipText = tipMsg; newMenuToolButton.Clicked += new EventHandler(viewDataTreeView.OnNewEntryActivate); tipMsg = String.Format("Edit the properties of a {0}", vp.Name.ToLower()); propertiesToolButton.TooltipText = tipMsg; propertiesToolButton.Clicked += new EventHandler(viewDataTreeView.OnEditActivate); tipMsg = String.Format("Delete a {0} from the directory", vp.Name.ToLower()); deleteToolButton.TooltipText = tipMsg; deleteToolButton.Clicked += new EventHandler(viewDataTreeView.OnDeleteActivate); tipMsg = "Refreshes the data from the server"; refreshToolButton.TooltipText = tipMsg; refreshToolButton.Clicked += new EventHandler(viewDataTreeView.OnRefreshActivate); ToggleButtons(true); }
public ViewPlugin GetViewPlugin(string pluginName, string configName) { ViewPlugin retVal = null; string labelKey = null; if (viewPluginHash.ContainsKey(pluginName)) { labelKey = viewPluginHash [pluginName]; } foreach (ViewPlugin vp in viewPluginList) { if (vp.Name == pluginName || vp.Name == labelKey) { retVal = vp; } } if (retVal != null && serverViewConfig.ContainsKey(configName)) { PluginConfigCollection pcc = serverViewConfig [configName]; if (pcc.Contains(pluginName)) { ViewPluginConfig vpc = pcc [pluginName]; if (vpc.Defaults == null) { vpc.Defaults = new Dictionary <string, string> (); } retVal.PluginConfiguration = vpc; } } return(retVal); }
void OnClassToggled(object o, ToggledArgs args) { TreeIter iter; if (pluginStore.GetIter(out iter, new TreePath(args.Path))) { bool old = (bool)pluginStore.GetValue(iter, 0); string name = (string)pluginStore.GetValue(iter, 1); ViewPlugin vp = Global.Plugins.GetViewPlugin(name, conn.Settings.Name); if (!conn.ServerViews.Contains(vp.GetType().ToString())) { conn.ServerViews.Add(vp.GetType().ToString()); } else { conn.ServerViews.Remove(vp.GetType().ToString()); } Global.Connections [conn.Settings.Name] = conn; pluginStore.SetValue(iter, 0, !old); } }
public void ConfigureView(ViewPlugin vp) { viewPlugin = vp; SetViewColumns(); }