Fix paths for wihotspot_gui

This commit is contained in:
Lakindu Akash 2020-08-27 03:47:29 +05:30
parent ec6376bb12
commit e32ec4df77
6 changed files with 24 additions and 8 deletions

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.12)
project(wihotspot)
project(wihotspot_gui)
include(FindPkgConfig)
pkg_check_modules(GTK gtk+-3.0 REQUIRED)
@ -10,7 +10,7 @@ include_directories(${X11_INCLUDE_DIRS})
set(CMAKE_C_STANDARD 99)
set (CMAKE_CXX_STANDARD 11)
add_executable(wihotspot ui/main.c ui/h_prop.c ui/h_prop.h ui/ui.c ui/ui.h ui/read_config.cpp ui/read_config.h ui/util.c ui/util.h)
add_executable(wihotspot_gui ui/main.c ui/h_prop.c ui/h_prop.h ui/ui.c ui/ui.h ui/read_config.cpp ui/read_config.h ui/util.c ui/util.h)
target_link_libraries(${PROJECT_NAME} ${GTK_LIBRARIES} ${X11_LIBRARIES})
@ -42,12 +42,20 @@ add_custom_target(install_build
COMMAND install -Dm644 ${CMAKE_SOURCE_DIR}/desktop/wifihotspot.desktop $ENV{DESTDIR}${appdir}/applications/${PROJECT_NAME}.desktop
DEPENDS ${PROJECT_NAME}
COMMENT Installing files...
COMMENT Remove old files if exist
COMMAND rm -rf $ENV{DESTDIR}${appdir}/wihotspot
COMMAND rm -f $ENV{DESTDIR}${appdir}/applications/wihotspot.desktop
)
add_custom_target(uninstall_build
COMMAND rm -rf $ENV{DESTDIR}${appdir}/${PROJECT_NAME}
COMMAND rm -f $ENV{DESTDIR}${appbin}/${PROJECT_NAME}
COMMAND rm -f $ENV{DESTDIR}${appdir}/applications/${PROJECT_NAME}.desktop
COMMAND rm -f $ENV{DESTDIR}${appdir}/${PROJECT_NAME}/${PROJECT_NAME}.desktop
COMMAND rm -rf $ENV{DESTDIR}${appdir}/${PROJECT_NAME}
COMMENT Unstalling files...
COMMENT Remove old files if exist
COMMAND rm -rf $ENV{DESTDIR}${appdir}/wihotspot
COMMAND rm -f $ENV{DESTDIR}${appdir}/applications/wihotspot.desktop
)

View File

@ -1,7 +1,7 @@
[Desktop Entry]
Type=Application
Name=WifiHotspot
Icon=/usr/share/wihotspot/hotspot.png
Icon=/usr/share/wihotspot_gui/hotspot.png
Exec=sh -c 'env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/bin/wihotspot'
Terminal=false
Categories=System

View File

@ -12,6 +12,7 @@ install:
[ ! -d /lib/systemd/system ] || install -CDm644 create_ap.service $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
install -CDm644 bash_completion $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
install -CDm644 README.md $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
install -CDm755 wihotspot $(DESTDIR)$(BINDIR)/wihotspot
uninstall:
rm -f $(DESTDIR)$(BINDIR)/create_ap
@ -19,4 +20,5 @@ uninstall:
[ ! -f /lib/systemd/system/create_ap.service ] || rm -f $(DESTDIR)$(PREFIX)/lib/systemd/system/create_ap.service
rm -f $(DESTDIR)$(PREFIX)/share/bash-completion/completions/create_ap
rm -f $(DESTDIR)$(PREFIX)/share/doc/create_ap/README.md
rm -f /etc/sudoers.d/create_ap
rm -f /etc/sudoers.d/create_ap # For older versions
rm -f $(DESTDIR)$(BINDIR)/wihotspot

4
src/scripts/wihotspot Executable file
View File

@ -0,0 +1,4 @@
#!/bin/sh
# Start wihotspot_gui as root user
pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY /usr/bin/wihotspot_gui

View File

@ -184,7 +184,9 @@ const char* build_kill_create_ap_command(char* pid){
static int init_get_running(){
const char* cmd="sudo create_ap --list-running";
char cmd[BUFSIZE];
snprintf(cmd, BUFSIZE, "%s %s --list-running",SUDO, CREATE_AP);
FILE *fp;
if ((fp = popen(cmd, "r")) == NULL) {

View File

@ -148,7 +148,7 @@ static void loadStyles(){
const char *style_file;
const char* debug_style_file="glade/style.css";
const char* prod_style_file="/usr/share/wihotspot/glade/style.css";
const char* prod_style_file="/usr/share/wihotspot_gui/glade/style.css";
FILE *file;
@ -348,7 +348,7 @@ int initUi(int argc, char *argv[]){
// }
const char* debug_glade_file="glade/wifih.ui";
const char* prod_glade_file="/usr/share/wihotspot/glade/wifih.ui";
const char* prod_glade_file="/usr/share/wihotspot_gui/glade/wifih.ui";
FILE *file;
builder = gtk_builder_new();