diff --git a/src/Assistant.vala b/src/Assistant.vala index 8ada0ac..372b8d1 100644 --- a/src/Assistant.vala +++ b/src/Assistant.vala @@ -39,7 +39,6 @@ namespace Webpin { private Gtk.Entry app_name_entry; private Gtk.Entry app_url_entry; private Gtk.Entry icon_name_entry; - private Gtk.ComboBox app_category_combo; private Gtk.CheckButton save_cookies_check; private Gtk.CheckButton save_password_check; private Gtk.Popover icon_selector_popover; @@ -72,7 +71,7 @@ namespace Webpin { //welcome message message = new Gtk.Label (_("Create a new web app with webby")); - + message.get_style_context ().add_class ("h2"); //app information icon_button = new Gtk.Button (); icon_button.set_image (new Gtk.Image.from_icon_name (default_app_icon, Gtk.IconSize.DIALOG) ); @@ -257,12 +256,12 @@ namespace Webpin { } } - if (pix!=null){ + if (pix != null){ preview.set_from_pixbuf (pix); file_chooser.set_preview_widget_active (true); file_chooser.set_preview_widget (preview); } else { - file_chooser.set_preview_widget (null); + file_chooser.set_preview_widget_active (false); } }); diff --git a/src/DesktopFile.vala b/src/DesktopFile.vala index cc3c198..1565c4c 100644 --- a/src/DesktopFile.vala +++ b/src/DesktopFile.vala @@ -56,7 +56,11 @@ namespace Webpin { this.icon = icon; file = new GLib.KeyFile(); - file.load_from_data (template, -1, GLib.KeyFileFlags.NONE); + try { + file.load_from_data (template, -1, GLib.KeyFileFlags.NONE); + } catch (Error e) { + warning (e.message); + } //TODO: Category file.set_string ("Desktop Entry", "Name", name); file.set_string ("Desktop Entry", "GenericName", name); @@ -68,31 +72,53 @@ namespace Webpin { public DesktopFile.from_desktopappinfo(GLib.DesktopAppInfo info) { file = new GLib.KeyFile(); - file.load_from_file (info.filename, KeyFileFlags.NONE); + try { + file.load_from_file (info.filename, KeyFileFlags.NONE); + } catch (Error e) { + warning (e.message); + } this.name = info.get_display_name (); this.icon = info.get_icon ().to_string (); - this.url = file.get_string ("Desktop Entry", "Exec").substring (31); + try { + this.url = file.get_string ("Desktop Entry", "Exec").substring (31); + } catch (Error e) { + warning (e.message); + } } public bool edit_propertie (string propertie, string val) { - string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webpin.desktop"; - file = new GLib.KeyFile(); - file.load_from_file (filename, KeyFileFlags.NONE); - file.set_string ("Desktop Entry", propertie, val); - return file.save_to_file (filename); + bool return_value = false; + try { + string filename = GLib.Environment.get_user_data_dir () + "/applications/" + file.get_string("Desktop Entry", "Name") + "-webpin.desktop"; + file = new GLib.KeyFile(); + file.load_from_file (filename, KeyFileFlags.NONE); + file.set_string ("Desktop Entry", propertie, val); + return_value = file.save_to_file (filename); + } catch (Error e) { + warning (e.message); + } + + return return_value; } public GLib.DesktopAppInfo save_to_file () { - string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webpin.desktop"; - print("Desktop file created: " + filename); - file.save_to_file (filename); - return new GLib.DesktopAppInfo.from_filename (filename); + GLib.DesktopAppInfo return_value = null; + try { + string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webpin.desktop"; + print("Desktop file created: " + filename); + file.save_to_file (filename); + return_value = new GLib.DesktopAppInfo.from_filename (filename); + } catch (Error e) { + warning (e.message); + } + + return return_value; } public bool delete_file () { - string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webpin.desktop"; - File file = File.new_for_path (filename); - try { + try { + string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webpin.desktop"; + File file = File.new_for_path (filename); file.delete (); } catch (Error e) { print(e.message + "\n"); diff --git a/src/WebBar.vala b/src/WebBar.vala index f80d4a3..8eeebaf 100644 --- a/src/WebBar.vala +++ b/src/WebBar.vala @@ -50,11 +50,11 @@ namespace Webpin { url_entry.show_all(); share_button = new Gtk.Button.from_icon_name ("application-menu-symbolic", Gtk.IconSize.SMALL_TOOLBAR); - share_button.margin_left = 15; + share_button.margin_start = 15; share_button.show_all (); back_button = new Gtk.Button.from_icon_name ("go-next-symbolic-rtl", Gtk.IconSize.SMALL_TOOLBAR); - back_button.margin_right = 15; + back_button.margin_end = 15; back_button.show_all (); pack_start (back_button); diff --git a/src/Widgets/ApplicationIcon.vala b/src/Widgets/ApplicationIcon.vala index cd139eb..193e5aa 100644 --- a/src/Widgets/ApplicationIcon.vala +++ b/src/Widgets/ApplicationIcon.vala @@ -31,9 +31,7 @@ namespace Webpin { Gtk.Image image; Gtk.Label label; - Gtk.MenuButton conf_btn; Gtk.Box box; - Gtk.ActionGroup action_group; internal DesktopFile desktop_file { get; private set; } @@ -93,8 +91,12 @@ namespace Webpin { private void set_icon (string icon) { if (File.new_for_path (icon).query_exists ()) { - var pix = new Gdk.Pixbuf.from_file (icon); - + Gdk.Pixbuf pix = null; + try { + pix = new Gdk.Pixbuf.from_file (icon); + } catch (Error e) { + warning (e.message); + } int new_height = 64; int new_width = 64; int margin_vertical = 0;