Merge branch '#100_app_class_id' into develop

This commit is contained in:
Kolan Sh 2016-01-30 05:52:14 +03:00
commit e8578fb018
6 changed files with 73 additions and 42 deletions

View File

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

View File

@ -7,7 +7,7 @@ namespace LAview.Desktop {
*/ */
public class MainWindow { public class MainWindow {
Window window; ApplicationWindow window;
PreferencesDialog pref_dialog; PreferencesDialog pref_dialog;
AboutDialogWindow about_dialog; AboutDialogWindow about_dialog;
SubprocessDialog subprocess_dialog; SubprocessDialog subprocess_dialog;
@ -17,12 +17,12 @@ namespace LAview.Desktop {
TreeView treeview_templates; TreeView treeview_templates;
TreeView treeview_objects; TreeView treeview_objects;
public MainWindow () throws Error { public MainWindow (Gtk.Application application) throws Error {
var builder = new Builder (); var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade"); builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this); 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; statusbar = builder.get_object ("statusbar") as Statusbar;
liststore_templates = builder.get_object ("liststore_templates") as Gtk.ListStore; liststore_templates = builder.get_object ("liststore_templates") as Gtk.ListStore;
liststore_doc_objects = builder.get_object ("liststore_objects") as Gtk.ListStore; liststore_doc_objects = builder.get_object ("liststore_objects") as Gtk.ListStore;
@ -31,11 +31,15 @@ namespace LAview.Desktop {
window.title = "LAview Desktop" window.title = "LAview Desktop"
+ @" $(Config.VERSION_MAJOR).$(Config.VERSION_MINOR).$(Config.VERSION_PATCH)"; + @" $(Config.VERSION_MAJOR).$(Config.VERSION_MINOR).$(Config.VERSION_PATCH)";
pref_dialog = new PreferencesDialog (window); pref_dialog = new PreferencesDialog (application, window);
subprocess_dialog = new SubprocessDialog (window); subprocess_dialog = new SubprocessDialog (application, window);
about_dialog = new AboutDialogWindow (window); about_dialog = new AboutDialogWindow (application, window);
fill_liststore_templates (); fill_liststore_templates ();
application.app_menu = builder.get_object ("menubar") as MenuModel;
application.menubar = builder.get_object ("main_toolbar") as MenuModel;
window.application = application;
} }
void fill_liststore_templates () { void fill_liststore_templates () {
@ -314,5 +318,10 @@ namespace LAview.Desktop {
chooser.close (); 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_lyx;
FileChooserButton filechooserbutton_pdflatex; FileChooserButton filechooserbutton_pdflatex;
public PreferencesDialog (Window parent) throws Error { public PreferencesDialog (Gtk.Application application, Window parent) throws Error {
var builder = new Builder (); var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade"); builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this); builder.connect_signals (this);
dialog = builder.get_object ("preferences_window") as Dialog; dialog = builder.get_object ("preferences_window") as Dialog;
dialog.set_transient_for (parent); dialog.transient_for = parent;
dialog.set_modal (true); dialog.modal = true;
dialog.application = application;
dialog.delete_event.connect ((source) => {return true;}); dialog.delete_event.connect ((source) => {return true;});
liststore_data = builder.get_object ("liststore_data") as Gtk.ListStore; liststore_data = builder.get_object ("liststore_data") as Gtk.ListStore;
liststore_protocols = builder.get_object ("liststore_protocols") 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 delegate void PostProcessDelegate ();
public SubprocessDialog (Window parent) throws Error { public SubprocessDialog (Gtk.Application application, Window parent) throws Error {
var builder = new Builder (); var builder = new Builder ();
builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade"); builder.add_from_file (AppDirs.ui_dir + "/laview-desktop.glade");
builder.connect_signals (this); builder.connect_signals (this);
dialog = builder.get_object ("subprocess_dialog") as Dialog; dialog = builder.get_object ("subprocess_dialog") as Dialog;
dialog.set_transient_for (parent); dialog.transient_for = parent;
dialog.set_modal (true); dialog.modal = true;
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;
} }

View File

@ -4,7 +4,7 @@ namespace LAview.Desktop {
using Gtk, LAview.Desktop; using Gtk, LAview.Desktop;
namespace CommandlineOptions { /*namespace CommandlineOptions {
// bool no_startup_progress = false; // bool no_startup_progress = false;
// string data_dir = null; // string data_dir = null;
bool show_version = false; bool show_version = false;
@ -38,34 +38,46 @@ namespace LAview.Desktop {
return entries; return entries;
} }
} }*/
void main (string[] args) {
try { public class LAviewDesktopApp : Gtk.Application {
AppDirs.init (args); MainWindow main_window;
AppCore.init (args);
Resources.init (args);
Gtk.init_with_args (ref args, _("[FILE]"), CommandlineOptions.get_options (), GETTEXT_PACKAGE); public LAviewDesktopApp () {
Object(application_id: "ws.backbone.laview.desktop",
// Internationalization flags: ApplicationFlags.FLAGS_NONE);
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]);
} }
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"/> <signal name="activate" handler="laview_desktop_main_window_action_saveas_activate" swapped="no"/>
</object> </object>
</child> </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>
<object class="GtkFileFilter" id="filefilter_open"> <object class="GtkFileFilter" id="filefilter_open">
<patterns> <patterns>
@ -382,7 +388,7 @@
<column type="gchararray"/> <column type="gchararray"/>
</columns> </columns>
</object> </object>
<object class="GtkWindow" id="main_window"> <object class="GtkApplicationWindow" id="main_window">
<property name="width_request">640</property> <property name="width_request">640</property>
<property name="height_request">480</property> <property name="height_request">480</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
@ -469,12 +475,12 @@
<object class="GtkImageMenuItem" id="menuitem_quit"> <object class="GtkImageMenuItem" id="menuitem_quit">
<property name="label">gtk-quit</property> <property name="label">gtk-quit</property>
<property name="use_action_appearance">False</property> <property name="use_action_appearance">False</property>
<property name="related_action">action_quit</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<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>
<signal name="activate" handler="gtk_main_quit" swapped="no"/>
</object> </object>
</child> </child>
</object> </object>
@ -807,12 +813,13 @@
</child> </child>
<child> <child>
<object class="GtkToolButton" id="toolbutton_quit"> <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="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Close the application</property> <property name="tooltip_text" translatable="yes">Close the application</property>
<property name="use_underline">True</property> <property name="use_underline">True</property>
<property name="stock_id">gtk-quit</property> <property name="stock_id">gtk-quit</property>
<signal name="clicked" handler="gtk_main_quit" swapped="no"/>
</object> </object>
<packing> <packing>
<property name="expand">False</property> <property name="expand">False</property>