Replace libunit with granite when displaying badges. Close #100
This commit is contained in:
parent
d43a52d760
commit
e2873cbddd
|
@ -40,7 +40,6 @@ If you want to hack on and build EasySSH yourself, you'll need the following dep
|
||||||
* libgranite-dev
|
* libgranite-dev
|
||||||
* libvte-2.91-dev
|
* libvte-2.91-dev
|
||||||
* libjson-glib-dev
|
* libjson-glib-dev
|
||||||
* libunity-dev
|
|
||||||
* meson
|
* meson
|
||||||
* valac
|
* valac
|
||||||
* gpg
|
* gpg
|
||||||
|
|
|
@ -11,7 +11,6 @@ Build-Depends: cmake (>= 2.8),
|
||||||
libvte-2.91-dev,
|
libvte-2.91-dev,
|
||||||
libgranite-dev,
|
libgranite-dev,
|
||||||
libgee-0.8-dev,
|
libgee-0.8-dev,
|
||||||
libunity-dev,
|
|
||||||
gpg
|
gpg
|
||||||
Standards-Version: 3.9.3
|
Standards-Version: 3.9.3
|
||||||
|
|
||||||
|
|
|
@ -26,11 +26,7 @@ dependencies = [
|
||||||
dependency('gee-0.8'),
|
dependency('gee-0.8'),
|
||||||
meson.get_compiler('c').find_library('m', required : false)
|
meson.get_compiler('c').find_library('m', required : false)
|
||||||
]
|
]
|
||||||
if get_option('libunity')
|
|
||||||
unity_dep = dependency('unity')
|
|
||||||
add_project_arguments('--define=UNITY_SUPPORT=1', language : 'vala')
|
|
||||||
dependencies += unity_dep
|
|
||||||
endif
|
|
||||||
|
|
||||||
if with_gpg
|
if with_gpg
|
||||||
gpg = find_program('gpg', 'gpg2', required: true)
|
gpg = find_program('gpg', 'gpg2', required: true)
|
||||||
|
|
|
@ -1,3 +1,2 @@
|
||||||
option ('libunity', type : 'boolean', value : true)
|
|
||||||
option ('ubuntu-bionic-patched-vte', type : 'boolean', value : true)
|
option ('ubuntu-bionic-patched-vte', type : 'boolean', value : true)
|
||||||
option ('with-gpg', type : 'boolean', value : true)
|
option ('with-gpg', type : 'boolean', value : true)
|
|
@ -16,7 +16,7 @@ apps:
|
||||||
easyssh:
|
easyssh:
|
||||||
command: desktop-launch $SNAP/usr/bin/com.github.muriloventuroso.easyssh
|
command: desktop-launch $SNAP/usr/bin/com.github.muriloventuroso.easyssh
|
||||||
desktop: usr/share/applications/com.github.muriloventuroso.easyssh.desktop
|
desktop: usr/share/applications/com.github.muriloventuroso.easyssh.desktop
|
||||||
plugs: [network, home, x11, unity7, gsettings, locale-control]
|
plugs: [network, home, x11, gsettings, locale-control]
|
||||||
slots: [ dbus-easyssh ]
|
slots: [ dbus-easyssh ]
|
||||||
|
|
||||||
plugs:
|
plugs:
|
||||||
|
@ -53,7 +53,6 @@ parts:
|
||||||
- debhelper
|
- debhelper
|
||||||
- libgtk-3-dev
|
- libgtk-3-dev
|
||||||
- libjson-glib-dev
|
- libjson-glib-dev
|
||||||
- libunity-dev
|
|
||||||
stage-packages:
|
stage-packages:
|
||||||
- gobject-introspection
|
- gobject-introspection
|
||||||
- libgee-0.8-2
|
- libgee-0.8-2
|
||||||
|
|
|
@ -33,6 +33,7 @@ namespace EasySSH {
|
||||||
public HeaderBar header;
|
public HeaderBar header;
|
||||||
private bool is_fullscreen = false;
|
private bool is_fullscreen = false;
|
||||||
public Gtk.Application application { get; construct; }
|
public Gtk.Application application { get; construct; }
|
||||||
|
public int64 count_badge = 0;
|
||||||
|
|
||||||
public const string ACTION_PREFIX = "win.";
|
public const string ACTION_PREFIX = "win.";
|
||||||
public const string ACTION_CLOSE_TAB = "action-close-tab";
|
public const string ACTION_CLOSE_TAB = "action-close-tab";
|
||||||
|
@ -375,6 +376,48 @@ namespace EasySSH {
|
||||||
|
|
||||||
main_actions.get_action ("Paste").set_sensitive (can_paste);
|
main_actions.get_action ("Paste").set_sensitive (can_paste);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void add_badge(){
|
||||||
|
count_badge += 1;
|
||||||
|
Granite.Services.Application.set_badge_visible.begin (true, (obj, res) => {
|
||||||
|
try {
|
||||||
|
Granite.Services.Application.set_badge_visible.end (res);
|
||||||
|
} catch (GLib.Error e) {
|
||||||
|
critical (e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Granite.Services.Application.set_badge.begin (count_badge, (obj, res) => {
|
||||||
|
try {
|
||||||
|
Granite.Services.Application.set_badge.end (res);
|
||||||
|
} catch (GLib.Error e) {
|
||||||
|
critical (e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
public void remove_badge(){
|
||||||
|
if(count_badge <= 0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
count_badge -= 1;
|
||||||
|
Granite.Services.Application.set_badge.begin (count_badge, (obj, res) => {
|
||||||
|
try {
|
||||||
|
Granite.Services.Application.set_badge.end (res);
|
||||||
|
} catch (GLib.Error e) {
|
||||||
|
critical (e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if(count_badge == 0){
|
||||||
|
Granite.Services.Application.set_badge_visible.begin (false, (obj, res) => {
|
||||||
|
try {
|
||||||
|
Granite.Services.Application.set_badge_visible.end (res);
|
||||||
|
} catch (GLib.Error e) {
|
||||||
|
critical (e.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
public void action_edit_conn (string name) {
|
public void action_edit_conn (string name) {
|
||||||
sourcelist.edit_conn(name);
|
sourcelist.edit_conn(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,25 +109,16 @@ namespace EasySSH {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void add_badge (){
|
public void add_badge (){
|
||||||
#if UNITY_SUPPORT
|
window.add_badge();
|
||||||
var entry = Unity.LauncherEntry.get_for_desktop_id ("com.github.muriloventuroso.easyssh.desktop");
|
|
||||||
entry.count_visible = true;
|
|
||||||
entry.count = entry.count + 1;
|
|
||||||
#endif
|
|
||||||
unread_changes = true;
|
unread_changes = true;
|
||||||
dataHost.item.icon = new GLib.ThemedIcon ("mail-mark-important");
|
dataHost.item.icon = new GLib.ThemedIcon ("mail-mark-important");
|
||||||
tab.icon = new GLib.ThemedIcon ("mail-mark-important");
|
tab.icon = new GLib.ThemedIcon ("mail-mark-important");
|
||||||
}
|
}
|
||||||
public void remove_badge (){
|
public void remove_badge (){
|
||||||
#if UNITY_SUPPORT
|
if(unread_changes){
|
||||||
var entry = Unity.LauncherEntry.get_for_desktop_id ("com.github.muriloventuroso.easyssh.desktop");
|
window.remove_badge();
|
||||||
if(entry.count_visible == true){
|
|
||||||
entry.count = entry.count - 1;
|
|
||||||
if(entry.count == 0){
|
|
||||||
entry.count_visible = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
unread_changes = false;
|
unread_changes = false;
|
||||||
dataHost.item.icon = null;
|
dataHost.item.icon = null;
|
||||||
tab.icon = null;
|
tab.icon = null;
|
||||||
|
|
Loading…
Reference in New Issue