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
|
||||
* libvte-2.91-dev
|
||||
* libjson-glib-dev
|
||||
* libunity-dev
|
||||
* meson
|
||||
* valac
|
||||
* gpg
|
||||
|
|
|
@ -11,7 +11,6 @@ Build-Depends: cmake (>= 2.8),
|
|||
libvte-2.91-dev,
|
||||
libgranite-dev,
|
||||
libgee-0.8-dev,
|
||||
libunity-dev,
|
||||
gpg
|
||||
Standards-Version: 3.9.3
|
||||
|
||||
|
|
|
@ -26,11 +26,7 @@ dependencies = [
|
|||
dependency('gee-0.8'),
|
||||
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
|
||||
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 ('with-gpg', type : 'boolean', value : true)
|
|
@ -16,7 +16,7 @@ apps:
|
|||
easyssh:
|
||||
command: desktop-launch $SNAP/usr/bin/com.github.muriloventuroso.easyssh
|
||||
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 ]
|
||||
|
||||
plugs:
|
||||
|
@ -53,7 +53,6 @@ parts:
|
|||
- debhelper
|
||||
- libgtk-3-dev
|
||||
- libjson-glib-dev
|
||||
- libunity-dev
|
||||
stage-packages:
|
||||
- gobject-introspection
|
||||
- libgee-0.8-2
|
||||
|
|
|
@ -33,6 +33,7 @@ namespace EasySSH {
|
|||
public HeaderBar header;
|
||||
private bool is_fullscreen = false;
|
||||
public Gtk.Application application { get; construct; }
|
||||
public int64 count_badge = 0;
|
||||
|
||||
public const string ACTION_PREFIX = "win.";
|
||||
public const string ACTION_CLOSE_TAB = "action-close-tab";
|
||||
|
@ -375,6 +376,48 @@ namespace EasySSH {
|
|||
|
||||
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) {
|
||||
sourcelist.edit_conn(name);
|
||||
}
|
||||
|
|
|
@ -109,25 +109,16 @@ namespace EasySSH {
|
|||
}
|
||||
|
||||
public void add_badge (){
|
||||
#if UNITY_SUPPORT
|
||||
var entry = Unity.LauncherEntry.get_for_desktop_id ("com.github.muriloventuroso.easyssh.desktop");
|
||||
entry.count_visible = true;
|
||||
entry.count = entry.count + 1;
|
||||
#endif
|
||||
window.add_badge();
|
||||
unread_changes = true;
|
||||
dataHost.item.icon = new GLib.ThemedIcon ("mail-mark-important");
|
||||
tab.icon = new GLib.ThemedIcon ("mail-mark-important");
|
||||
}
|
||||
public void remove_badge (){
|
||||
#if UNITY_SUPPORT
|
||||
var entry = Unity.LauncherEntry.get_for_desktop_id ("com.github.muriloventuroso.easyssh.desktop");
|
||||
if(entry.count_visible == true){
|
||||
entry.count = entry.count - 1;
|
||||
if(entry.count == 0){
|
||||
entry.count_visible = false;
|
||||
if(unread_changes){
|
||||
window.remove_badge();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
unread_changes = false;
|
||||
dataHost.item.icon = null;
|
||||
tab.icon = null;
|
||||
|
|
Loading…
Reference in New Issue