Merge branch '2_plugin_prefs' into develop
This commit is contained in:
commit
bc9e14799f
|
@ -12,6 +12,8 @@ namespace LAview.Desktop {
|
||||||
FileChooserButton filechooserbutton_lyx;
|
FileChooserButton filechooserbutton_lyx;
|
||||||
FileChooserButton filechooserbutton_latexmk;
|
FileChooserButton filechooserbutton_latexmk;
|
||||||
FileChooserButton filechooserbutton_perl;
|
FileChooserButton filechooserbutton_perl;
|
||||||
|
TreeView treeview_data;
|
||||||
|
TreeView treeview_protocol_objects;
|
||||||
|
|
||||||
public PreferencesDialog (Gtk.Application application, Window parent) throws Error {
|
public PreferencesDialog (Gtk.Application application, Window parent) throws Error {
|
||||||
var builder = new Builder ();
|
var builder = new Builder ();
|
||||||
|
@ -28,6 +30,8 @@ namespace LAview.Desktop {
|
||||||
filechooserbutton_lyx = builder.get_object ("filechooserbutton_lyx") as FileChooserButton;
|
filechooserbutton_lyx = builder.get_object ("filechooserbutton_lyx") as FileChooserButton;
|
||||||
filechooserbutton_latexmk = builder.get_object ("filechooserbutton_latexmk") as FileChooserButton;
|
filechooserbutton_latexmk = builder.get_object ("filechooserbutton_latexmk") as FileChooserButton;
|
||||||
filechooserbutton_perl = builder.get_object ("filechooserbutton_perl") as FileChooserButton;
|
filechooserbutton_perl = builder.get_object ("filechooserbutton_perl") as FileChooserButton;
|
||||||
|
treeview_data = builder.get_object ("treeview_data") as TreeView;
|
||||||
|
treeview_protocol_objects = builder.get_object ("treeview_protocol_objects") as TreeView;
|
||||||
|
|
||||||
fill_liststore_data ();
|
fill_liststore_data ();
|
||||||
fill_liststore_objects ();
|
fill_liststore_objects ();
|
||||||
|
@ -79,6 +83,70 @@ namespace LAview.Desktop {
|
||||||
AppCore.core.perl_path = chooser.get_filename ();
|
AppCore.core.perl_path = chooser.get_filename ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int[] get_data_indices () {
|
||||||
|
var selection = treeview_data.get_selection ();
|
||||||
|
var selected_rows = selection.get_selected_rows (null);
|
||||||
|
int[] indices = {};
|
||||||
|
foreach (var r in selected_rows) {
|
||||||
|
indices += r.get_indices()[0];
|
||||||
|
}
|
||||||
|
return indices;
|
||||||
|
}
|
||||||
|
|
||||||
|
int[] get_objects_indices () {
|
||||||
|
var selection = treeview_protocol_objects.get_selection ();
|
||||||
|
var selected_rows = selection.get_selected_rows (null);
|
||||||
|
int[] indices = {};
|
||||||
|
foreach (var r in selected_rows) {
|
||||||
|
indices += r.get_indices()[0];
|
||||||
|
}
|
||||||
|
return indices;
|
||||||
|
}
|
||||||
|
|
||||||
|
void call_data_preferences () {
|
||||||
|
var indices = get_data_indices ();
|
||||||
|
for (int i = indices.length; i > 0;)
|
||||||
|
foreach (var p in AppCore.core.data_plugins.entries)
|
||||||
|
if (indices[--i] == 0) {
|
||||||
|
p.value.preferences();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void call_object_preferences () {
|
||||||
|
var indices = get_objects_indices ();
|
||||||
|
for (int i = indices.length; i > 0;)
|
||||||
|
foreach (var p in AppCore.core.object_plugins.entries)
|
||||||
|
if (indices[--i] == 0) {
|
||||||
|
p.value.preferences();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[CCode (instance_pos = -1)]
|
||||||
|
public void button_data_preferences_clicked (Button button) {
|
||||||
|
call_data_preferences();
|
||||||
|
}
|
||||||
|
|
||||||
|
[CCode (instance_pos = -1)]
|
||||||
|
public void button_object_preferences_clicked (Button button) {
|
||||||
|
call_object_preferences();
|
||||||
|
}
|
||||||
|
|
||||||
|
[CCode (instance_pos = -1)]
|
||||||
|
public void data_row_activated (Gtk.TreeView treeview,
|
||||||
|
Gtk.TreePath path,
|
||||||
|
Gtk.TreeViewColumn column) {
|
||||||
|
call_data_preferences();
|
||||||
|
}
|
||||||
|
|
||||||
|
[CCode (instance_pos = -1)]
|
||||||
|
public void objects_row_activated (Gtk.TreeView treeview,
|
||||||
|
Gtk.TreePath path,
|
||||||
|
Gtk.TreeViewColumn column) {
|
||||||
|
call_object_preferences();
|
||||||
|
}
|
||||||
|
|
||||||
[CCode (instance_pos = -1)]
|
[CCode (instance_pos = -1)]
|
||||||
public void button_search_clicked (Button button) {
|
public void button_search_clicked (Button button) {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!-- Generated with glade 3.20.0 -->
|
<!-- Generated with glade 3.20.4 -->
|
||||||
<interface domain="laview-desktop-@MAJOR@">
|
<interface domain="laview-desktop-@MAJOR@">
|
||||||
<requires lib="gtk+" version="3.16"/>
|
<requires lib="gtk+" version="3.16"/>
|
||||||
<object class="GtkAboutDialog" id="aboutdialog_window">
|
<object class="GtkAboutDialog" id="aboutdialog_window">
|
||||||
|
@ -37,6 +37,9 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkFileFilter" id="filefilter_open">
|
<object class="GtkFileFilter" id="filefilter_open">
|
||||||
<patterns>
|
<patterns>
|
||||||
|
@ -300,60 +303,6 @@
|
||||||
<property name="tab_fill">False</property>
|
<property name="tab_fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkBox" id="box2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="shadow_type">in</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkTreeView" id="treeview_protocol_objects">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">True</property>
|
|
||||||
<property name="model">liststore_protocol_objects</property>
|
|
||||||
<child internal-child="selection">
|
|
||||||
<object class="GtkTreeSelection" id="treeview-selection5"/>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
|
|
||||||
<property name="title" translatable="yes">Object plugins</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCellRendererText" id="cellrenderertext2"/>
|
|
||||||
<attributes>
|
|
||||||
<attribute name="text">0</attribute>
|
|
||||||
</attributes>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="expand">True</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child type="tab">
|
|
||||||
<object class="GtkLabel" id="label2">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can_focus">False</property>
|
|
||||||
<property name="label" translatable="yes">Object plugins</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="position">1</property>
|
|
||||||
<property name="tab_fill">False</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkBox" id="box3">
|
<object class="GtkBox" id="box3">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -369,6 +318,7 @@
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">True</property>
|
<property name="can_focus">True</property>
|
||||||
<property name="model">liststore_data</property>
|
<property name="model">liststore_data</property>
|
||||||
|
<signal name="row-activated" handler="laview_desktop_preferences_dialog_data_row_activated" swapped="no"/>
|
||||||
<child internal-child="selection">
|
<child internal-child="selection">
|
||||||
<object class="GtkTreeSelection" id="treeview-selection6"/>
|
<object class="GtkTreeSelection" id="treeview-selection6"/>
|
||||||
</child>
|
</child>
|
||||||
|
@ -392,6 +342,21 @@
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button_data_preferences">
|
||||||
|
<property name="label">gtk-preferences</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<signal name="clicked" handler="laview_desktop_preferences_dialog_button_data_preferences_clicked" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">2</property>
|
<property name="position">2</property>
|
||||||
|
@ -408,6 +373,76 @@
|
||||||
<property name="tab_fill">False</property>
|
<property name="tab_fill">False</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkBox" id="box2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="orientation">vertical</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkScrolledWindow" id="scrolledwindow1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="shadow_type">in</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeView" id="treeview_protocol_objects">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="model">liststore_protocol_objects</property>
|
||||||
|
<signal name="row-activated" handler="laview_desktop_preferences_dialog_objects_row_activated" swapped="no"/>
|
||||||
|
<child internal-child="selection">
|
||||||
|
<object class="GtkTreeSelection" id="treeview-selection5"/>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkTreeViewColumn" id="treeviewcolumn3">
|
||||||
|
<property name="title" translatable="yes">Object plugins</property>
|
||||||
|
<child>
|
||||||
|
<object class="GtkCellRendererText" id="cellrenderertext2"/>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="text">0</attribute>
|
||||||
|
</attributes>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">True</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">0</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton" id="button_object_preferences">
|
||||||
|
<property name="label">gtk-preferences</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">True</property>
|
||||||
|
<property name="receives_default">True</property>
|
||||||
|
<property name="use_stock">True</property>
|
||||||
|
<signal name="clicked" handler="laview_desktop_preferences_dialog_button_object_preferences_clicked" swapped="no"/>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
<property name="position">1</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
<child type="tab">
|
||||||
|
<object class="GtkLabel" id="label2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="can_focus">False</property>
|
||||||
|
<property name="label" translatable="yes">Object plugins</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="position">2</property>
|
||||||
|
<property name="tab_fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
@ -417,6 +452,9 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkListStore" id="liststore_templates">
|
<object class="GtkListStore" id="liststore_templates">
|
||||||
<columns>
|
<columns>
|
||||||
|
@ -1146,6 +1184,9 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child type="titlebar">
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkDialog" id="subprocess_dialog">
|
<object class="GtkDialog" id="subprocess_dialog">
|
||||||
<property name="width_request">640</property>
|
<property name="width_request">640</property>
|
||||||
|
@ -1207,5 +1248,8 @@
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<placeholder/>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
Loading…
Reference in New Issue