change config to gsettings

This commit is contained in:
Chris Cromer 2017-11-10 22:36:50 -03:00
parent e8a11f6960
commit 00f4092ee4
35 changed files with 347 additions and 545 deletions

View File

@ -61,17 +61,16 @@ if ( NOT WHERE_GRESOURCE )
endif()
add_subdirectory(src/vapis)
add_subdirectory(data/schemas)
add_subdirectory(po)
add_subdirectory(data/pixmaps)
add_subdirectory(data/mime)
add_subdirectory(data/polkit)
add_subdirectory(data/systemd)
add_subdirectory(data/config)
add_subdirectory(data)
add_subdirectory(data/dbus)
add_subdirectory(data/icons/24x24/status)
add_subdirectory(data/icons/16x16/apps)
add_subdirectory(data/config/noaur)
add_subdirectory(data/icons/32x32/apps)
add_subdirectory(data/interface)
add_subdirectory(src)

View File

@ -1,19 +0,0 @@
### CMakeLists automatically created with AutoVala
### Do not edit
if (NOT(DISABLE_AUR))
IF(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pamac.conf)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/pamac.conf
DESTINATION
/etc
)
ELSE()
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/pamac.conf
DESTINATION
/etc
)
ENDIF()
endif ()

View File

@ -1,19 +0,0 @@
### CMakeLists automatically created with AutoVala
### Do not edit
if (DISABLE_AUR)
IF(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/pamac.conf)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/pamac.conf
DESTINATION
/etc
)
ELSE()
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/pamac.conf
DESTINATION
/etc
)
ENDIF()
endif ()

View File

@ -1,26 +0,0 @@
### Pamac configuration file
## When removing a package, also remove those dependencies
## that are not required by other packages (recurse option):
#RemoveUnrequiredDeps
## How often to check for updates, value in hours (0 to disable):
RefreshPeriod = 6
## When there are no updates available, hide the tray icon:
#NoUpdateHideIcon
## Number of versions of each package to keep in the cache:
KeepNumPackages = 3
## Remove only the versions of uninstalled packages when clean cache:
#OnlyRmUninstalled
## Terminal background color
BackgroundColor = rgb(0,0,0)
## Terminal foreground color
ForegroundColor = rgb(255,255,255)
## The font used in the terminal
TerminalFont = Monospace Regular 12

View File

@ -1,41 +0,0 @@
### Pamac configuration file
## When removing a package, also remove those dependencies
## that are not required by other packages (recurse option):
#RemoveUnrequiredDeps
## How often to check for updates, value in hours (0 to disable):
RefreshPeriod = 6
## When there are no updates available, hide the tray icon:
#NoUpdateHideIcon
## Allow Pamac to search and install packages from AUR:
#EnableAUR
## When AUR support is enabled search in AUR by default:
#SearchInAURByDefault
## When AUR support is enabled check for updates from AUR:
#CheckAURUpdates
## AUR build directory:
BuildDirectory = /tmp
## Do not ask for confirmation when building packages:
#NoConfirmBuild
## Number of versions of each package to keep in the cache:
KeepNumPackages = 3
## Remove only the versions of uninstalled packages when clean cache:
#OnlyRmUninstalled
## Terminal background color
BackgroundColor = rgb(0,0,0)
## Terminal foreground color
ForegroundColor = rgb(255,255,255)
## The font used in the terminal
TerminalFont = Monospace Regular 12

View File

@ -0,0 +1,33 @@
### CMakeLists automatically created with AutoVala
### Do not edit
IF(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/org.pamac.main.gschema.xml)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/org.pamac.main.gschema.xml
DESTINATION
/usr/share/glib-2.0/schemas
)
ELSE()
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/org.pamac.main.gschema.xml
DESTINATION
/usr/share/glib-2.0/schemas
)
ENDIF()
if (NOT DISABLE_AUR)
IF(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/org.pamac.aur.gschema.xml)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/org.pamac.aur.gschema.xml
DESTINATION
/usr/share/glib-2.0/schemas
)
ELSE()
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/org.pamac.aur.gschema.xml
DESTINATION
/usr/share/glib-2.0/schemas
)
ENDIF()
endif ()

View File

@ -0,0 +1,37 @@
<schemalist>
<schema id="org.pamac.aur" path="/org/pamac/aur/" gettext-domain="pamac">
<key name="enable-aur" type="b">
<default>false</default>
<summary>Enable AUR</summary>
<description>
Allow Pamac to search and install packages from AUR
</description>
</key>
<key name="search-in-aur" type="b">
<default>true</default>
<summary>Search in AUR by default</summary>
<description>
When AUR support is enabled search in AUR by default
</description>
</key>
<key name="check-aur-updates" type="b">
<default>false</default>
<summary>Check AUR for updates</summary>
<description>
When AUR support is enabled check for updates from AUR
</description>
</key>
<key name="build-directory" type="s">
<default l10n="messages">"/tmp"</default>
<summary>AUR build directory</summary>
<description>
Directory where to build packages that come from the AUR
</description>
</key>
</schema>
</schemalist>

View File

@ -0,0 +1,69 @@
<schemalist>
<schema id="org.pamac.main" path="/org/pamac/main/" gettext-domain="pamac">
<key name="remove-unrequired-deps" type="b">
<default>false</default>
<summary>Remove unrequired dependencies</summary>
<description>
When removing a package, also remove those dependencies that are not required by other packages (recurse option)
</description>
</key>
<key name="refresh-period" type="t">
<default>6</default>
<summary>Refresh period</summary>
<description>
How often to check for updates, value in hours (0 to disable)
</description>
</key>
<key name="no-update-hide-icon" type="b">
<default>true</default>
<summary>Hide icon if there are no updates</summary>
<description>
When there are no updates available, hide the tray icon
</description>
</key>
<key name="keep-num-packages" type="t">
<default>3</default>
<summary>Numer of packages to keep</summary>
<description>
Number of versions of each package to keep in the cache
</description>
</key>
<key name="only-rm-uninstalled" type="b">
<default>false</default>
<summary>Remove only uninstalled packages when cleaning cache</summary>
<description>
Remove only the versions of uninstalled packages when clean cache
</description>
</key>
<key name="background-color" type="s">
<default l10n="messages">"rgb(0,0,0)"</default>
<summary>Terminal background color</summary>
<description>
Terminal background color
</description>
</key>
<key name="foreground-color" type="s">
<default l10n="messages">"rgb(255,255,255)"</default>
<summary>Terminal foreground color</summary>
<description>
Terminal foreground color
</description>
</key>
<key name="terminal-font" type="s">
<default l10n="messages">"Monospace Regular 12"</default>
<summary>Terminal font</summary>
<description>
The font used in the terminal
</description>
</key>
</schema>
</schemalist>

View File

@ -36,11 +36,10 @@ meson.add_install_script(join_paths(meson.current_source_dir(),'meson_scripts','
meson.add_install_script(join_paths(meson.current_source_dir(),'meson_scripts','install_data.sh'),'/usr/lib/systemd/system',join_paths(meson.current_source_dir(),'data/systemd','pamac-mirrorlist.timer'))
if DISABLE_AUR
meson.add_install_script(join_paths(meson.current_source_dir(),'meson_scripts','install_data.sh'),'/etc',join_paths(meson.current_source_dir(),'data/config/noaur','pamac.conf'))
meson.add_install_script(join_paths(meson.current_source_dir(),'meson_scripts','install_data.sh'),'/usr/share/glib-2.0/schemas',join_paths(meson.current_source_dir(),'data/schemas','org.pamac.main.gschema.xml'))
else
meson.add_install_script(join_paths(meson.current_source_dir(),'meson_scripts','install_data.sh'),'/etc',join_paths(meson.current_source_dir(),'data/config','pamac.conf'))
if not DISABLE_AUR
meson.add_install_script(join_paths(meson.current_source_dir(),'meson_scripts','install_data.sh'),'/usr/share/glib-2.0/schemas',join_paths(meson.current_source_dir(),'data/schemas','org.pamac.aur.gschema.xml'))
endif
pamac_installer_gresource_xml_generator = generator(find_program('glib-compile-resources'), arguments: [ '--sourcedir=@SOURCE_DIR@/data' , '--generate-source', '--target=@BUILD_DIR@/pamac.installer.gresource.xml.c', '@INPUT@'], output: '@PLAINNAME@.c')

View File

@ -1,7 +1,7 @@
### AutoVala Project ###
autovala_version: 27
project_name: pamac-classic
project_version: 6.5.2
project_version: 6.6.0
vala_version: 0.38
custom: data/systemd/pamac-system.service /usr/lib/systemd/system
@ -9,10 +9,9 @@ custom: data/systemd/pamac-cleancache.service /usr/lib/systemd/system
custom: data/systemd/pamac-cleancache.timer /usr/lib/systemd/system
custom: data/systemd/pamac-mirrorlist.service /usr/lib/systemd/system
custom: data/systemd/pamac-mirrorlist.timer /usr/lib/systemd/system
if DISABLE_AUR
custom: data/config/noaur/pamac.conf /etc
else
custom: data/config/pamac.conf /etc
custom: data/schemas/org.pamac.main.gschema.xml /usr/share/glib-2.0/schemas
if NOT DISABLE_AUR
custom: data/schemas/org.pamac.aur.gschema.xml /usr/share/glib-2.0/schemas
end
define: ENABLE_UPDATE_ICON
@ -27,19 +26,18 @@ define: KDE_TRAY
vapidir: src/vapis
vala_binary: src/pamac-clean-cache/pamac-clean-cache
*version: 6.5.2
*version: 6.6.0
vala_local_package: pamacclassic
vala_package: posix
vala_check_package: gtk+-3.0
vala_check_package: json-glib-1.0
*vala_check_package: gio-2.0
*vala_check_package: glib-2.0
*vala_check_package: gobject-2.0
*vala_source: clean_cache.vala
*vala_source: pamac_config.vala
vala_binary: src/pamac-install/pamac-install
*version: 6.5.2
*version: 6.6.0
use_gresource: pamac_installer_gresource_xml
vala_local_package: pamacclassic
vala_check_package: gtk+-3.0
@ -51,7 +49,7 @@ vala_check_package: json-glib-1.0
*vala_source: progress_dialog.vala
vala_binary: src/pamac-manager/pamac-manager
*version: 6.5.2
*version: 6.6.0
alias: pamac-updater
use_gresource: pamac_manager_gresource_xml
vala_local_package: pamacclassic
@ -65,7 +63,7 @@ vala_check_package: json-glib-1.0
*vala_source: manager_window.vala
vala_binary: src/pamac-system-daemon/pamac-system-daemon
*version: 6.5.2
*version: 6.6.0
vala_local_package: pamacclassic
vala_package: posix
vala_check_package: gtk+-3.0
@ -83,7 +81,7 @@ vala_check_package: polkit-gobject-1
*vala_source: system_daemon.vala
vala_binary: src/pamac-tray/pamac-tray
*version: 6.5.2
*version: 6.6.0
vala_local_package: pamacclassic
vala_package: posix
vala_check_package: json-glib-1.0
@ -107,7 +105,7 @@ end
*vala_source: tray.vala
vala_binary: src/pamac-user-daemon/pamac-user-daemon
*version: 6.5.2
*version: 6.6.0
vala_local_package: pamacclassic
vala_package: posix
vala_check_package: gtk+-3.0
@ -122,7 +120,7 @@ vala_check_package: libsoup-2.4
vala_library: src/pamac-classic
*version: 6.5.2
*version: 6.6.0
namespace: pamacclassic
use_gresource: pamac_transaction_gresource_xml
vala_package: posix

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Pamac\n"
"Report-Msgid-Bugs-To: cromer@cromnix.org\n"
"POT-Creation-Date: 2017-11-08 16:24-0300\n"
"POT-Creation-Date: 2017-11-10 22:35-0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"

View File

@ -7,7 +7,7 @@ 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 "$")
@ -15,7 +15,7 @@ configure_file (${CMAKE_SOURCE_DIR}/src/Config.vala.base ${CMAKE_BINARY_DIR}/src
add_definitions(-DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\")
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/pamacclassic.pc ${CMAKE_CURRENT_BINARY_DIR}/pamacclassic.pc)
configure_file (${CMAKE_CURRENT_SOURCE_DIR}/pamacclassic.deps ${CMAKE_CURRENT_BINARY_DIR}/pamacclassic.deps)
set (VERSION "6.5.2")
set (VERSION "6.6.0")
add_definitions (${DEPS_CFLAGS})
link_libraries ( ${DEPS_LIBRARIES} )
link_directories ( ${DEPS_LIBRARY_DIRS} )
@ -101,7 +101,7 @@ add_dependencies( pamacclassic ${pamacclassic_DEPENDENCIES} )
target_link_libraries( pamacclassic m )
set_target_properties( pamacclassic PROPERTIES
VERSION
6.5.2
6.6.0
SOVERSION
6 )

View File

@ -4,7 +4,7 @@ cfg_pamac_classic.set('PKGDATADIR', join_paths(get_option('prefix'),get_option('
cfg_pamac_classic.set('GETTEXT_PACKAGE', 'pamac-classic')
cfg_pamac_classic.set('RELEASE_NAME', 'pamac-classic')
cfg_pamac_classic.set('PREFIX', get_option('prefix'))
cfg_pamac_classic.set('VERSION', '6.5.2')
cfg_pamac_classic.set('VERSION', '6.6.0')
cfg_pamac_classic.set('TESTSRCDIR', meson.source_root())
cfgfile_1 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_classic)
@ -59,7 +59,7 @@ pamac_classic_deps += [meson.get_compiler('c').find_library('m', required : fals
pamac_classic_vala_args += ['--gir=pamacclassic-6.0.gir']
pamacclassic_library = shared_library('pamacclassic',pamac_classic_sources,dependencies: pamac_classic_deps,vala_args: pamac_classic_vala_args,c_args: pamac_classic_c_args,version: '6.5.2',soversion: '6',install: true)
pamacclassic_library = shared_library('pamacclassic',pamac_classic_sources,dependencies: pamac_classic_deps,vala_args: pamac_classic_vala_args,c_args: pamac_classic_c_args,version: '6.6.0',soversion: '6',install: true)
pamac_classic_requires = []
pamac_classic_requires += ['gdk-3.0']
@ -74,7 +74,7 @@ pamac_classic_requires += ['glib-2.0']
pamac_classic_requires += ['gobject-2.0']
pkg_mod = import('pkgconfig')
pkg_mod.generate(libraries : pamacclassic_library,
version : '6.5.2',
version : '6.6.0',
name : 'pamacclassic',
filebase : 'pamacclassic',
description : 'pamacclassic',

View File

@ -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-clean-cache/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-clean-cache/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 )
@ -26,7 +26,6 @@ include (ValaPrecompile)
set (VALA_PACKAGES ${VALA_PACKAGES} posix)
set (VALA_PACKAGES ${VALA_PACKAGES} gtk+-3.0)
set (VALA_PACKAGES ${VALA_PACKAGES} json-glib-1.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gio-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} glib-2.0)
set (VALA_PACKAGES ${VALA_PACKAGES} gobject-2.0)

View File

@ -19,7 +19,7 @@
*/
int main () {
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
var pamac_config = new Pamac.Config ();
string rm_only_uninstalled_str = "";
if (pamac_config.rm_only_uninstalled) {
rm_only_uninstalled_str = "-u";

View File

@ -4,14 +4,13 @@ cfg_pamac_clean_cache.set('PKGDATADIR', join_paths(get_option('prefix'),get_opti
cfg_pamac_clean_cache.set('GETTEXT_PACKAGE', 'pamac-classic')
cfg_pamac_clean_cache.set('RELEASE_NAME', 'pamac-classic')
cfg_pamac_clean_cache.set('PREFIX', get_option('prefix'))
cfg_pamac_clean_cache.set('VERSION', '6.5.2')
cfg_pamac_clean_cache.set('VERSION', '6.6.0')
cfg_pamac_clean_cache.set('TESTSRCDIR', meson.source_root())
cfgfile_4 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_clean_cache)
pamac_clean_cache_deps = [gtk_3_0_dep]
pamac_clean_cache_deps += [json_glib_1_0_dep]
pamac_clean_cache_deps += [gio_2_0_dep]
pamac_clean_cache_deps += [glib_2_0_dep]
pamac_clean_cache_deps += [gobject_2_0_dep]
pamac_clean_cache_sources = [cfgfile_4]

View File

@ -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-install/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-install/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 )

View File

@ -4,7 +4,7 @@ cfg_pamac_install.set('PKGDATADIR', join_paths(get_option('prefix'),get_option('
cfg_pamac_install.set('GETTEXT_PACKAGE', 'pamac-classic')
cfg_pamac_install.set('RELEASE_NAME', 'pamac-classic')
cfg_pamac_install.set('PREFIX', get_option('prefix'))
cfg_pamac_install.set('VERSION', '6.5.2')
cfg_pamac_install.set('VERSION', '6.6.0')
cfg_pamac_install.set('TESTSRCDIR', meson.source_root())
cfgfile_5 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_install)

View File

@ -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-manager/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-manager/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 )

View File

@ -367,7 +367,7 @@ namespace Pamac {
#endif
transaction.important_details_outpout.connect (on_important_details_outpout);
transaction.finished.connect (on_transaction_finished);
transaction.write_pamac_config_finished.connect (on_write_pamac_config_finished);
transaction.save_pamac_config_finished.connect (on_save_pamac_config_finished);
transaction.set_pkgreason_finished.connect (on_set_pkgreason_finished);
transaction.generate_mirrors_list.connect (on_generate_mirrors_list);
transaction.run_preferences_dialog_finished.connect (on_run_preferences_dialog_finished);
@ -398,14 +398,14 @@ namespace Pamac {
}
#if DISABLE_AUR
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon) {
void on_save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon) {
}
#else
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
void on_save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur) {
support_aur (enable_aur);
}
#endif
}
void on_set_pkgreason_finished () {
transaction.unlock ();

View File

@ -4,7 +4,7 @@ cfg_pamac_manager.set('PKGDATADIR', join_paths(get_option('prefix'),get_option('
cfg_pamac_manager.set('GETTEXT_PACKAGE', 'pamac-classic')
cfg_pamac_manager.set('RELEASE_NAME', 'pamac-classic')
cfg_pamac_manager.set('PREFIX', get_option('prefix'))
cfg_pamac_manager.set('VERSION', '6.5.2')
cfg_pamac_manager.set('VERSION', '6.6.0')
cfg_pamac_manager.set('TESTSRCDIR', meson.source_root())
cfgfile_6 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_manager)

View File

@ -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-system-daemon/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-system-daemon/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 )

View File

@ -4,7 +4,7 @@ cfg_pamac_system_daemon.set('PKGDATADIR', join_paths(get_option('prefix'),get_op
cfg_pamac_system_daemon.set('GETTEXT_PACKAGE', 'pamac-classic')
cfg_pamac_system_daemon.set('RELEASE_NAME', 'pamac-classic')
cfg_pamac_system_daemon.set('PREFIX', get_option('prefix'))
cfg_pamac_system_daemon.set('VERSION', '6.5.2')
cfg_pamac_system_daemon.set('VERSION', '6.6.0')
cfg_pamac_system_daemon.set('TESTSRCDIR', meson.source_root())
cfgfile_7 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_system_daemon)

View File

@ -103,9 +103,9 @@ namespace Pamac {
public signal void trans_commit_finished (bool success);
public signal void get_authorization_finished (bool authorized);
#if DISABLE_AUR
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon);
public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon);
#else
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates);
#endif
public signal void write_alpm_config_finished (bool checkspace);
@ -356,21 +356,15 @@ namespace Pamac {
});
}
public void start_write_pamac_config (HashTable<string,Variant> new_pamac_conf, GLib.BusName sender) {
check_authorization.begin (sender, (obj, res) => {
var pamac_config = new Pamac.Config ("/etc/pamac.conf");
bool authorized = check_authorization.end (res);
if (authorized ) {
pamac_config.write (new_pamac_conf);
public void start_save_pamac_config () {
var pamac_config = new Pamac.Config ();
pamac_config.reload ();
}
#if DISABLE_AUR
write_pamac_config_finished (pamac_config.recurse, pamac_config.refresh_period, pamac_config.no_update_hide_icon);
save_pamac_config_finished (pamac_config.recurse, pamac_config.refresh_period, pamac_config.no_update_hide_icon);
#else
write_pamac_config_finished (pamac_config.recurse, pamac_config.refresh_period, pamac_config.no_update_hide_icon,
save_pamac_config_finished (pamac_config.recurse, pamac_config.refresh_period, pamac_config.no_update_hide_icon,
pamac_config.enable_aur, pamac_config.search_aur, pamac_config.aur_build_dir, pamac_config.check_aur_updates);
#endif
});
}
private void write_alpm_config () {

View File

@ -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 )

View File

@ -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)

View File

@ -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);

View File

@ -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;

View File

@ -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 ();

View File

@ -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-user-daemon/Config.vala.base ${CMAKE_BINARY_DIR}/src/pamac-user-daemon/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 )

View File

@ -4,7 +4,7 @@ cfg_pamac_user_daemon.set('PKGDATADIR', join_paths(get_option('prefix'),get_opti
cfg_pamac_user_daemon.set('GETTEXT_PACKAGE', 'pamac-classic')
cfg_pamac_user_daemon.set('RELEASE_NAME', 'pamac-classic')
cfg_pamac_user_daemon.set('PREFIX', get_option('prefix'))
cfg_pamac_user_daemon.set('VERSION', '6.5.2')
cfg_pamac_user_daemon.set('VERSION', '6.6.0')
cfg_pamac_user_daemon.set('TESTSRCDIR', meson.source_root())
cfgfile_2 = configure_file(input: 'Config.vala.base',output: 'Config.vala',configuration: cfg_pamac_user_daemon)

View File

@ -20,7 +20,6 @@
namespace Pamac {
class Config {
string conf_path;
HashTable<string,string> _environment_variables;
public bool recurse { get; private set; }
@ -44,8 +43,7 @@ namespace Pamac {
}
}
public Config (string path) {
conf_path = path;
public Config () {
//get environment variables
_environment_variables = new HashTable<string,string> (str_hash, str_equal);
var utsname = Posix.utsname();
@ -91,291 +89,29 @@ namespace Pamac {
terminal_background = "rgb(0,0,0)";
terminal_foreground = "rgb(255,255,255)";
terminal_font = "Sans Regular 12";
parse_file (conf_path);
//parse_file (conf_path);
load_settings ();
}
void parse_file (string path) {
var file = GLib.File.new_for_path (path);
if (file.query_exists ()) {
try {
// Open file for reading and wrap returned FileInputStream into a
// DataInputStream, so we can read line by line
var dis = new DataInputStream (file.read ());
string? line;
// Read lines until end of file (null) is reached
while ((line = dis.read_line ()) != null) {
if (line.length == 0) {
continue;
}
// ignore whole line and end of line comments
string[] splitted = line.split ("#", 2);
line = splitted[0].strip ();
if (line.length == 0) {
continue;
}
splitted = line.split ("=", 2);
unowned string key = splitted[0]._strip ();
if (key == "RemoveUnrequiredDeps") {
recurse = true;
} else if (key == "RefreshPeriod") {
if (splitted.length == 2) {
unowned string val = splitted[1]._strip ();
refresh_period = uint64.parse (val);
}
} else if (key == "NoUpdateHideIcon") {
no_update_hide_icon = true;
void load_settings () {
var settings = new Settings ("org.pamac.main");
recurse = settings.get_boolean ("remove-unrequired-deps");
refresh_period = settings.get_uint64 ("refresh-period");
no_update_hide_icon = settings.get_boolean ("no-update-hide-icon");
keep_num_pkgs = settings.get_uint64 ("keep-num-packages");
rm_only_uninstalled = settings.get_boolean ("only-rm-uninstalled");
terminal_background = settings.get_string ("background-color");
terminal_foreground = settings.get_string ("foreground-color");
terminal_font = settings.get_string ("terminal-font");
#if DISABLE_AUR
#else
} else if (key == "EnableAUR") {
enable_aur = true;
} else if (key == "SearchInAURByDefault") {
search_aur = true;
} else if (key == "BuildDirectory") {
if (splitted.length == 2) {
aur_build_dir = splitted[1]._strip ();
}
} else if (key == "CheckAURUpdates") {
check_aur_updates = true;
settings = new Settings ("org.pamac.aur");
enable_aur = settings.get_boolean ("enable-aur");
search_aur = settings.get_boolean ("search-in-aur");
check_aur_updates = settings.get_boolean ("check-aur-updates");
aur_build_dir = settings.get_string ("build-directory");
#endif
} else if (key == "KeepNumPackages") {
if (splitted.length == 2) {
unowned string val = splitted[1]._strip ();
keep_num_pkgs = uint64.parse (val);
}
} else if (key == "OnlyRmUninstalled") {
rm_only_uninstalled = true;
} else if (key == "BackgroundColor") {
if (splitted.length == 2) {
terminal_background = splitted[1]._strip ();
}
} else if (key == "ForegroundColor") {
if (splitted.length == 2) {
terminal_foreground = splitted[1]._strip ();
}
} else if (key == "TerminalFont") {
if (splitted.length == 2) {
terminal_font = splitted[1]._strip ();
}
}
}
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
} else {
GLib.stderr.printf ("File '%s' doesn't exist.\n", path);
}
}
public void write (HashTable<string,Variant> new_conf) {
var file = GLib.File.new_for_path (conf_path);
var data = new GLib.List<string> ();
if (file.query_exists ()) {
try {
// Open file for reading and wrap returned FileInputStream into a
// DataInputStream, so we can read line by line
var dis = new DataInputStream (file.read ());
string? line;
// Read lines until end of file (null) is reached
while ((line = dis.read_line ()) != null) {
if (line.length == 0) {
data.append ("\n");
continue;
}
unowned Variant variant;
if (line.contains ("RemoveUnrequiredDeps")) {
if (new_conf.lookup_extended ("RemoveUnrequiredDeps", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("RemoveUnrequiredDeps\n");
} else {
data.append ("#RemoveUnrequiredDeps\n");
}
new_conf.remove ("RemoveUnrequiredDeps");
} else {
data.append (line + "\n");
}
} else if (line.contains ("RefreshPeriod")) {
if (new_conf.lookup_extended ("RefreshPeriod", null, out variant)) {
data.append ("RefreshPeriod = %llu\n".printf (variant.get_uint64 ()));
new_conf.remove ("RefreshPeriod");
} else {
data.append (line + "\n");
}
} else if (line.contains ("NoUpdateHideIcon")) {
if (new_conf.lookup_extended ("NoUpdateHideIcon", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("NoUpdateHideIcon\n");
} else {
data.append ("#NoUpdateHideIcon\n");
}
new_conf.remove ("NoUpdateHideIcon");
} else {
data.append (line + "\n");
}
#if DISABLE_AUR
#else
} else if (line.contains ("EnableAUR")) {
if (new_conf.lookup_extended ("EnableAUR", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("EnableAUR\n");
} else {
data.append ("#EnableAUR\n");
}
new_conf.remove ("EnableAUR");
} else {
data.append (line + "\n");
}
} else if (line.contains ("SearchInAURByDefault")) {
if (new_conf.lookup_extended ("SearchInAURByDefault", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("SearchInAURByDefault\n");
} else {
data.append ("#SearchInAURByDefault\n");
}
new_conf.remove ("SearchInAURByDefault");
} else {
data.append (line + "\n");
}
} else if (line.contains ("BuildDirectory")) {
if (new_conf.lookup_extended ("BuildDirectory", null, out variant)) {
data.append ("BuildDirectory = %s\n".printf (variant.get_string ()));
new_conf.remove ("BuildDirectory");
} else {
data.append (line + "\n");
}
} else if (line.contains ("CheckAURUpdates")) {
if (new_conf.lookup_extended ("CheckAURUpdates", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("CheckAURUpdates\n");
} else {
data.append ("#CheckAURUpdates\n");
}
new_conf.remove ("CheckAURUpdates");
} else {
data.append (line + "\n");
}
#endif
} else if (line.contains ("KeepNumPackages")) {
if (new_conf.lookup_extended ("KeepNumPackages", null, out variant)) {
data.append ("KeepNumPackages = %llu\n".printf (variant.get_uint64 ()));
new_conf.remove ("KeepNumPackages");
} else {
data.append (line + "\n");
}
} else if (line.contains ("OnlyRmUninstalled")) {
if (new_conf.lookup_extended ("OnlyRmUninstalled", null, out variant)) {
if (variant.get_boolean ()) {
data.append ("OnlyRmUninstalled\n");
} else {
data.append ("#OnlyRmUninstalled\n");
}
new_conf.remove ("OnlyRmUninstalled");
} else {
data.append (line + "\n");
}
} else if (line.contains ("BackgroundColor")) {
if (new_conf.lookup_extended ("BackgroundColor", null, out variant)) {
data.append ("BackgroundColor = %s\n".printf (variant.get_string ()));
new_conf.remove ("BackgroundColor");
} else {
data.append (line + "\n");
}
} else if (line.contains ("ForegroundColor")) {
if (new_conf.lookup_extended ("ForegroundColor", null, out variant)) {
data.append ("ForegroundColor = %s\n".printf (variant.get_string ()));
new_conf.remove ("ForegroundColor");
} else {
data.append (line + "\n");
}
} else if (line.contains ("TerminalFont")) {
if (new_conf.lookup_extended ("TerminalFont", null, out variant)) {
data.append ("TerminalFont = %s\n".printf (variant.get_string ()));
new_conf.remove ("TerminalFont");
} else {
data.append (line + "\n");
}
} else {
data.append (line + "\n");
}
}
// delete the file before rewrite it
file.delete ();
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
} else {
GLib.stderr.printf ("File '%s' doesn't exist.\n", conf_path);
}
// create lines for unexisted options
if (new_conf.size () != 0) {
data.append ("\n");
var iter = HashTableIter<string,Variant> (new_conf);
unowned string key;
unowned Variant val;
while (iter.next (out key, out val)) {
if (key == "RemoveUnrequiredDeps") {
if (val.get_boolean ()) {
data.append ("RemoveUnrequiredDeps\n");
} else {
data.append ("#RemoveUnrequiredDeps\n");
}
} else if (key == "RefreshPeriod") {
data.append ("RefreshPeriod = %llu\n".printf (val.get_uint64 ()));
} else if (key =="NoUpdateHideIcon") {
if (val.get_boolean ()) {
data.append ("NoUpdateHideIcon\n");
} else {
data.append ("#NoUpdateHideIcon\n");
}
#if DISABLE_AUR
#else
} else if (key == "EnableAUR") {
if (val.get_boolean ()) {
data.append ("EnableAUR\n");
} else {
data.append ("#EnableAUR\n");
}
} else if (key == "SearchInAURByDefault") {
if (val.get_boolean ()) {
data.append ("SearchInAURByDefault\n");
} else {
data.append ("#SearchInAURByDefault\n");
}
} else if (key == "BuildDirectory") {
data.append ("BuildDirectory = %s\n".printf (val.get_string ()));
} else if (key == "CheckAURUpdates") {
if (val.get_boolean ()) {
data.append ("CheckAURUpdates\n");
} else {
data.append ("#CheckAURUpdates\n");
}
#endif
} else if (key == "KeepNumPackages") {
data.append ("KeepNumPackages = %llu\n".printf (val.get_uint64 ()));
} else if (key == "OnlyRmUninstalled") {
if (val.get_boolean ()) {
data.append ("OnlyRmUninstalled\n");
} else {
data.append ("#OnlyRmUninstalled\n");
}
} else if (key == "BackgroundColor") {
data.append ("BackgroundColor = %s\n".printf (val.get_string ()));
} else if (key == "ForegroundColor") {
data.append ("ForegroundCOlor = %s\n".printf (val.get_string ()));
} else if (key == "TerminalFont") {
data.append ("TerminalFont = %s\n".printf (val.get_string ()));
}
}
}
// write the file
try {
// creating a DataOutputStream to the file
var dos = new DataOutputStream (file.create (FileCreateFlags.REPLACE_DESTINATION));
foreach (unowned string new_line in data) {
// writing a short string to the stream
dos.put_string (new_line);
}
} catch (GLib.Error e) {
GLib.stderr.printf("%s\n", e.message);
}
}
}
}

View File

@ -4,7 +4,7 @@ includedir=@DOLLAR@{prefix}/${CMAKE_INSTALL_INCLUDEDIR}
Name: pamacclassic
Description: pamacclassic
Version: 6.5.2
Version: 6.6.0
Libs: -L@DOLLAR@{libdir} -lpamacclassic
Cflags: -I@DOLLAR@{includedir}
Requires: gdk-3.0 gtk+-3.0 json-glib-1.0 libalpm libnotify libsoup-2.4 vte-2.91 gio-2.0 glib-2.0 gobject-2.0

View File

@ -137,7 +137,6 @@ namespace Pamac {
no_update_hide_icon_checkbutton.toggled.connect (on_no_update_hide_icon_checkbutton_toggled);
cache_keep_nb_spin_button.value_changed.connect (on_cache_keep_nb_spin_button_value_changed);
cache_only_uninstalled_checkbutton.toggled.connect (on_cache_only_uninstalled_checkbutton_toggled);
transaction.write_pamac_config_finished.connect (on_write_pamac_config_finished);
terminal_background.color_set.connect (on_select_background);
terminal_foreground.color_set.connect (on_select_foreground);
terminal_font.font_set.connect (on_select_font);
@ -194,109 +193,117 @@ namespace Pamac {
}
bool on_remove_unrequired_deps_button_state_set (bool new_state) {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("RemoveUnrequiredDeps", new Variant.boolean (new_state));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.main");
settings.set_boolean ("remove-unrequired-deps", new_state);
config_changed();
transaction.start_save_pamac_config ();
return true;
}
bool on_check_updates_button_state_set (bool new_state) {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
var settings = new Settings ("org.pamac.main");
refresh_period_label.sensitive = new_state;
refresh_period_spin_button.sensitive = new_state;
no_update_hide_icon_checkbutton.sensitive = new_state;
ignorepkgs_box.sensitive = new_state;
if (new_state) {
new_pamac_conf.insert ("RefreshPeriod", new Variant.uint64 (previous_refresh_period));
settings.set_uint64 ("refresh-period", previous_refresh_period);
} else {
new_pamac_conf.insert ("RefreshPeriod", new Variant.uint64 (0));
settings.set_uint64 ("refresh-period", 0);
}
transaction.start_write_pamac_config (new_pamac_conf);
config_changed();
transaction.start_save_pamac_config ();
return true;
}
void on_refresh_period_spin_button_value_changed () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("RefreshPeriod", new Variant.uint64 (refresh_period_spin_button.get_value_as_int ()));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.main");
settings.set_uint64 ("refresh-period", refresh_period_spin_button.get_value_as_int ());
config_changed();
transaction.start_save_pamac_config ();
}
void on_cache_keep_nb_spin_button_value_changed () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("KeepNumPackages", new Variant.uint64 (cache_keep_nb_spin_button.get_value_as_int ()));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.main");
settings.set_uint64 ("keep-num-packages", cache_keep_nb_spin_button.get_value_as_int ());
config_changed();
transaction.start_save_pamac_config ();
}
void on_cache_only_uninstalled_checkbutton_toggled () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("OnlyRmUninstalled", new Variant.boolean (cache_only_uninstalled_checkbutton.active));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.main");
settings.set_boolean ("only-rm-uninstalled", cache_only_uninstalled_checkbutton.active);
config_changed();
transaction.start_save_pamac_config ();
}
void on_no_update_hide_icon_checkbutton_toggled () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("NoUpdateHideIcon", new Variant.boolean (no_update_hide_icon_checkbutton.active));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.main");
settings.set_boolean ("no-update-hide-icon", no_update_hide_icon_checkbutton.active);
config_changed();
transaction.start_save_pamac_config ();
}
void on_select_background () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("BackgroundColor", new Variant.string (terminal_background.rgba.to_string ()));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.main");
settings.set_string ("background-color", terminal_background.rgba.to_string ());
config_changed();
transaction.start_save_pamac_config ();
transaction.update_terminal_background (terminal_background.rgba.to_string ());
}
void on_select_foreground () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("ForegroundColor", new Variant.string (terminal_foreground.rgba.to_string ()));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.main");
settings.set_string ("foreground-color", terminal_foreground.rgba.to_string ());
config_changed();
transaction.start_save_pamac_config ();
transaction.update_terminal_foreground (terminal_foreground.rgba.to_string ());
}
void on_select_font () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("TerminalFont", new Variant.string (terminal_font.get_font_name ()));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.main");
settings.set_string ("terminal-font", terminal_font.get_font_name ());
config_changed();
transaction.start_save_pamac_config ();
transaction.update_terminal_font (terminal_font.get_font_name ());
}
#if DISABLE_AUR
#else
bool on_enable_aur_button_state_set (bool new_state) {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("EnableAUR", new Variant.boolean (new_state));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.aur");
settings.set_boolean ("enable-aur", new_state);
config_changed();
transaction.start_save_pamac_config ();
return true;
}
void on_search_aur_checkbutton_toggled () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("SearchInAURByDefault", new Variant.boolean (search_aur_checkbutton.active));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.aur");
settings.set_boolean ("search-in-aur", search_aur_checkbutton.active);
config_changed();
transaction.start_save_pamac_config ();
}
void on_aur_build_dir_set () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("BuildDirectory", new Variant.string (aur_build_dir_file_chooser.get_filename ()));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.aur");
settings.set_string ("build-directory", aur_build_dir_file_chooser.get_filename ());
config_changed();
transaction.start_save_pamac_config ();
}
void on_check_aur_updates_checkbutton_toggled () {
var new_pamac_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_pamac_conf.insert ("CheckAURUpdates", new Variant.boolean (check_aur_updates_checkbutton.active));
transaction.start_write_pamac_config (new_pamac_conf);
var settings = new Settings ("org.pamac.aur");
settings.set_boolean ("check-aur-updates", check_aur_updates_checkbutton.active);
config_changed();
transaction.start_save_pamac_config ();
}
#endif
#if DISABLE_AUR
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon) {
#else
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates) {
#endif
remove_unrequired_deps_button.state = recurse;
if (refresh_period == 0) {
void config_changed() {
transaction.config_changed();
remove_unrequired_deps_button.state = transaction.recurse;
if (transaction.refresh_period == 0) {
check_updates_button.state = false;
refresh_period_label.sensitive = false;
refresh_period_spin_button.sensitive = false;
@ -305,28 +312,29 @@ namespace Pamac {
} else {
check_updates_button.state = true;
refresh_period_label.sensitive = true;
refresh_period_spin_button.value = refresh_period;
previous_refresh_period = refresh_period;
refresh_period_spin_button.value = transaction.refresh_period;
previous_refresh_period = transaction.refresh_period;
refresh_period_spin_button.sensitive = true;
no_update_hide_icon_checkbutton.sensitive = true;
ignorepkgs_box.sensitive = true;
}
no_update_hide_icon_checkbutton.active = no_update_hide_icon;
no_update_hide_icon_checkbutton.active = transaction.no_update_hide_icon;
#if DISABLE_AUR
#else
enable_aur_button.state = enable_aur;
search_aur_checkbutton.active = search_aur;
search_aur_checkbutton.sensitive = enable_aur;
aur_build_dir_label.sensitive = enable_aur;
aur_build_dir_file_chooser.sensitive = enable_aur;
check_aur_updates_checkbutton.active = check_aur_updates;
check_aur_updates_checkbutton.sensitive = enable_aur;
enable_aur_button.state = transaction.enable_aur;
search_aur_checkbutton.active = transaction.search_aur;
search_aur_checkbutton.sensitive = transaction.enable_aur;
aur_build_dir_label.sensitive = transaction.enable_aur;
aur_build_dir_file_chooser.sensitive = transaction.enable_aur;
check_aur_updates_checkbutton.active = transaction.check_aur_updates;
check_aur_updates_checkbutton.sensitive = transaction.enable_aur;
#endif
}
bool on_check_space_button_state_set (bool new_state) {
var new_alpm_conf = new HashTable<string,Variant> (str_hash, str_equal);
new_alpm_conf.insert ("CheckSpace", new Variant.boolean (new_state));
check_space_button.state = new_state;
transaction.start_write_alpm_config (new_alpm_conf);
return true;
}

View File

@ -70,7 +70,7 @@ namespace Pamac {
public abstract bool get_lock () throws IOError;
public abstract bool unlock () throws IOError;
public abstract void start_get_authorization () throws IOError;
public abstract void start_write_pamac_config (HashTable<string,Variant> new_pamac_conf) throws IOError;
public abstract void start_save_pamac_config () throws IOError;
public abstract void start_write_alpm_config (HashTable<string,Variant> new_alpm_conf) throws IOError;
public abstract void start_write_mirrors_config (HashTable<string,Variant> new_mirrors_conf) throws IOError;
public abstract void start_generate_mirrors_list () throws IOError;
@ -108,9 +108,9 @@ namespace Pamac {
public signal void trans_commit_finished (bool success);
public signal void get_authorization_finished (bool authorized);
#if DISABLE_AUR
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon);
public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon);
#else
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates);
#endif
public signal void write_alpm_config_finished (bool checkspace);
@ -221,9 +221,9 @@ namespace Pamac {
public signal void finished (bool success);
public signal void set_pkgreason_finished ();
#if DISABLE_AUR
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon);
public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon);
#else
public signal void write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
public signal void save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates);
#endif
public signal void write_alpm_config_finished (bool checkspace);
@ -234,7 +234,7 @@ namespace Pamac {
public Transaction (Gtk.ApplicationWindow? application_window) {
mode = Mode.MANAGER;
pamac_config = new Pamac.Config ("/etc/pamac.conf");
pamac_config = new Pamac.Config ();
flags = (1 << 4); //Alpm.TransFlag.CASCADE
if (pamac_config.recurse) {
flags |= (1 << 5); //Alpm.TransFlag.RECURSE
@ -306,6 +306,10 @@ namespace Pamac {
warning_textbuffer = new StringBuilder ();
}
public void config_changed() {
pamac_config.reload();
}
public void update_terminal_background (string background) {
var tmp = Gdk.RGBA ();
tmp.parse (background);
@ -324,18 +328,13 @@ namespace Pamac {
}
public void run_preferences_dialog () {
check_authorization.begin ((obj, res) => {
bool authorized = check_authorization.end (res);
if (authorized) {
var preferences_dialog = new PreferencesDialog (this);
preferences_dialog.run ();
preferences_dialog.destroy ();
while (Gtk.events_pending ()) {
Gtk.main_iteration ();
}
}
run_preferences_dialog_finished ();
});
}
public ErrorInfos get_current_error () {
@ -396,13 +395,13 @@ namespace Pamac {
return authorized;
}
public void start_write_pamac_config (HashTable<string,Variant> new_pamac_conf) {
public void start_save_pamac_config () {
try {
system_daemon.write_pamac_config_finished.connect (on_write_pamac_config_finished);
system_daemon.start_write_pamac_config (new_pamac_conf);
system_daemon.save_pamac_config_finished.connect (on_save_pamac_config_finished);
system_daemon.start_save_pamac_config ();
} catch (IOError e) {
stderr.printf ("IOError: %s\n", e.message);
system_daemon.write_pamac_config_finished.disconnect (on_write_pamac_config_finished);
system_daemon.save_pamac_config_finished.disconnect (on_save_pamac_config_finished);
}
}
@ -1924,21 +1923,21 @@ namespace Pamac {
}
#if DISABLE_AUR
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon) {
void on_save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon) {
#else
void on_write_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
void on_save_pamac_config_finished (bool recurse, uint64 refresh_period, bool no_update_hide_icon,
bool enable_aur, bool search_aur, string aur_build_dir, bool check_aur_updates) {
#endif
system_daemon.write_pamac_config_finished.disconnect (on_write_pamac_config_finished);
system_daemon.save_pamac_config_finished.disconnect (on_save_pamac_config_finished);
pamac_config.reload ();
flags = (1 << 4); //Alpm.TransFlag.CASCADE
if (pamac_config.recurse) {
flags |= (1 << 5); //Alpm.TransFlag.RECURSE
}
#if DISABLE_AUR
write_pamac_config_finished (recurse, refresh_period, no_update_hide_icon);
save_pamac_config_finished (recurse, refresh_period, no_update_hide_icon);
#else
write_pamac_config_finished (recurse, refresh_period, no_update_hide_icon,
save_pamac_config_finished (recurse, refresh_period, no_update_hide_icon,
enable_aur, search_aur, aur_build_dir, check_aur_updates);
#endif
}