add some buttons to edit configuration files in the Configuration category in UI

parent 1180d55a
......@@ -31,6 +31,12 @@ Overview of changes in v9.2 "Galvanize"
- Restore (from user backup configuration)
- delete Backup configuration
- Reset (reset from vendor or factory configuration) the configuration
- Edit various configuration files (uses xdg-open to open files), namely
- .bashrc
- .bashstyle.custom (bashrc-extension always loaded after BashStyle-NG,
thus can use BashStyle-NG variables and functions reliably)
- .vimrc.custom (vimrc extension that is not managed by BashStyle-NG)
- .inputrc.custom (inputrc extension that is not managed by BashStyle-NG)
.
also shows version of user, user backup, vendor and factory configuration
files (None for vendor and user backup if they don't exist)
......
......@@ -132,6 +132,8 @@ if [[ ! -e $HOME/.inputrc.bs-ng.* ]]; then
dbg_msg $"ReadlineCFG Setting:" $"Completion-Query-Items" $(ini_get query_items)
rc_add "set completion-query-items $(ini_get query_items)"
rc_add "\$include ${HOME}/.inputrc.custom"
mv ${RC_FILE} ${HOME}/.inputrc
bind -f ${HOME}/.inputrc
unset RC_FILE
......
......@@ -7737,6 +7737,100 @@ assuming /usr was the choosen install prefix. </property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="config.header2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Edit Configuration Files</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="config.edit_buttonbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">25</property>
<property name="homogeneous">True</property>
<property name="layout_style">center</property>
<child>
<object class="GtkButton" id="config.edit_bashrc">
<property name="label" translatable="yes">Edit ${HOME}/.bashrc</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="config.edit_bashstylecustom">
<property name="label" translatable="yes">Edit ${HOME}/.bashstyle.custom</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">8</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkButtonBox" id="config.edit_buttonbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">25</property>
<property name="layout_style">center</property>
<child>
<object class="GtkButton" id="config.edit_vimrccustom">
<property name="label" translatable="yes">Edit ${HOME}/.vimrc.custom</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="config.edit_inputrccustom">
<property name="label" translatable="yes">Edit ${HOME}/.inputrc.custom</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">9</property>
<property name="width">2</property>
</packing>
</child>
</object>
<packing>
<property name="position">14</property>
......
......@@ -129,6 +129,10 @@ class IconBook(object):
versionlabel_userbackup = gtkbuilder.get_object("config.label_userbackup.desc")
versionlabel_vendor = gtkbuilder.get_object("config.label_vendor.desc")
versionlabel_factory = gtkbuilder.get_object("config.label_factory.desc")
edit_bashrc = gtkbuilder.get_object("config.edit_bashrc")
edit_bashstylecustom = gtkbuilder.get_object("config.edit_bashstylecustom")
edit_vimrccustom = gtkbuilder.get_object("config.edit_vimrccustom")
edit_inputrccustom = gtkbuilder.get_object("config.edit_inputrccustom")
def backup_configAction(data):
config.BackupConfig()
......@@ -182,6 +186,14 @@ class IconBook(object):
versionlabel_vendor.set_text("%s" % config.VendorConfigVersion())
versionlabel_factory.set_text("%s" % config.FactoryConfigVersion())
def openFile(data, file):
subprocess.Popen(["xdg-open", "%s" %file])
edit_bashrc.connect("clicked", openFile, os.getenv('HOME') + "/.bashrc")
edit_bashstylecustom.connect("clicked", openFile, os.getenv('HOME') + "/.bashstyle.custom")
edit_vimrccustom.connect("clicked", openFile, os.getenv('HOME') + "/.vimrc.custom")
edit_inputrccustom.connect("clicked", openFile, os.getenv('HOME') + "/.inputrc.custom")
if config.CheckBashStyle() == False:
startup_enable = gtkbuilder.get_object("startup.enable")
startup_cancel = gtkbuilder.get_object("startup.cancel")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment