forked from cromer/pamac-classic
change config to gsettings
This commit is contained in:
@@ -7,13 +7,13 @@ set (GETTEXT_PACKAGE "pamac-classic")
|
||||
set (RELEASE_NAME "pamac-classic")
|
||||
set (CMAKE_C_FLAGS "")
|
||||
set (PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
set (VERSION "6.5.2")
|
||||
set (VERSION "6.6.0")
|
||||
set (TESTSRCDIR "${CMAKE_SOURCE_DIR}")
|
||||
set (DOLLAR "$")
|
||||
|
||||
configure_file (${CMAKE_SOURCE_DIR}/src/pamac-tray/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-tray/Config.vala)
|
||||
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
|
||||
set (VERSION "6.5.2")
|
||||
set (VERSION "6.6.0")
|
||||
add_definitions (${DEPS_CFLAGS})
|
||||
include_directories ( ${CMAKE_BINARY_DIR}/src )
|
||||
link_libraries ( ${DEPS_LIBRARIES} -lpamacclassic )
|
||||
|
@@ -4,7 +4,7 @@ cfg_pamac_tray.set('PKGDATADIR', join_paths(get_option('prefix'),get_option('dat
|
||||
cfg_pamac_tray.set('GETTEXT_PACKAGE', 'pamac-classic')
|
||||
cfg_pamac_tray.set('RELEASE_NAME', 'pamac-classic')
|
||||
cfg_pamac_tray.set('PREFIX', get_option('prefix'))
|
||||
cfg_pamac_tray.set('VERSION', '6.5.2')
|
||||
cfg_pamac_tray.set('VERSION', '6.6.0')
|
||||
cfg_pamac_tray.set('TESTSRCDIR', meson.source_root())
|
||||
|
||||
cfgfile_3 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_tray)
|
||||
|
@@ -48,6 +48,14 @@ namespace Pamac {
|
||||
return indicator_status_icon.get_icon ();
|
||||
}
|
||||
|
||||
public override bool get_icon_visible () {
|
||||
if (indicator_status_icon.get_status () == AppIndicator.IndicatorStatus.ACTIVE) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public override void set_icon_visible (bool visible) {
|
||||
if (visible) {
|
||||
indicator_status_icon.set_status (AppIndicator.IndicatorStatus.ACTIVE);
|
||||
|
@@ -47,6 +47,10 @@ namespace Pamac {
|
||||
return status_icon.get_icon_name ();
|
||||
}
|
||||
|
||||
public override bool get_icon_visible () {
|
||||
return status_icon.visible;
|
||||
}
|
||||
|
||||
public override void set_icon_visible (bool visible) {
|
||||
if (visible) {
|
||||
status_icon.visible = true;
|
||||
|
@@ -45,8 +45,10 @@ namespace Pamac {
|
||||
UserDaemon daemon;
|
||||
bool extern_lock;
|
||||
uint refresh_timeout_id;
|
||||
uint icon_timeout_id;
|
||||
public Gtk.Menu menu;
|
||||
GLib.File lockfile;
|
||||
bool updates_available;
|
||||
|
||||
public TrayIcon () {
|
||||
application_id = "org.pamac.tray";
|
||||
@@ -116,10 +118,12 @@ namespace Pamac {
|
||||
|
||||
public abstract string get_icon ();
|
||||
|
||||
public abstract bool get_icon_visible ();
|
||||
|
||||
public abstract void set_icon_visible (bool visible);
|
||||
|
||||
bool check_updates () {
|
||||
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||
var pamac_config = new Pamac.Config ();
|
||||
if (pamac_config.refresh_period != 0) {
|
||||
try {
|
||||
#if DISABLE_AUR
|
||||
@@ -141,12 +145,14 @@ namespace Pamac {
|
||||
uint updates_nb = updates.repos_updates.length + updates.aur_updates.length;
|
||||
#endif
|
||||
if (updates_nb == 0) {
|
||||
updates_available = false;
|
||||
set_icon (noupdate_icon_name);
|
||||
set_tooltip (noupdate_info);
|
||||
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||
var pamac_config = new Pamac.Config ();
|
||||
set_icon_visible (!pamac_config.no_update_hide_icon);
|
||||
close_notification ();
|
||||
} else {
|
||||
updates_available = true;
|
||||
string info = ngettext ("%u available update", "%u available updates", updates_nb).printf (updates_nb);
|
||||
set_icon (update_icon_name);
|
||||
set_tooltip (info);
|
||||
@@ -241,6 +247,22 @@ namespace Pamac {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool check_icon_hide_setting () {
|
||||
var pamac_config = new Pamac.Config ();
|
||||
if (!updates_available) {
|
||||
set_icon_visible (!pamac_config.no_update_hide_icon);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void launch_icon_check_timeout () {
|
||||
if (icon_timeout_id != 0) {
|
||||
Source.remove (icon_timeout_id);
|
||||
icon_timeout_id = 0;
|
||||
}
|
||||
icon_timeout_id = Timeout.add_seconds ((uint) 1, check_icon_hide_setting);
|
||||
}
|
||||
|
||||
void launch_refresh_timeout (uint64 refresh_period_in_hours) {
|
||||
if (refresh_timeout_id != 0) {
|
||||
Source.remove (refresh_timeout_id);
|
||||
@@ -256,7 +278,7 @@ namespace Pamac {
|
||||
Intl.textdomain ("pamac");
|
||||
Intl.setlocale (LocaleCategory.ALL, "");
|
||||
|
||||
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
|
||||
var pamac_config = new Pamac.Config ();
|
||||
// if refresh period is 0, just return so tray will exit
|
||||
if (pamac_config.refresh_period == 0) {
|
||||
return;
|
||||
@@ -266,6 +288,7 @@ namespace Pamac {
|
||||
|
||||
extern_lock = false;
|
||||
refresh_timeout_id = 0;
|
||||
icon_timeout_id = 0;
|
||||
|
||||
create_menu ();
|
||||
init_status_icon ();
|
||||
@@ -286,9 +309,11 @@ namespace Pamac {
|
||||
Timeout.add (200, check_extern_lock);
|
||||
// wait 30 seconds before check updates
|
||||
Timeout.add_seconds (30, () => {
|
||||
check_icon_hide_setting ();
|
||||
check_updates ();
|
||||
return false;
|
||||
});
|
||||
launch_icon_check_timeout ();
|
||||
launch_refresh_timeout (pamac_config.refresh_period);
|
||||
|
||||
this.hold ();
|
||||
|
Reference in New Issue
Block a user