From aeb9bbb0a207367e2b7caf899fe96d6c55048083 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 5 Sep 2023 09:44:09 +0600 Subject: [PATCH 01/13] test fix for crash at desktop files loading --- source/ubl-utils.c | 102 +++++++++++++++++++++++---------------------- 1 file changed, 52 insertions(+), 50 deletions(-) diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 0225c16..8bbf012 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -904,57 +904,58 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef) if (err) { printf("%s\n", err->message); - } - if (strcmp(Type, "Application") == 0) - tempapp.Type = 1; - else if (strcmp(Type, "pyApplication") == 0) - tempapp.Type = 2; - else - continue; - tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL); - if (tempapp.Name == NULL) - continue; - tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL); - if (tempapp.Categories == NULL) - continue; - tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL); - if (tempapp.Exec == NULL) - continue; - tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL); - if (tempapp.Icon == NULL) - continue; - tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL); - if (!tempapp.Pluggable) - tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL); - if (tempapp.Pluggable) - tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL); - if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0) - if (size == 0) - { - applist = (apps *)malloc(size + 1 * sizeof(apps)); - applist[0].filename = yon_char_new(path); - applist[0].Name = yon_char_new(tempapp.Name); - applist[0].Categories = yon_char_new(tempapp.Categories); - applist[0].Exec = yon_char_new(tempapp.Exec); - applist[0].Icon = yon_char_new(tempapp.Icon); - applist[0].Type = tempapp.Type; - applist[0].Pluggable = tempapp.Pluggable; - applist[0].DualPluggable = tempapp.DualPluggable; - size++; - } + } else { + if (strcmp(Type, "Application") == 0) + tempapp.Type = 1; + else if (strcmp(Type, "pyApplication") == 0) + tempapp.Type = 2; else - { - applist = (apps *)realloc(applist, (size + 1) * sizeof(apps)); - applist[size].filename = yon_char_new(path); - applist[size].Name = yon_char_new(tempapp.Name); - applist[size].Categories = yon_char_new(tempapp.Categories); - applist[size].Exec = yon_char_new(tempapp.Exec); - applist[size].Icon = yon_char_new(tempapp.Icon); - applist[size].Pluggable = tempapp.Pluggable; - applist[size].DualPluggable = tempapp.DualPluggable; - applist[size].Type = tempapp.Type; - size++; - } + continue; + tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL); + if (tempapp.Name == NULL) + continue; + tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL); + if (tempapp.Categories == NULL) + continue; + tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL); + if (tempapp.Exec == NULL) + continue; + tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL); + if (tempapp.Icon == NULL) + continue; + tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL); + if (!tempapp.Pluggable) + tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL); + if (tempapp.Pluggable) + tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL); + if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0) + if (size == 0) + { + applist = (apps *)malloc(size + 1 * sizeof(apps)); + applist[0].filename = yon_char_new(path); + applist[0].Name = yon_char_new(tempapp.Name); + applist[0].Categories = yon_char_new(tempapp.Categories); + applist[0].Exec = yon_char_new(tempapp.Exec); + applist[0].Icon = yon_char_new(tempapp.Icon); + applist[0].Type = tempapp.Type; + applist[0].Pluggable = tempapp.Pluggable; + applist[0].DualPluggable = tempapp.DualPluggable; + size++; + } + else + { + applist = (apps *)realloc(applist, (size + 1) * sizeof(apps)); + applist[size].filename = yon_char_new(path); + applist[size].Name = yon_char_new(tempapp.Name); + applist[size].Categories = yon_char_new(tempapp.Categories); + applist[size].Exec = yon_char_new(tempapp.Exec); + applist[size].Icon = yon_char_new(tempapp.Icon); + applist[size].Pluggable = tempapp.Pluggable; + applist[size].DualPluggable = tempapp.DualPluggable; + applist[size].Type = tempapp.Type; + size++; + } + } } } } @@ -1026,6 +1027,7 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte g_object_ref(box); gtk_container_remove(GTK_CONTAINER(window),box); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,1,1,5); + (gtk_dialog_get_content_area(GTK_DIALOG(dialog)),0); GtkWidget *main_tree = GTK_WIDGET(gtk_builder_get_object(builder,"MainTree")); GtkTreeStore *store = GTK_TREE_STORE(gtk_builder_get_object(builder,"treestore1")); va_list args; From 612baa543b5ea30754d0db1d445c769f2ae41680 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 5 Sep 2023 12:14:24 +0600 Subject: [PATCH 02/13] Hat visual height srinked by recoloring box background --- source/ubl-utils.c | 46 ++++++++++++++++++++++++++++++++++++++- source/ubl-utils.h | 3 +++ ublexec-application.glade | 4 +++- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 8bbf012..c444022 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -876,6 +876,46 @@ config_str yon_ubl_get_all_slices(int *slices_size){ // parsing functions +dictionary *yon_scan_desktops(){ + dictionary *apps_dict = NULL; + DIR *directory = opendir(DesktopPath); + struct dirent *de; + while ((de = readdir(directory))) + { + FILE *file; + char *path = yon_char_append(DesktopPath, de->d_name); + file = fopen(path, "r"); + if (strstr(path,".desktop")){ + apps *application = malloc(sizeof(apps)); + GKeyFile *gfile = g_key_file_new(); + GError *err = NULL; + if (!access(path,F_OK)){ + g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, NULL); + application->Type = !strcmp(g_key_file_get_string(gfile, "Desktop Entry", "Type", &err),"Application") ? 1 : 0; + if (application->Type){ + application->Name = g_key_file_get_locale_string(gfile,"Desktop Entry", "Name",setlocale(LC_ALL, NULL),&err); + application->Categories = g_key_file_get_string(gfile,"Desktop Entry", "Categories",&err); + application->Exec = g_key_file_get_string(gfile,"Desktop Entry", "Exec",&err); + application->Icon = g_key_file_get_string(gfile,"Desktop Entry", "Icon",&err); + application->Pluggable = (g_key_file_get_boolean(gfile,"Desktop Entry", "Pluggable",NULL)|| + g_key_file_get_boolean(gfile,"Desktop Entry", "X-XfcePluggable",&err)); + application->DualPluggable = g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBLPluggable",NULL); + application->Hidden = g_key_file_get_boolean(gfile,"Desktop Entry", "X-X-UBL-SettingsManager-Hidden",NULL); + if (application->Name&&application->Exec){ + if (!apps_dict){ + yon_dictionary_add_or_create_if_exists_with_data(apps_dict,application->Name,application); + } else if (!yon_dictionary_get(&apps_dict,application->Name)){ + yon_dictionary_add_or_create_if_exists_with_data(apps_dict,application->Name,application); + } else { + yon_dictionary_set_data(apps_dict,application); + } + } + } + } + } + } + if (apps_dict) return apps_dict; +} apps *yon_apps_scan_and_parse_desktops(int *sizef) { @@ -956,6 +996,7 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef) size++; } } + g_key_file_free(gfile); } } } @@ -1004,6 +1045,9 @@ void __yon_on_app_chooser_selection(GtkTreeView *self, GtkTreeStore *store){ if (gtk_tree_model_iter_nth_child(model,&parentiter,&iter,0)) gtk_tree_selection_select_iter(gtk_tree_view_get_selection(self),&parentiter); } + } else { + gtk_tree_model_get_iter_first(model,&iter); + gtk_tree_selection_select_iter(gtk_tree_view_get_selection(self),&iter); } } @@ -1027,7 +1071,7 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte g_object_ref(box); gtk_container_remove(GTK_CONTAINER(window),box); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,1,1,5); - (gtk_dialog_get_content_area(GTK_DIALOG(dialog)),0); + gtk_style_context_add_class(gtk_widget_get_style_context(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),"workingbg"); GtkWidget *main_tree = GTK_WIDGET(gtk_builder_get_object(builder,"MainTree")); GtkTreeStore *store = GTK_TREE_STORE(gtk_builder_get_object(builder,"treestore1")); va_list args; diff --git a/source/ubl-utils.h b/source/ubl-utils.h index 7d05925..01c1f9d 100644 --- a/source/ubl-utils.h +++ b/source/ubl-utils.h @@ -73,6 +73,7 @@ typedef struct apps char *Icon; int Pluggable; int DualPluggable; + int Hidden; } apps; typedef char** config_str; @@ -188,6 +189,8 @@ config_str yon_ubl_get_all_slices(int *slices_size); config_str philos_list_user(int* size); +dictionary *yon_scan_desktops(); + apps *yon_apps_scan_and_parse_desktops(int *sizef); void yon_apps_sort(apps *applist, int size); diff --git a/ublexec-application.glade b/ublexec-application.glade index cae39b8..d6e2ca2 100644 --- a/ublexec-application.glade +++ b/ublexec-application.glade @@ -27,7 +27,6 @@ True True - in True @@ -35,6 +34,9 @@ treestore1 False treeviewcolumn1 + + + column From 8195d8d67ac980058cf38546b8e9bf33a97a4375 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 5 Sep 2023 15:44:33 +0600 Subject: [PATCH 03/13] Fixed repeated icons --- source/ubl-utils.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/ubl-utils.c b/source/ubl-utils.c index c444022..7e3a35e 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -1100,8 +1100,14 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte gtk_tree_model_get(GTK_TREE_MODEL(store),&iter,2,&cur_categories,-1); for (int i=0; i0&&strcmp(app_list[i].Name,app_list[i-1].Name)){ + if (strstr(app_list[i].Icon,"/")){ + yon_char_divide(app_list[i].Icon,yon_char_find_last(app_list[i].Icon,'/')); + app_list[i].Icon = yon_char_divide(app_list[i].Icon,yon_char_find_last(app_list[i].Icon,'.')); + } + gtk_tree_store_append(store,&childiter,&iter); + gtk_tree_store_set(store,&childiter,0,app_list[i].Icon, 1,app_list[i].Name, 2, app_list[i].filename, -1); + } } } } @@ -1116,9 +1122,11 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte gtk_widget_destroy(dialog); return path; } + } else { + gtk_widget_destroy(dialog); } } else { - yon_subwindow_close(box); + gtk_widget_destroy(dialog); } } From 3273b0b0712a6b45c1a710888854a30f6c5a2f2f Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 5 Sep 2023 16:29:10 +0600 Subject: [PATCH 04/13] Changed titlebar from standard to GTK's --- source/ubl-utils.c | 2 ++ ublexec-application.glade | 49 ++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 7e3a35e..fadaadc 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -1068,6 +1068,8 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte gtk_dialog_add_buttons(GTK_DIALOG(dialog),_("Cancel"),0,_("Accept"),1,NULL); GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"ApplicationsWindow")); GtkWidget *box = GTK_WIDGET(gtk_builder_get_object(builder,"box")); + GtkWidget *header = GTK_WIDGET(gtk_builder_get_object(builder,"ApplicationsHeaderBar")); + gtk_window_set_titlebar(GTK_WINDOW(dialog),header); g_object_ref(box); gtk_container_remove(GTK_CONTAINER(window),box); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,1,1,5); diff --git a/ublexec-application.glade b/ublexec-application.glade index d6e2ca2..e248387 100644 --- a/ublexec-application.glade +++ b/ublexec-application.glade @@ -2,6 +2,30 @@ + + True + False + True + + + True + False + center + Applications + + + + + + + + True + False + 32 + com.ublinux.ublexec + + + @@ -68,30 +92,7 @@ - - True - False - True - - - True - False - center - Applications - - - - - - - - True - False - 32 - com.ublinux.ublexec - - - + From e9088e344a6d17afe5c497ff98179fea49a50fff Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 5 Sep 2023 16:36:58 +0600 Subject: [PATCH 05/13] When target is unselected, command will disappear --- source/ubl-utils.c | 1 + source/ublexec.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/source/ubl-utils.c b/source/ubl-utils.c index fadaadc..20ac0bb 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -1126,6 +1126,7 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte } } else { gtk_widget_destroy(dialog); + return ""; } } else { gtk_widget_destroy(dialog); diff --git a/source/ublexec.c b/source/ublexec.c index e98879f..3de1052 100644 --- a/source/ublexec.c +++ b/source/ublexec.c @@ -196,6 +196,9 @@ void on_setup_command(GtkWidget *self, main_window *widgets){ gtk_entry_set_text(GTK_ENTRY(widgets->commandEntry),final_command); free(final_command); } + else { + gtk_entry_set_text(GTK_ENTRY(widgets->commandEntry),""); + } } void on_command_run(GtkWidget *self, main_window *widgets){ From a001eeaa4c8baf3e8adeb5480731d2ecfb1fe807 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 8 Sep 2023 11:46:32 +0600 Subject: [PATCH 06/13] Main window minimum height has been reduced --- source/ubl-utils.c | 1 + ublexec.glade | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 20ac0bb..91a3463 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -1069,6 +1069,7 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"ApplicationsWindow")); GtkWidget *box = GTK_WIDGET(gtk_builder_get_object(builder,"box")); GtkWidget *header = GTK_WIDGET(gtk_builder_get_object(builder,"ApplicationsHeaderBar")); + gtk_window_set_title(GTK_WINDOW(dialog),_("Application")); gtk_window_set_titlebar(GTK_WINDOW(dialog),header); g_object_ref(box); gtk_container_remove(GTK_CONTAINER(window),box); diff --git a/ublexec.glade b/ublexec.glade index 8f2f5a9..b41e923 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -406,7 +406,7 @@ translated and supported by community. 800 - 600 + 545 False com.ublinux.ublexec @@ -549,7 +549,6 @@ translated and supported by community. True File view end - 5 True From dae297759ed1e84fe75c14a84eb91d250c0a0c68 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 11 Sep 2023 09:13:08 +0600 Subject: [PATCH 07/13] Added separator to application window --- ublexec-application.glade | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ublexec-application.glade b/ublexec-application.glade index e248387..143fe08 100644 --- a/ublexec-application.glade +++ b/ublexec-application.glade @@ -89,10 +89,19 @@ 0 + + + True + False + vertical + + + False + True + 1 + + - - - From 69906a77cd2354012192500f06a2eb8fd35a0965 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 11 Sep 2023 10:41:38 +0600 Subject: [PATCH 08/13] Fixes --- source/ublexec.c | 36 +++++++++++++++++----- source/ublexec.h | 5 ++- ublexec.css | 48 ++++++++++++++++++++++++++++- ublexec.glade | 80 +++++++++++++++++++++++++++++++++++++++++------- 4 files changed, 149 insertions(+), 20 deletions(-) diff --git a/source/ublexec.c b/source/ublexec.c index 3de1052..087a102 100644 --- a/source/ublexec.c +++ b/source/ublexec.c @@ -123,7 +123,7 @@ void on_application_chooser_open(GtkWidget *self, main_window *widgets){ } void on_user_changed(GtkWidget *self, main_window *widgets){ - GtkAdjustment *adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->prioritySpin)); + GtkAdjustment *adj = gtk_range_get_adjustment(GTK_RANGE(widgets->priorityScale)); if (gtk_combo_box_get_active(GTK_COMBO_BOX(self))==0){ gtk_adjustment_set_lower(adj,-20); gtk_label_set_text(GTK_LABEL(widgets->highestPriorityLabel),PRIORITY_ROOT_LABEL); @@ -151,7 +151,7 @@ void on_user_activate(GtkToggleButton *self, main_window *widgets){ } void on_user_switching(GtkToggleButton *self, main_window *widgets){ - GtkAdjustment *adj = gtk_spin_button_get_adjustment(GTK_SPIN_BUTTON(widgets->prioritySpin)); + GtkAdjustment *adj = gtk_range_get_adjustment(GTK_RANGE(widgets->priorityScale)); if (gtk_toggle_button_get_active(self)){ if (!gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->runWithUserCombo))){ gtk_adjustment_set_lower(adj,-20); @@ -180,7 +180,7 @@ void on_setup_command(GtkWidget *self, main_window *widgets){ int su_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithUserSuCheck)); int sudo_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithUserSudoCheck)); int priority_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->priorityCheck)); - char *priority = priority_check ? yon_char_append(" --priority=",yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->prioritySpin)))) : ""; + char *priority = priority_check ? yon_char_append(" --priority=",yon_char_from_long(gtk_adjustment_get_value(gtk_range_get_adjustment(GTK_RANGE(widgets->priorityScale))))) : ""; int size; char *command = yon_char_unite(get_run_command_command, " -o", terminal_check ? yon_char_append(" --terminal=", terminal->name_simple) : "", @@ -219,7 +219,7 @@ void on_command_run(GtkWidget *self, main_window *widgets){ int su_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithUserSuCheck)); int sudo_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->runWithUserSudoCheck)); int priority_check = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widgets->priorityCheck)); - char *priority = priority_check ? yon_char_append(" --priority=",yon_char_from_long(gtk_spin_button_get_value(GTK_SPIN_BUTTON(widgets->prioritySpin)))) : ""; + char *priority = priority_check ? yon_char_append(" --priority=",yon_char_from_long(gtk_adjustment_get_value(gtk_range_get_adjustment(GTK_RANGE(widgets->priorityScale))))) : ""; int size; char *command = yon_char_unite(get_run_command_command, terminal_check ? yon_char_append(" --terminal=", terminal->name_simple) : "", @@ -254,6 +254,22 @@ void config_init(){ main_config.lock_save_local=0; } +void on_adjustment_changed(GtkAdjustment *self, main_window *widgets){ + gtk_entry_set_text(GTK_ENTRY(widgets->prioritySpinEntry),yon_char_from_long(gtk_adjustment_get_value(self))); +} + +void on_adjustment_increase(GtkWidget *self, main_window *widgets) { + long current = gtk_adjustment_get_value(gtk_range_get_adjustment(GTK_RANGE(widgets->priorityScale))); + current ++; + gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(widgets->priorityScale)),current); +} + +void on_adjustment_decrease(GtkWidget *self, main_window *widgets) { + long current = gtk_adjustment_get_value(gtk_range_get_adjustment(GTK_RANGE(widgets->priorityScale))); + current --; + gtk_adjustment_set_value(gtk_range_get_adjustment(GTK_RANGE(widgets->priorityScale)),current); +} + main_window *setup_window(){ /* Widgets getting | Получение виджетов */ main_window *widgets = malloc(sizeof(main_window)); @@ -279,7 +295,9 @@ main_window *setup_window(){ widgets->priorityCheck = yon_gtk_builder_get_widget(builder,"priorityCheck"); widgets->priorityScale = yon_gtk_builder_get_widget(builder,"priorityScale"); - widgets->prioritySpin = yon_gtk_builder_get_widget(builder,"prioritySpin"); + widgets->prioritySpinEntry = yon_gtk_builder_get_widget(builder,"prioritySpinEntry"); + widgets->prioritySpinIncreaseButton = yon_gtk_builder_get_widget(builder,"prioritySpinIncreaseButton"); + widgets->prioritySpinDecreaseButton = yon_gtk_builder_get_widget(builder,"prioritySpinDecreaseButton"); widgets->highestPriorityLabel = yon_gtk_builder_get_widget(builder,"highestPriorityLabel"); widgets->commandCheck = yon_gtk_builder_get_widget(builder,"commandCheck"); @@ -311,7 +329,7 @@ main_window *setup_window(){ g_signal_connect(G_OBJECT(widgets->chooseDesktopButton),"clicked",G_CALLBACK(on_application_chooser_open),widgets); g_signal_connect(G_OBJECT(widgets->priorityCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->priorityScale); - g_signal_connect(G_OBJECT(widgets->priorityCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->prioritySpin); + g_signal_connect(G_OBJECT(widgets->priorityCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),gtk_widget_get_parent(widgets->prioritySpinEntry)); g_signal_connect(G_OBJECT(widgets->runWithUserCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->runWithUserPkexecCheck); g_signal_connect(G_OBJECT(widgets->runWithUserCheck),"toggled",G_CALLBACK(yon_gtk_widget_set_sensitive_from_toggle_button),widgets->runWithUserSuCheck); @@ -339,8 +357,12 @@ main_window *setup_window(){ g_signal_connect(G_OBJECT(widgets->priorityCheck),"toggled",G_CALLBACK(on_setup_command),widgets); g_signal_connect(G_OBJECT(widgets->priorityScale),"value-changed",G_CALLBACK(on_setup_command),widgets); + g_signal_connect(G_OBJECT(widgets->prioritySpinIncreaseButton),"clicked",G_CALLBACK(on_adjustment_increase),widgets); + g_signal_connect(G_OBJECT(widgets->prioritySpinDecreaseButton),"clicked",G_CALLBACK(on_adjustment_decrease),widgets); + + g_signal_connect(G_OBJECT(gtk_range_get_adjustment(GTK_RANGE(widgets->priorityScale))),"value-changed",G_CALLBACK(on_adjustment_changed),widgets); + g_signal_connect(G_OBJECT(widgets->runButton),"clicked",G_CALLBACK(on_command_run),widgets); - int size; gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widgets->runWithUserCombo),"root"); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->runWithUserCombo),0); diff --git a/source/ublexec.h b/source/ublexec.h index 88d1603..f8e8072 100644 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -1,5 +1,6 @@ #include #include +#include #include "ubl-utils.h" #include #include @@ -97,7 +98,9 @@ typedef struct { GtkWidget *runWithUserCombo; GtkWidget *priorityCheck; GtkWidget *priorityScale; - GtkWidget *prioritySpin; + GtkWidget *prioritySpinEntry; + GtkWidget *prioritySpinIncreaseButton; + GtkWidget *prioritySpinDecreaseButton; GtkWidget *highestPriorityLabel; GtkWidget *commandCheck; diff --git a/ublexec.css b/ublexec.css index f8f987c..87942db 100644 --- a/ublexec.css +++ b/ublexec.css @@ -2,22 +2,27 @@ text-shadow: 2px 2px @theme_bg_color; color: @theme_text_color; } + .thin { margin:0px; padding:0px; } + .bannerbackground { background-color: #404040; } + .view_app { background-color: @theme_bg_color; } + .view_app.view.cell:selected { background-color:@theme_selected_bg_color; color:@theme_selected_text_color; transition: 10ms ease-out; border-radius: 3px; } + .boxInfoMessError{ background-color: #ea9999; } @@ -25,6 +30,7 @@ .boxInfoMessOK{ background-color: #f3f0ac; } + #GnomeIcon{ border-style:solid; border-bottom-width: 1px; @@ -39,28 +45,34 @@ #iconlabel { font-size:14px; font-weight: bold; - } + .roundborder * { border-width:0px; border-radius:5px; } + .noborder { border: none; } + .menu:hover { border-color:alpha(@theme_text_color, 0.01); } + .menu { border-color:alpha(@theme_text_color, 0.01); } + .menu:hover >* { border-color:alpha(@theme_text_color, 0.01); } + .menuitembottom{ margin-top:0px; margin-bottom:3px; } + .menuitemmiddle{ margin-top:0px; margin-bottom:0px; @@ -69,30 +81,36 @@ .menuitemtop{ margin-bottom:0px; } + .menuitemtop *{ margin:2px 2px 0 2px; padding: 5px 10px 3px 5px; } + .menuitemmiddle *{ margin:0 2px 0 2px; padding: 3px 10px 3px 5px; } + .menuitembottom *{ margin:0 2px 2px 2px; padding: 3px 10px 5px 5px; } + .menuitemtop:hover { background:@theme_bg_color; border-color:inherit; border-left-width:inherit; border-right-width:inherit; } + .menuitemmiddle:hover { background:@theme_bg_color; border-color:inherit; border-left-width:inherit; border-right-width:inherit; } + .menuitembottom:hover { background:@theme_bg_color; border-color:inherit; @@ -100,18 +118,21 @@ border-right-width:inherit; } + .menuitemtop:hover* { margin:2px 2px 0 2px; padding: 5px 10px 3px 5px; background:@theme_selected_bg_color; border-radius:2px; } + .menuitemmiddle:hover* { margin:0 2px 0 2px; padding: 3px 10px 3px 5px; background:@theme_selected_bg_color; border-radius:2px; } + .menuitembottom:hover* { margin:0 2px 2px 2px; padding: 3px 10px 5px 5px; @@ -122,18 +143,22 @@ .workingbg, #workingbg { background-color:@theme_base_color; } + .workingbg.view.cell:selected { background-color:@theme_selected_bg_color; } + .workingbg.view.cell:hover { background-color:darker(@theme_selected_bg_color); color:@theme_selected_text_color; border-radius:3px; } + .bkim { transition: 200ms ease-out; background-image: none; } + .noborder{ border:none; } @@ -156,22 +181,43 @@ opacity:0.99; border-left-width:inherit; border-right-width:inherit; } + .aaa *{ margin:0 2px 0 2px; padding-top: 3px; padding-bottom:3px; border:transparent; } + .aaa:hover { background:@theme_bg_color; border-color:inherit; border-left-width:inherit; border-right-width:inherit; } + .aaa:hover * { margin:0 2px 0 2px; padding-top: 3px; padding-bottom:3px; background:@theme_selected_bg_color; border-radius:2px; +} + +.flatborders { + border-radius: 0px; +} + +.flatbordersleft { + border-top-left-radius: 0px; + border-bottom-left-radius: 0px; +} + +.flatbordersright { + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; +} + +.noleftborder { + border-left: 0px; } \ No newline at end of file diff --git a/ublexec.glade b/ublexec.glade index b41e923..c455f4f 100644 --- a/ublexec.glade +++ b/ublexec.glade @@ -67,6 +67,7 @@ + 19 1 @@ -380,6 +381,16 @@ translated and supported by community. False media-playback-start-symbolic + + True + False + value-decrease-symbolic + + + True + False + value-increase-symbolic + @@ -941,18 +952,69 @@ translated and supported by community. - + True False - True + False center - adjustment1 - True + + + True + True + center + 4 + 2 + 0 + digits + + + + False + True + 0 + + + + + True + True + True + image3 + + + + False + True + 1 + + + + + True + True + True + image2 + + + + False + True + 2 + + False True - 2 + 3 @@ -1156,6 +1218,8 @@ translated and supported by community. True False + 5 + 5 32 com.ublinux.ublexec @@ -1192,12 +1256,6 @@ translated and supported by community. - - - - - - 800 600 From 61390454fdd994d2496ea65225ffab0ca637d942 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 11 Sep 2023 11:00:29 +0600 Subject: [PATCH 09/13] Test fix for application window --- source/ubl-utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 91a3463..098e594 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -911,6 +911,8 @@ dictionary *yon_scan_desktops(){ } } } + g_key_file_free(gfile); + gfile = g_key_file_new(); } } } From 9a8c54c0a8fb3c568accfce8f7021449572640a7 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 11 Sep 2023 15:43:22 +0600 Subject: [PATCH 10/13] Fixed crash while re-opening application window --- source/ubl-utils.c | 118 +++++++++++++++++++++++---------------------- source/ublexec.h | 0 2 files changed, 61 insertions(+), 57 deletions(-) mode change 100644 => 100755 source/ublexec.h diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 098e594..5812abe 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -918,7 +918,7 @@ dictionary *yon_scan_desktops(){ } if (apps_dict) return apps_dict; } - +static apps *scanned_application = NULL; apps *yon_apps_scan_and_parse_desktops(int *sizef) { int size = 0; @@ -941,63 +941,66 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef) apps tempapp; GKeyFile *gfile = g_key_file_new(); GError *err = NULL; - g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, NULL); - char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", &err); - if (err) - { - printf("%s\n", err->message); - } else { - if (strcmp(Type, "Application") == 0) - tempapp.Type = 1; - else if (strcmp(Type, "pyApplication") == 0) - tempapp.Type = 2; - else - continue; - tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL); - if (tempapp.Name == NULL) - continue; - tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL); - if (tempapp.Categories == NULL) - continue; - tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL); - if (tempapp.Exec == NULL) - continue; - tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL); - if (tempapp.Icon == NULL) - continue; - tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL); - if (!tempapp.Pluggable) - tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL); - if (tempapp.Pluggable) - tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL); - if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0) - if (size == 0) - { - applist = (apps *)malloc(size + 1 * sizeof(apps)); - applist[0].filename = yon_char_new(path); - applist[0].Name = yon_char_new(tempapp.Name); - applist[0].Categories = yon_char_new(tempapp.Categories); - applist[0].Exec = yon_char_new(tempapp.Exec); - applist[0].Icon = yon_char_new(tempapp.Icon); - applist[0].Type = tempapp.Type; - applist[0].Pluggable = tempapp.Pluggable; - applist[0].DualPluggable = tempapp.DualPluggable; - size++; - } + g_key_file_load_from_file(gfile, path, G_KEY_FILE_KEEP_TRANSLATIONS, &err); + if (!err){ + char *Type = g_key_file_get_string(gfile, "Desktop Entry", "Type", &err); + if (err) + { + printf("%s\n", err->message); + } else { + if (strcmp(Type, "Application") == 0) + tempapp.Type = 1; + else if (strcmp(Type, "pyApplication") == 0) + tempapp.Type = 2; else - { - applist = (apps *)realloc(applist, (size + 1) * sizeof(apps)); - applist[size].filename = yon_char_new(path); - applist[size].Name = yon_char_new(tempapp.Name); - applist[size].Categories = yon_char_new(tempapp.Categories); - applist[size].Exec = yon_char_new(tempapp.Exec); - applist[size].Icon = yon_char_new(tempapp.Icon); - applist[size].Pluggable = tempapp.Pluggable; - applist[size].DualPluggable = tempapp.DualPluggable; - applist[size].Type = tempapp.Type; - size++; - } + continue; + tempapp.Name = g_key_file_get_locale_string(gfile, "Desktop Entry", "Name", setlocale(LC_ALL, NULL), NULL); + if (tempapp.Name == NULL) + continue; + tempapp.Categories = g_key_file_get_string(gfile, "Desktop Entry", "Categories", NULL); + if (tempapp.Categories == NULL) + continue; + tempapp.Exec = g_key_file_get_string(gfile, "Desktop Entry", "Exec", NULL); + if (tempapp.Exec == NULL) + continue; + tempapp.Icon = g_key_file_get_string(gfile, "Desktop Entry", "Icon", NULL); + if (tempapp.Icon == NULL) + continue; + tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "Pluggable", NULL); + if (!tempapp.Pluggable) + tempapp.Pluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-XfcePluggable", NULL); + if (tempapp.Pluggable) + tempapp.DualPluggable = g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBLPluggable", NULL); + if (g_key_file_get_boolean(gfile, "Desktop Entry", "X-UBL-SettingsManager-Hidden", NULL) == 0) + if (size == 0) + { + applist = (apps *)malloc(size + 1 * sizeof(apps)); + applist[0].filename = yon_char_new(path); + applist[0].Name = yon_char_new(tempapp.Name); + applist[0].Categories = yon_char_new(tempapp.Categories); + applist[0].Exec = yon_char_new(tempapp.Exec); + applist[0].Icon = yon_char_new(tempapp.Icon); + applist[0].Type = tempapp.Type; + applist[0].Pluggable = tempapp.Pluggable; + applist[0].DualPluggable = tempapp.DualPluggable; + size++; + } + else + { + applist = (apps *)realloc(applist, (size + 1) * sizeof(apps)); + applist[size].filename = yon_char_new(path); + applist[size].Name = yon_char_new(tempapp.Name); + applist[size].Categories = yon_char_new(tempapp.Categories); + applist[size].Exec = yon_char_new(tempapp.Exec); + applist[size].Icon = yon_char_new(tempapp.Icon); + applist[size].Pluggable = tempapp.Pluggable; + applist[size].DualPluggable = tempapp.DualPluggable; + applist[size].Type = tempapp.Type; + size++; + } + } } + g_key_file_free(gfile); } } @@ -1005,6 +1008,7 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef) } } *sizef = size; + scanned_application = applist; return applist; }; @@ -1098,7 +1102,7 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte } va_end(args); int size; - apps *app_list = yon_apps_scan_and_parse_desktops(&size); + apps *app_list = scanned_application ? scanned_application : yon_apps_scan_and_parse_desktops(&size); int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store),&iter); for (; valid; valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store),&iter)){ char *cur_categories; diff --git a/source/ublexec.h b/source/ublexec.h old mode 100644 new mode 100755 From bdab0eb747bdf03afc8d5e097e2f33adc3af80ba Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 11 Sep 2023 17:29:40 +0600 Subject: [PATCH 11/13] Fixed a bug, causing crash while opening applications window --- source/ubl-utils.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/ubl-utils.c b/source/ubl-utils.c index 5812abe..ab582b2 100644 --- a/source/ubl-utils.c +++ b/source/ubl-utils.c @@ -918,6 +918,8 @@ dictionary *yon_scan_desktops(){ } if (apps_dict) return apps_dict; } + +static int scanned_size=0; static apps *scanned_application = NULL; apps *yon_apps_scan_and_parse_desktops(int *sizef) { @@ -1009,6 +1011,7 @@ apps *yon_apps_scan_and_parse_desktops(int *sizef) } *sizef = size; scanned_application = applist; + scanned_size=size; return applist; }; @@ -1101,7 +1104,7 @@ char *yon_app_chooser_open_with_sections(char *section_name, char *section_filte } } va_end(args); - int size; + int size=scanned_size; apps *app_list = scanned_application ? scanned_application : yon_apps_scan_and_parse_desktops(&size); int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store),&iter); for (; valid; valid = gtk_tree_model_iter_next(GTK_TREE_MODEL(store),&iter)){ From b058c2cbd9c807d5b8f7f56b243fe36699778b2e Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Mon, 11 Sep 2023 17:49:17 +0600 Subject: [PATCH 12/13] Temporary removal of KDE terminal from the list of terminals --- source/ublexec.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/ublexec.h b/source/ublexec.h index f8e8072..ee9b104 100755 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -27,7 +27,7 @@ #define get_user_id_min_command "grep \"^UID_MIN\" /etc/login.defs |grep -vE '(nologin|false)$' | sed -e 's/\t/ /g' -e 's/ */ /g'|grep -oE \"[0-9]{1,}\"" #define get_user_id_max_command "grep \"^UID_MAX\" /etc/login.defs | sed -e 's/\t/ /g' -e 's/ */ /g'|grep -oE \"[0-9]{1,}\"" #define get_users_command "getent passwd |cut -d: -f1,3" -#define get_terminals_info_command "ublexec-cli -l|sed -e 's/\t/ /g' -e 's/^ *//g' -e 's/ */:/g'|cut -d':' -f1,2,3" +#define get_terminals_info_command "ublexec-cli -l|sed -e 's/\t/ /g' -e 's/^ *//g' -e 's/ */:/g'|cut -d':' -f1,2,3| grep -v \"KDE\"" #define get_run_command_command "ublexec-cli -q" #define LocalePath "/usr/share/locale" From e1b16c8e95202d20ff1fe745a7f6ad863218f2b9 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Tue, 12 Sep 2023 12:04:22 +0600 Subject: [PATCH 13/13] Re-enabled KDE showing in ui --- .gitignore | 3 ++- source/ublexec.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index a4f5d99..012641d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ compile/ .BUILD.md .install.sh terminal-commands/ -.updatebuild.sh \ No newline at end of file +.updatebuild.sh +*vgcore* \ No newline at end of file diff --git a/source/ublexec.h b/source/ublexec.h index ee9b104..f8e8072 100755 --- a/source/ublexec.h +++ b/source/ublexec.h @@ -27,7 +27,7 @@ #define get_user_id_min_command "grep \"^UID_MIN\" /etc/login.defs |grep -vE '(nologin|false)$' | sed -e 's/\t/ /g' -e 's/ */ /g'|grep -oE \"[0-9]{1,}\"" #define get_user_id_max_command "grep \"^UID_MAX\" /etc/login.defs | sed -e 's/\t/ /g' -e 's/ */ /g'|grep -oE \"[0-9]{1,}\"" #define get_users_command "getent passwd |cut -d: -f1,3" -#define get_terminals_info_command "ublexec-cli -l|sed -e 's/\t/ /g' -e 's/^ *//g' -e 's/ */:/g'|cut -d':' -f1,2,3| grep -v \"KDE\"" +#define get_terminals_info_command "ublexec-cli -l|sed -e 's/\t/ /g' -e 's/^ *//g' -e 's/ */:/g'|cut -d':' -f1,2,3" #define get_run_command_command "ublexec-cli -q" #define LocalePath "/usr/share/locale"