From 19c97f4cceacfd5b5f0fdda26f9bc58f362b766f Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 22 Oct 2024 18:04:48 +0600 Subject: [PATCH] Added configuration mode only if app was launched without root --- source/ubinstall-gtk.c | 34 ++++++++++++++++++++++++++++++++-- source/ubinstall-gtk.h | 9 ++++++--- 2 files changed, 38 insertions(+), 5 deletions(-) diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index 937bb66..cb63ce5 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -854,8 +854,33 @@ void config_init(){ main_config.exit_accepted=0; } -void on_configuration_mode_switch(GtkWidget *self); -void on_configuration_mode_switch(GtkWidget *self){ +void on_root_get_root(char *argline); +void on_root_get_root(char *argline){ + yon_launch(argline); +} + +void on_configuration_mode_switch(GtkWidget *self,main_window *widgets); +void on_configuration_mode_switch(GtkWidget *self,main_window *widgets){ + if (getuid()) { + if (main_config.configure_mode==1){ + char *argline = LocaleName; + for (int i=1;iMainWindow); + } + } + } main_config.configure_mode = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(self)); } @@ -2568,6 +2593,9 @@ main_window *yon_main_window_complete(){ gtk_widget_set_sensitive(widgets->SaveLocalConfigurationMenuItem,0); gtk_widget_set_sensitive(widgets->SaveGlobalLocalConfigurationMenuItem,0); } + if (getuid()){ + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widgets->ConfigurationModeMenuItem),1); + } gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter),0); gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(widgets->LanguagesFilter)); @@ -2794,6 +2822,8 @@ int main(int argc, char *argv[]){ exit(0); } } + main_config.arg_size=argc; + main_config.arg_target=argv; if (getuid()!=0){ main_config.lock_load_global=1; diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index 480eb5a..9703cc1 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -35,9 +35,9 @@ #define LocalePath "/usr/share/locale" #define LocaleName "ubinstall-gtk" -#define clear_config_both_command "pkexec bash -c 'ubconfig remove TEMP_SECTION TEMP_PATAMETER '" -#define clear_config_global_command "pkexec bash -c 'ubconfig --target global remove TEMP_SECTION TEMP_PATAMETER '" -#define clear_config_local_command "pkexec bash -c 'ubconfig --target system remove TEMP_SECTION TEMP_PATAMETER '" +#define clear_config_both_command "ubconfig remove TEMP_SECTION TEMP_PATAMETER" +#define clear_config_global_command "ubconfig --target global remove TEMP_SECTION TEMP_PATAMETER" +#define clear_config_local_command "ubconfig --target system remove TEMP_SECTION TEMP_PATAMETER" #define regions_path "/com/ublinux/images/map-time-zone.png" #define keyboard_path "/com/ublinux/images/keyboard.png" @@ -215,6 +215,9 @@ typedef struct { int exit_accepted; GMutex progress_mutex; GMutex install_mutex; + + int arg_size; + config_str arg_target; } config; typedef struct {