Merge branch 'release-1.1.2'

This commit is contained in:
Kolan Sh 2016-01-30 06:14:07 +03:00
commit 0e3639fdfd
8 changed files with 87 additions and 60 deletions

View File

@ -7,7 +7,7 @@ SET (PROJECT_DESCRIPTION "LAview Desktop Application.")
SET (MAJOR 1)
SET (MINOR 1)
SET (PATCH 1)
SET (PATCH 2)
LIST (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/backbone)

View File

@ -8,15 +8,16 @@ namespace LAview.Desktop {
public class AboutDialogWindow {
AboutDialog dialog;
public AboutDialogWindow (Window parent) throws Error {
public AboutDialogWindow (Gtk.Application application, Window parent) throws Error {
var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this);
dialog = builder.get_object ("aboutdialog_window") as AboutDialog;
dialog.set_destroy_with_parent (true);
dialog.set_transient_for (parent);
dialog.set_modal (true);
dialog.destroy_with_parent = true;
dialog.transient_for = parent;
dialog.modal = true;
dialog.application = application;
dialog.delete_event.connect ((source) => {return true;});
dialog.version = @" $(Config.VERSION_MAJOR).$(Config.VERSION_MINOR).$(Config.VERSION_PATCH)";

View File

@ -24,8 +24,5 @@ namespace LAview.Desktop {
if (File.new_for_path(w32dhack_sdir+"/gschemas.compiled").query_exists ())
settings_dir = w32dhack_sdir;
}
public static void terminate () {
}
}
}

View File

@ -7,7 +7,7 @@ namespace LAview.Desktop {
*/
public class MainWindow {
Window window;
ApplicationWindow window;
PreferencesDialog pref_dialog;
AboutDialogWindow about_dialog;
SubprocessDialog subprocess_dialog;
@ -17,12 +17,12 @@ namespace LAview.Desktop {
TreeView treeview_templates;
TreeView treeview_objects;
public MainWindow () throws Error {
public MainWindow (Gtk.Application application) throws Error {
var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this);
window = builder.get_object ("main_window") as Window;
window = builder.get_object ("main_window") as ApplicationWindow;
statusbar = builder.get_object ("statusbar") as Statusbar;
liststore_templates = builder.get_object ("liststore_templates") as Gtk.ListStore;
liststore_doc_objects = builder.get_object ("liststore_objects") as Gtk.ListStore;
@ -31,11 +31,17 @@ namespace LAview.Desktop {
window.title = "LAview Desktop"
+ @" $(Config.VERSION_MAJOR).$(Config.VERSION_MINOR).$(Config.VERSION_PATCH)";
pref_dialog = new PreferencesDialog (window);
subprocess_dialog = new SubprocessDialog (window);
about_dialog = new AboutDialogWindow (window);
pref_dialog = new PreferencesDialog (application, window);
subprocess_dialog = new SubprocessDialog (application, window);
about_dialog = new AboutDialogWindow (application, window);
fill_liststore_templates ();
application.app_menu = builder.get_object ("menubar") as MenuModel;
application.menubar = builder.get_object ("main_toolbar") as MenuModel;
window.application = application;
window.destroy.connect (() => { window.application.quit (); });
}
void fill_liststore_templates () {
@ -86,14 +92,13 @@ namespace LAview.Desktop {
_("_Cancel"), ResponseType.CANCEL,
_("_Open"), ResponseType.ACCEPT);
chooser.select_multiple = true;
FileFilter filter = new FileFilter ();
chooser.set_filter (filter);
filter.add_mime_type ("application/x-tex");
filter.add_mime_type ("application/x-latex");
filter.add_mime_type ("application/x-lyx");
filter.add_pattern ("*.tex");
filter.add_pattern ("*.latex");
filter.add_pattern ("*.lyx");
chooser.filter = new FileFilter ();
chooser.filter.add_mime_type ("application/x-tex");
chooser.filter.add_mime_type ("application/x-latex");
chooser.filter.add_mime_type ("application/x-lyx");
chooser.filter.add_pattern ("*.tex");
chooser.filter.add_pattern ("*.latex");
chooser.filter.add_pattern ("*.lyx");
if (chooser.run () == ResponseType.ACCEPT) {
var paths = chooser.get_filenames ();
@ -268,14 +273,13 @@ namespace LAview.Desktop {
_("_Cancel"), ResponseType.CANCEL,
_("_Save"), ResponseType.ACCEPT);
chooser.select_multiple = false;
FileFilter filter = new FileFilter ();
chooser.set_filter (filter);
filter.add_mime_type ("application/pdf");
filter.add_pattern ("*.pdf");
chooser.filter = new FileFilter ();
chooser.filter.add_mime_type ("application/pdf");
chooser.filter.add_pattern ("*.pdf");
// set folder
if (AppCore.settings.pdf_save_path != "")
chooser.set_current_folder(AppCore.settings.pdf_save_path);
chooser.set_current_folder (AppCore.settings.pdf_save_path);
// set current pdf file name or select an existance one
var template_name = AppCore.core.get_template_path_by_index (indices[0]);
@ -314,5 +318,10 @@ namespace LAview.Desktop {
chooser.close ();
}
[CCode (instance_pos = -1)]
public void action_quit_activate (Gtk.Action action) {
window.application.quit();
}
}
}

View File

@ -12,14 +12,15 @@ namespace LAview.Desktop {
FileChooserButton filechooserbutton_lyx;
FileChooserButton filechooserbutton_pdflatex;
public PreferencesDialog (Window parent) throws Error {
public PreferencesDialog (Gtk.Application application, Window parent) throws Error {
var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this);
dialog = builder.get_object ("preferences_window") as Dialog;
dialog.set_transient_for (parent);
dialog.set_modal (true);
dialog.transient_for = parent;
dialog.modal = true;
dialog.application = application;
dialog.delete_event.connect ((source) => {return true;});
liststore_data = builder.get_object ("liststore_data") as Gtk.ListStore;
liststore_protocols = builder.get_object ("liststore_protocols") as Gtk.ListStore;

View File

@ -13,14 +13,15 @@ namespace LAview.Desktop {
public delegate void PostProcessDelegate ();
public SubprocessDialog (Window parent) throws Error {
public SubprocessDialog (Gtk.Application application, Window parent) throws Error {
var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this);
dialog = builder.get_object ("subprocess_dialog") as Dialog;
dialog.set_transient_for (parent);
dialog.set_modal (true);
dialog.transient_for = parent;
dialog.modal = true;
dialog.application = application;
dialog.delete_event.connect ((source) => {return true;});
textview_stderrout = builder.get_object ("textview_stderrout") as TextView;
}

View File

@ -4,7 +4,7 @@ namespace LAview.Desktop {
using Gtk, LAview.Desktop;
namespace CommandlineOptions {
/*namespace CommandlineOptions {
// bool no_startup_progress = false;
// string data_dir = null;
bool show_version = false;
@ -38,34 +38,46 @@ namespace LAview.Desktop {
return entries;
}
}
}*/
void main (string[] args) {
try {
public class LAviewDesktopApp : Gtk.Application {
AppDirs.init (args);
AppCore.init (args);
Resources.init (args);
MainWindow main_window;
Gtk.init_with_args (ref args, _("[FILE]"), CommandlineOptions.get_options (), GETTEXT_PACKAGE);
// Internationalization
Intl.bindtextdomain (GETTEXT_PACKAGE, AppDirs.locale_dir);
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
var main_window = new MainWindow ();
main_window.show_all ();
Gtk.main ();
} catch (Error e) {
stderr.printf (_("Error: %s\n"), e.message);
stderr.printf (_("Run '%s --help' to see a full list of available command line options.\n"), args[0]);
public LAviewDesktopApp () {
Object(application_id: "ws.backbone.laview.desktop",
flags: ApplicationFlags.FLAGS_NONE);
}
AppDirs.terminate();
protected override void activate () {
try {
main_window = new MainWindow (this);
main_window.show_all ();
} catch (Error e) {
stderr.printf (_("Error: %s\n"), e.message);
}
}
return;
public static int main (string[] args) {
try {
AppDirs.init (args);
AppCore.init (args);
Resources.init (args);
//Gtk.init_with_args (ref args, _("[FILE]"), CommandlineOptions.get_options (), GETTEXT_PACKAGE);
// Internationalization
Intl.bindtextdomain (GETTEXT_PACKAGE, AppDirs.locale_dir);
Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
var app = new LAviewDesktopApp ();
return app.run (args);
} catch (Error e) {
stderr.printf (_("Error: %s\n"), e.message);
stderr.printf (_("Run '%s --help' to see a full list of available command line options.\n"), args[0]);
return e.code;
}
}
}
}

View File

@ -100,6 +100,12 @@
<signal name="activate" handler="laview_desktop_main_window_action_saveas_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkAction" id="action_quit">
<property name="always_show_image">True</property>
<signal name="activate" handler="laview_desktop_main_window_action_quit_activate" swapped="no"/>
</object>
</child>
</object>
<object class="GtkFileFilter" id="filefilter_open">
<patterns>
@ -382,14 +388,13 @@
<column type="gchararray"/>
</columns>
</object>
<object class="GtkWindow" id="main_window">
<object class="GtkApplicationWindow" id="main_window">
<property name="width_request">640</property>
<property name="height_request">480</property>
<property name="can_focus">False</property>
<property name="margin_top">3</property>
<property name="border_width">4</property>
<property name="title" translatable="yes">LAview Desktop</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child>
<object class="GtkBox" id="main_vbox">
<property name="visible">True</property>
@ -469,12 +474,12 @@
<object class="GtkImageMenuItem" id="menuitem_quit">
<property name="label">gtk-quit</property>
<property name="use_action_appearance">False</property>
<property name="related_action">action_quit</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="use_underline">True</property>
<property name="use_stock">True</property>
<property name="always_show_image">True</property>
<signal name="activate" handler="gtk_main_quit" swapped="no"/>
</object>
</child>
</object>
@ -807,12 +812,13 @@
</child>
<child>
<object class="GtkToolButton" id="toolbutton_quit">
<property name="use_action_appearance">False</property>
<property name="related_action">action_quit</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Close the application</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-quit</property>
<signal name="clicked" handler="gtk_main_quit" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>