Merge branch '#112_process_autoscroll' into develop

This commit is contained in:
Kolan Sh 2016-05-07 20:33:14 +03:00
commit 3cb9e5ce98
2 changed files with 17 additions and 4 deletions

View File

@ -7,6 +7,7 @@ namespace LAview.Desktop {
*/ */
public class SubprocessDialog { public class SubprocessDialog {
Dialog dialog; Dialog dialog;
ScrolledWindow scrolled_window;
TextView textview_stderrout; TextView textview_stderrout;
Subprocess sp; Subprocess sp;
unowned PostProcessDelegate ppdelegate; unowned PostProcessDelegate ppdelegate;
@ -24,14 +25,23 @@ namespace LAview.Desktop {
//dialog.application = application; //dialog.application = application;
dialog.delete_event.connect ((source) => {return true;}); dialog.delete_event.connect ((source) => {return true;});
textview_stderrout = builder.get_object ("textview_stderrout") as TextView; textview_stderrout = builder.get_object ("textview_stderrout") as TextView;
scrolled_window = builder.get_object ("subprocess_scroll") as ScrolledWindow;
}
void scroll_down () {
var vadjustment = scrolled_window.get_vadjustment ();
vadjustment.value = vadjustment.upper;
scrolled_window.set_vadjustment (vadjustment);
} }
async void subprocess_async () { async void subprocess_async () {
try { try {
var ds_out = new DataInputStream(sp.get_stdout_pipe()); var ds_out = new DataInputStream(sp.get_stdout_pipe());
try { try {
for (string s = yield ds_out.read_line_async(); s != null; s = yield ds_out.read_line_async()) for (string s = yield ds_out.read_line_async(); s != null; s = yield ds_out.read_line_async()) {
textview_stderrout.buffer.text += s + "\n"; textview_stderrout.buffer.text += s + "\n";
scroll_down ();
}
} catch (IOError err) { } catch (IOError err) {
assert_not_reached(); assert_not_reached();
} }
@ -41,11 +51,14 @@ namespace LAview.Desktop {
} catch (Error err) { } catch (Error err) {
textview_stderrout.buffer.text += _("Error: ")+err.message; textview_stderrout.buffer.text += _("Error: ")+err.message;
scroll_down ();
if (sp != null) { if (sp != null) {
var ds_err = new DataInputStream(sp.get_stderr_pipe()); var ds_err = new DataInputStream(sp.get_stderr_pipe());
try { try {
for (string s = yield ds_err.read_line_async(); s != null; s = yield ds_err.read_line_async()) for (string s = yield ds_err.read_line_async(); s != null; s = yield ds_err.read_line_async()) {
textview_stderrout.buffer.text += s + "\n"; textview_stderrout.buffer.text += s + "\n";
scroll_down ();
}
} catch (IOError err) { } catch (IOError err) {
assert_not_reached(); assert_not_reached();
} }

View File

@ -619,8 +619,8 @@
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="use_stock">True</property> <property name="use_stock">True</property>
<property name="always_show_image">True</property> <property name="always_show_image">True</property>
<accelerator key="h" signal="activate" modifiers="GDK_CONTROL_MASK"/>
<accelerator key="F1" signal="activate"/> <accelerator key="F1" signal="activate"/>
<accelerator key="h" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object> </object>
</child> </child>
<child> <child>
@ -1188,7 +1188,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkScrolledWindow" id="scrolledwindow3"> <object class="GtkScrolledWindow" id="subprocess_scroll">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="shadow_type">in</property> <property name="shadow_type">in</property>