rename appname
This commit is contained in:
parent
11cab4496c
commit
8b6b2fb94b
3 changed files with 310 additions and 281 deletions
|
@ -1,3 +1,32 @@
|
|||
/*-
|
||||
* Copyright (c) 2015 Erasmo Marín <erasmo.marin@gmail.com>
|
||||
* Copyright (c) 2017-2017 Artem Anufrij <artem.anufrij@live.de>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* The Noise authors hereby grant permission for non-GPL compatible
|
||||
* GStreamer plugins to be used and distributed together with GStreamer
|
||||
* and Noise. This permission is above and beyond the permissions granted
|
||||
* by the GPL license by which Noise is covered. If you modify this code
|
||||
* you may extend this exception to your version of the code, but you are not
|
||||
* obligated to do so. If you do not wish to do so, delete this exception
|
||||
* statement from your version.
|
||||
*
|
||||
* Authored by: Artem Anufrij <artem.anufrij@live.de>
|
||||
*/
|
||||
|
||||
namespace Webpin {
|
||||
public class WebbyAssistant : Gtk.Box {
|
||||
|
||||
public enum assistant_mode { new_app, edit_app }
|
||||
|
@ -297,3 +326,4 @@ public class WebbyAssistant : Gtk.Box {
|
|||
update_app_icon ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,17 +3,16 @@ public class DesktopFile : GLib.Object {
|
|||
private string template = """
|
||||
[Desktop Entry]
|
||||
Version=1.0
|
||||
Name=Webby
|
||||
Name=Webpin
|
||||
GenericName=Web app
|
||||
Comment=Webby web app
|
||||
Exec=webby
|
||||
Keywords=webby;webapp;internet;
|
||||
Comment=Webpin web app
|
||||
Exec=com.github.artemanufrij.webpin
|
||||
Keywords=webpin;webapp;internet;
|
||||
Icon=application-default-icon
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Network;
|
||||
X-GNOME-FullName=Webby
|
||||
StartupWMClass=Webby
|
||||
X-GNOME-FullName=webpin
|
||||
WebbyThemeColor=none""";
|
||||
|
||||
|
||||
|
@ -34,7 +33,7 @@ public class DesktopFile : GLib.Object {
|
|||
file.set_string ("Desktop Entry", "Name", name);
|
||||
file.set_string ("Desktop Entry", "GenericName", name);
|
||||
file.set_string ("Desktop Entry", "X-GNOME-FullName", name);
|
||||
file.set_string ("Desktop Entry", "Exec", "webby " + url);
|
||||
file.set_string ("Desktop Entry", "Exec", "com.github.artemanufrij.webpin " + url);
|
||||
file.set_string ("Desktop Entry", "Icon", icon);
|
||||
file.set_string ("Desktop Entry", "StartupWMClass", url);
|
||||
}
|
||||
|
@ -44,11 +43,11 @@ public class DesktopFile : GLib.Object {
|
|||
file.load_from_file (info.filename, KeyFileFlags.NONE);
|
||||
this.name = info.get_display_name ();
|
||||
this.icon = info.get_icon ().to_string ();
|
||||
this.url = file.get_string ("Desktop Entry", "Exec").substring (6);
|
||||
this.url = file.get_string ("Desktop Entry", "Exec").substring (31);
|
||||
}
|
||||
|
||||
public bool edit_propertie (string propertie, string val) {
|
||||
string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webby.desktop";
|
||||
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);
|
||||
|
@ -56,14 +55,14 @@ public class DesktopFile : GLib.Object {
|
|||
}
|
||||
|
||||
public GLib.DesktopAppInfo save_to_file () {
|
||||
string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webby.desktop";
|
||||
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);
|
||||
}
|
||||
|
||||
public bool delete_file () {
|
||||
string filename = GLib.Environment.get_user_data_dir () + "/applications/" +file.get_string("Desktop Entry", "Name") + "-webby.desktop";
|
||||
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 {
|
||||
file.delete ();
|
||||
|
@ -87,7 +86,7 @@ public class DesktopFile : GLib.Object {
|
|||
|
||||
string keywords = desktop_app.get_string ("Keywords");
|
||||
|
||||
if (keywords != null && keywords.contains ("webby")) {
|
||||
if (keywords != null && keywords.contains ("webpin")) {
|
||||
list.set(desktop_app.get_name(), desktop_app);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,8 +77,8 @@ public class WebApp : Gtk.Stack {
|
|||
info = DesktopFile.get_app_by_url(app_url);
|
||||
file = new DesktopFile.from_desktopappinfo(info);
|
||||
//load theme color saved in desktop file
|
||||
if (info != null && info.has_key("WebbyThemeColor")) {
|
||||
var color = info.get_string("WebbyThemeColor");
|
||||
if (info != null && info.has_key("WebpinThemeColor")) {
|
||||
var color = info.get_string("WebpinThemeColor");
|
||||
print("COLOR: " + color+"\n");
|
||||
if(color != "none") {
|
||||
ui_color = color;
|
||||
|
@ -145,7 +145,7 @@ public class WebApp : Gtk.Stack {
|
|||
container.override_background_color (Gtk.StateFlags.NORMAL, background);
|
||||
theme_color_changed(ui_color);
|
||||
if (file != null)
|
||||
file.edit_propertie ("WebbyThemeColor", ui_color);
|
||||
file.edit_propertie ("WebpinThemeColor", ui_color);
|
||||
}
|
||||
container.set_visible(false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue