/** * Read all the mods * /etc/apache2/mods-available/ * /etc/apache2/mods-enabled/ **/ public static ArrayList ReadMods() { ArrayList list = new ArrayList(); string[] mods_available = System.IO.Directory.GetFiles("/etc/apache2/mods-available/", "*.load"); string[] mods_config = System.IO.Directory.GetFiles("/etc/apache2/mods-available/", "*.conf"); string[] mods_enabled = System.IO.Directory.GetFiles("/etc/apache2/mods-enabled/", "*.load"); for (int i = 0; i < mods_available.Length; i++) { string tmpName = Utils.FileNameWithoutExt(mods_available[i]); bool tmpActive = false; for (int j = 0; j < mods_enabled.Length; j++) if (Utils.FileName(mods_available[i]) == Utils.FileName(mods_enabled[j])) tmpActive = true; System.IO.FileInfo tmpConfigFile = null; for (int k = 0; k < mods_config.Length; k++) if (Utils.FileNameWithoutExt(mods_available[i]) == Utils.FileNameWithoutExt(mods_config[k])) tmpConfigFile = new System.IO.FileInfo(mods_config[k]); ApacheMod apacheMod = new ApacheMod(tmpName, tmpActive, tmpConfigFile); list.Add(apacheMod); } return list; }
private void OnEditButtonClicked(object o, EventArgs args) { TreeIter iter; TreeModel model; if (treeView.Selection.GetSelected(out model, out iter)) { ApacheMod mod = (ApacheMod)model.GetValue(iter, 0); mod.edit(); } }
private void OnStatusButtonToggled(object o, EventArgs args) { TreeIter iter; TreeModel model; if (treeView.Selection.GetSelected(out model, out iter)) { ApacheMod mod = (ApacheMod)model.GetValue(iter, 0); mod.changeStatus(); } }
private void OnSelectionChanged(object o, EventArgs args) { TreeIter iter; TreeModel model; if (((TreeSelection)o).GetSelected(out model, out iter)) { ApacheMod mod = (ApacheMod)model.GetValue(iter, 0); statusButton.Sensitive = true; changeStatusButton(mod.active); editButton.Sensitive = mod.hasConfigFile(); } }
private void RenderModStatus(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { ApacheMod mod = (ApacheMod)model.GetValue(iter, 0); if (mod.active) { (cell as Gtk.CellRendererText).Foreground = "darkgreen"; (cell as CellRendererText).Text = "Active"; } else { (cell as Gtk.CellRendererText).Foreground = "red"; (cell as CellRendererText).Text = "Inactive"; } }
/** * Read all the mods * /etc/apache2/mods-available/ * /etc/apache2/mods-enabled/ **/ public static ArrayList ReadMods() { ArrayList list = new ArrayList(); string[] mods_available = System.IO.Directory.GetFiles("/etc/apache2/mods-available/", "*.load"); string[] mods_config = System.IO.Directory.GetFiles("/etc/apache2/mods-available/", "*.conf"); string[] mods_enabled = System.IO.Directory.GetFiles("/etc/apache2/mods-enabled/", "*.load"); for (int i = 0; i < mods_available.Length; i++) { string tmpName = Utils.FileNameWithoutExt(mods_available[i]); bool tmpActive = false; for (int j = 0; j < mods_enabled.Length; j++) { if (Utils.FileName(mods_available[i]) == Utils.FileName(mods_enabled[j])) { tmpActive = true; } } System.IO.FileInfo tmpConfigFile = null; for (int k = 0; k < mods_config.Length; k++) { if (Utils.FileNameWithoutExt(mods_available[i]) == Utils.FileNameWithoutExt(mods_config[k])) { tmpConfigFile = new System.IO.FileInfo(mods_config[k]); } } ApacheMod apacheMod = new ApacheMod(tmpName, tmpActive, tmpConfigFile); list.Add(apacheMod); } return(list); }
private void RenderModConfig(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { ApacheMod mod = (ApacheMod)model.GetValue(iter, 0); (cell as CellRendererText).Text = mod.getConfigFullPath(); }
private void RenderModName(TreeViewColumn column, CellRenderer cell, TreeModel model, TreeIter iter) { ApacheMod mod = (ApacheMod)model.GetValue(iter, 0); (cell as CellRendererText).Text = mod.name; }
private void initMods() { apacheModsList.setCollection(ApacheMod.ReadMods()); }