forked from cromer/pamac-classic
customized builds
This commit is contained in:
3
src/pamac-manager/CMakeDepends.txt
Normal file
3
src/pamac-manager/CMakeDepends.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
add_dependencies(pamac-manager Pamac)
|
||||
include (InstallSymlink)
|
||||
install_symlink(pamac-manager ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/pamac-updater)
|
92
src/pamac-manager/CMakeLists.txt
Normal file
92
src/pamac-manager/CMakeLists.txt
Normal file
@@ -0,0 +1,92 @@
|
||||
### CMakeLists automatically created with AutoVala
|
||||
### Do not edit
|
||||
|
||||
set (DATADIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}")
|
||||
set (PKGDATADIR "${DATADIR}/pamac")
|
||||
set (GETTEXT_PACKAGE "pamac")
|
||||
set (RELEASE_NAME "pamac")
|
||||
set (CMAKE_C_FLAGS "")
|
||||
set (PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
set (VERSION "6.0.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.0.0")
|
||||
add_definitions (${DEPS_CFLAGS})
|
||||
include_directories ( ${CMAKE_BINARY_DIR}/src )
|
||||
link_libraries ( ${DEPS_LIBRARIES} -lPamac )
|
||||
link_directories ( ${DEPS_LIBRARY_DIRS} ${CMAKE_BINARY_DIR}/src )
|
||||
find_package (Vala REQUIRED)
|
||||
include (ValaVersion)
|
||||
ensure_vala_version ("0.38" MINIMUM)
|
||||
include (ValaPrecompile)
|
||||
|
||||
set (VALA_PACKAGES ${VALA_PACKAGES} gtk+-3.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)
|
||||
|
||||
set (APP_SOURCES ${APP_SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/Config.vala)
|
||||
set (APP_SOURCES ${APP_SOURCES} history_dialog.vala)
|
||||
set (APP_SOURCES ${APP_SOURCES} manager.vala)
|
||||
set (APP_SOURCES ${APP_SOURCES} manager_window.vala)
|
||||
|
||||
set (CUSTOM_VAPIS_LIST ${CUSTOM_VAPIS_LIST} ${CMAKE_BINARY_DIR}/src/Pamac.vapi)
|
||||
|
||||
if (DISABLE_AUR)
|
||||
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D DISABLE_AUR)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DDISABLE_AUR " )
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_AUR " )
|
||||
endif ()
|
||||
if (KDE_TRAY)
|
||||
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} -D KDE_TRAY)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DKDE_TRAY " )
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKDE_TRAY " )
|
||||
endif ()
|
||||
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --vapidir=${CMAKE_SOURCE_DIR}/src/vapis )
|
||||
|
||||
if ((${CMAKE_BUILD_TYPE} STREQUAL "Debug") OR (${CMAKE_BUILD_TYPE} STREQUAL "RelWithDebInfo"))
|
||||
set(COMPILE_OPTIONS ${COMPILE_OPTIONS} "-g")
|
||||
endif()
|
||||
|
||||
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --gresources=${CMAKE_SOURCE_DIR}/data/pamac.manager_no_aur.gresource.xml )
|
||||
set (COMPILE_OPTIONS ${COMPILE_OPTIONS} --gresources=${CMAKE_SOURCE_DIR}/data/pamac.manager.gresource.xml )
|
||||
|
||||
vala_precompile(VALA_C pamac-manager
|
||||
${APP_SOURCES}
|
||||
PACKAGES
|
||||
${VALA_PACKAGES}
|
||||
CUSTOM_VAPIS
|
||||
${CUSTOM_VAPIS_LIST}
|
||||
OPTIONS
|
||||
${COMPILE_OPTIONS}
|
||||
)
|
||||
|
||||
SET (VALA_C ${VALA_C} ${pamac_manager_gresource_xml_C_FILE})
|
||||
add_executable(pamac-manager ${VALA_C})
|
||||
add_dependencies (pamac-manager pamac_manager_gresource_xml)
|
||||
|
||||
|
||||
install(TARGETS
|
||||
pamac-manager
|
||||
RUNTIME DESTINATION
|
||||
${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
if(HAVE_VALADOC)
|
||||
valadoc(pamac-manager
|
||||
${CMAKE_BINARY_DIR}/valadoc/pamac-manager
|
||||
${APP_SOURCES}
|
||||
PACKAGES
|
||||
${VALA_PACKAGES}
|
||||
CUSTOM_VAPIS
|
||||
${CUSTOM_VAPIS_LIST}
|
||||
)
|
||||
install(DIRECTORY
|
||||
${CMAKE_BINARY_DIR}/valadoc
|
||||
DESTINATION
|
||||
${CMAKE_INSTALL_DATAROOTDIR}/doc/pamac
|
||||
)
|
||||
endif()
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeDepends.txt)
|
10
src/pamac-manager/Config.vala.base
Normal file
10
src/pamac-manager/Config.vala.base
Normal file
@@ -0,0 +1,10 @@
|
||||
namespace Constants {
|
||||
public const string DATADIR = "@DATADIR@";
|
||||
public const string PKGDATADIR = "@PKGDATADIR@";
|
||||
public const string GETTEXT_PACKAGE = "@GETTEXT_PACKAGE@";
|
||||
public const string RELEASE_NAME = "@RELEASE_NAME@";
|
||||
public const string VERSION = "@VERSION@";
|
||||
#if UNITEST
|
||||
public const string TESTSRCDIR = "@TESTSRCDIR@";
|
||||
#endif
|
||||
}
|
37
src/pamac-manager/history_dialog.vala
Normal file
37
src/pamac-manager/history_dialog.vala
Normal file
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* pamac-vala
|
||||
*
|
||||
* Copyright (C) 2017 Chris Cromer <cromer@cromnix.org>
|
||||
* Copyright (C) 2014-2017 Guillaume Benoit <guillaume@manjaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a get of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
//using GIO
|
||||
|
||||
namespace Pamac {
|
||||
|
||||
[GtkTemplate (ui = "/org/pamac/manager/interface/history_dialog.ui")]
|
||||
class HistoryDialog : Gtk.Dialog {
|
||||
|
||||
[GtkChild]
|
||||
public Gtk.TextView textview;
|
||||
|
||||
public HistoryDialog (Gtk.ApplicationWindow window) {
|
||||
int use_header_bar;
|
||||
Gtk.Settings.get_default ().get ("gtk-dialogs-use-header", out use_header_bar);
|
||||
Object (transient_for: window, use_header_bar: use_header_bar);
|
||||
}
|
||||
}
|
||||
}
|
115
src/pamac-manager/manager.vala
Normal file
115
src/pamac-manager/manager.vala
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* pamac-vala
|
||||
*
|
||||
* Copyright (C) 2017 Chris Cromer <cromer@cromnix.org>
|
||||
* Copyright (C) 2014-2017 Guillaume Benoit <guillaume@manjaro.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a get of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace Pamac {
|
||||
|
||||
class Manager : Gtk.Application {
|
||||
ManagerWindow manager_window;
|
||||
bool pamac_run;
|
||||
bool started;
|
||||
|
||||
public Manager () {
|
||||
application_id = "org.pamac.manager";
|
||||
flags = ApplicationFlags.HANDLES_COMMAND_LINE;
|
||||
}
|
||||
|
||||
public override void startup () {
|
||||
// i18n
|
||||
Intl.textdomain ("pamac");
|
||||
Intl.setlocale (LocaleCategory.ALL, "");
|
||||
|
||||
base.startup ();
|
||||
|
||||
pamac_run = check_pamac_running ();
|
||||
if (pamac_run) {
|
||||
var msg = new Gtk.MessageDialog (null,
|
||||
Gtk.DialogFlags.MODAL,
|
||||
Gtk.MessageType.ERROR,
|
||||
Gtk.ButtonsType.OK,
|
||||
dgettext (null, "Pamac is already running"));
|
||||
msg.run ();
|
||||
msg.destroy ();
|
||||
} else {
|
||||
manager_window = new ManagerWindow (this);
|
||||
// quit accel
|
||||
var action = new SimpleAction ("quit", null);
|
||||
action.activate.connect (() => {this.quit ();});
|
||||
this.add_action (action);
|
||||
string[] accels = {"<Ctrl>Q", "<Ctrl>W"};
|
||||
this.set_accels_for_action ("app.quit", accels);
|
||||
// back accel
|
||||
action = new SimpleAction ("back", null);
|
||||
action.activate.connect (() => {manager_window.on_button_back_clicked ();});
|
||||
this.add_action (action);
|
||||
accels = {"<Alt>Left"};
|
||||
this.set_accels_for_action ("app.back", accels);
|
||||
// search accel
|
||||
action = new SimpleAction ("search", null);
|
||||
action.activate.connect (() => {manager_window.filters_stack.visible_child_name = "search";});
|
||||
this.add_action (action);
|
||||
accels = {"<Ctrl>F"};
|
||||
this.set_accels_for_action ("app.search", accels);
|
||||
}
|
||||
}
|
||||
|
||||
public override int command_line (ApplicationCommandLine cmd) {
|
||||
if (cmd.get_arguments ()[0] == "pamac-updater") {
|
||||
manager_window.display_package_queue.clear ();
|
||||
manager_window.main_stack.visible_child_name = "browse";
|
||||
manager_window.filters_stack.visible_child_name = "updates";
|
||||
} else if (!started) {
|
||||
manager_window.show_default_pkgs ();
|
||||
started = true;
|
||||
}
|
||||
if (!pamac_run) {
|
||||
manager_window.present ();
|
||||
while (Gtk.events_pending ()) {
|
||||
Gtk.main_iteration ();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void shutdown () {
|
||||
base.shutdown ();
|
||||
if (!pamac_run) {
|
||||
manager_window.transaction.stop_daemon ();
|
||||
}
|
||||
}
|
||||
|
||||
bool check_pamac_running () {
|
||||
Application app;
|
||||
bool run = false;
|
||||
app = new Application ("org.pamac.installer", 0);
|
||||
try {
|
||||
app.register ();
|
||||
} catch (GLib.Error e) {
|
||||
stderr.printf ("%s\n", e.message);
|
||||
}
|
||||
run = app.get_is_remote ();
|
||||
return run;
|
||||
}
|
||||
}
|
||||
|
||||
static int main (string[] args) {
|
||||
var manager = new Manager ();
|
||||
return manager.run (args);
|
||||
}
|
||||
}
|
2193
src/pamac-manager/manager_window.vala
Normal file
2193
src/pamac-manager/manager_window.vala
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user