Merge pull request 'master' (#80) from YanTheKaller/ubl-settings-manager:master into master

Reviewed-on: #80
master v2.11
Dmitry Razumov 2 weeks ago
commit 9a0a18c582

@ -56,7 +56,7 @@ msgid "Understood"
msgstr "" msgstr ""
#: source/ubl-strings.h:12 #: source/ubl-strings.h:12
msgid "Settings" msgid "Manager settings"
msgstr "" msgstr ""
#: source/ubl-strings.h:13 #: source/ubl-strings.h:13

@ -58,8 +58,8 @@ msgid "Understood"
msgstr "Понятно" msgstr "Понятно"
#: source/ubl-strings.h:12 #: source/ubl-strings.h:12
msgid "Settings" msgid "Manager settings"
msgstr "Настройки" msgstr "Настройки диспетчера"
#: source/ubl-strings.h:13 #: source/ubl-strings.h:13
msgid "Apply" msgid "Apply"

@ -1,5 +1,10 @@
#include "ubl-settings-manager.h" #include "ubl-settings-manager.h"
gboolean on_settings_doubleckick_switched(GtkWidget *, int state,settings_window *window){
window->doubleclick = state;
return 0;
}
gboolean on_settings_size_changed(GtkRange* , GtkScrollType* , gdouble value, settings_window *window){ gboolean on_settings_size_changed(GtkRange* , GtkScrollType* , gdouble value, settings_window *window){
long val = (long)value; long val = (long)value;
int size = val-val%8; int size = val-val%8;
@ -23,8 +28,9 @@ void on_settings_accept(GtkWidget *, settings_window *window){
if (cur_theme) if (cur_theme)
yon_window_config_add_instant_parameter(theme_parameter,settings_section,cur_theme,YON_TYPE_STRING); yon_window_config_add_instant_parameter(theme_parameter,settings_section,cur_theme,YON_TYPE_STRING);
int double_click = gtk_switch_get_active(GTK_SWITCH(window->DoubleClickSwitch)); if (window->doubleclick>-1){
yon_window_config_add_instant_parameter(double_click_parameter,settings_section,&double_click,YON_TYPE_INT); yon_window_config_add_instant_parameter(double_click_parameter,settings_section,&window->doubleclick,YON_TYPE_INT);
}
yon_interface_update(widgets); yon_interface_update(widgets);
on_subwindow_close(window->Window); on_subwindow_close(window->Window);
} }
@ -42,7 +48,10 @@ settings_window *yon_settings_window_new(){
window->SectionsConfigurationButton = yon_gtk_builder_get_widget(builder,"SectionsConfigurationButton"); window->SectionsConfigurationButton = yon_gtk_builder_get_widget(builder,"SectionsConfigurationButton");
window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton"); window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton"); window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
window->doubleclick = -1;
g_signal_connect(G_OBJECT(window->DoubleClickSwitch),"state-set",G_CALLBACK(on_settings_doubleckick_switched),window);
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_settings_accept),window); g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_settings_accept),window);
g_signal_connect(G_OBJECT(window->SizeSlider),"change-value",G_CALLBACK(on_settings_size_changed),window); g_signal_connect(G_OBJECT(window->SizeSlider),"change-value",G_CALLBACK(on_settings_size_changed),window);
@ -66,10 +75,10 @@ settings_window *yon_settings_window_new(){
on_settings_size_changed(NULL,NULL,window->icon_size,window); on_settings_size_changed(NULL,NULL,window->icon_size,window);
int double_click_activate; int double_click_activate;
if (!yon_window_config_get_parameter(settings_section,double_click_parameter,&double_click_activate,YON_TYPE_BOOLEAN)){ if (yon_window_config_get_parameter(settings_section,double_click_parameter,&double_click_activate,YON_TYPE_BOOLEAN)){
double_click_activate=0; window->doubleclick=double_click_activate;
gtk_switch_set_active(GTK_SWITCH(window->DoubleClickSwitch),double_click_activate);
} }
gtk_switch_set_active(GTK_SWITCH(window->DoubleClickSwitch),double_click_activate);
return window; return window;
} }

@ -67,6 +67,18 @@ void on_main_activate(GtkFlowBox* , GtkFlowBoxChild* child, main_theme_struct *t
void yon_main_section_setup_apps(main_section *cur_section, const char *target){ void yon_main_section_setup_apps(main_section *cur_section, const char *target){
if (yon_char_is_empty(target)) return; if (yon_char_is_empty(target)) return;
apps *cur_app = yon_apps_get((char*)target); apps *cur_app = yon_apps_get((char*)target);
{
if (cur_section->section->categories_size==1&&!strcmp(cur_section->section->categories[0],"X-UBL-SettingsManager")) {
int found_else = 0;
for (int i=0;i<cur_app->categories_size;i++){
if (strstr(cur_app->Categories[i],"X-UBL-")&&strcmp(cur_app->Categories[i],"X-UBL-SettingsManager")){
found_else = 1;
}
}
if (found_else) return;
}
}
GtkIconInfo *info = gtk_icon_theme_lookup_icon_for_scale(gtk_icon_theme_get_default(), !yon_char_is_empty(cur_app->Icon)?cur_app->Icon:icon_path, main_config.apps_icon_size,1,GTK_ICON_LOOKUP_FORCE_SIZE); GtkIconInfo *info = gtk_icon_theme_lookup_icon_for_scale(gtk_icon_theme_get_default(), !yon_char_is_empty(cur_app->Icon)?cur_app->Icon:icon_path, main_config.apps_icon_size,1,GTK_ICON_LOOKUP_FORCE_SIZE);
GtkWidget *Image = NULL; GtkWidget *Image = NULL;
if (info){ if (info){
@ -115,7 +127,7 @@ main_section *yon_main_section_new(){
g_object_set_data(G_OBJECT(cur_section->expander),"main_section",cur_section); g_object_set_data(G_OBJECT(cur_section->expander),"main_section",cur_section);
int doubleclick=0; int doubleclick=0;
if (!yon_window_config_get_parameter(settings_section,double_click_parameter,&doubleclick,YON_TYPE_BOOLEAN)){ if (!yon_window_config_get_parameter(settings_section,double_click_parameter,&doubleclick,YON_TYPE_BOOLEAN)){
gtk_flow_box_set_activate_on_single_click(GTK_FLOW_BOX(cur_section->AppsList),1); gtk_flow_box_set_activate_on_single_click(GTK_FLOW_BOX(cur_section->AppsList),0);
} else { } else {
gtk_flow_box_set_activate_on_single_click(GTK_FLOW_BOX(cur_section->AppsList),!doubleclick); gtk_flow_box_set_activate_on_single_click(GTK_FLOW_BOX(cur_section->AppsList),!doubleclick);
} }

@ -207,7 +207,7 @@ main_window *yon_main_window_setup(){
yon_window_config_load(path); yon_window_config_load(path);
yon_ubl_settings_window_init(GTK_MENU(gtk_widget_get_parent(widgets->MainMenuItemAbout))); yon_ubl_settings_window_init(GTK_MENU(gtk_widget_get_parent(widgets->MainMenuItemAbout)));
struct yon_configuration_window_custom_parameter *parameter = malloc(sizeof(struct yon_configuration_window_custom_parameter)); struct yon_configuration_window_custom_parameter *parameter = malloc(sizeof(struct yon_configuration_window_custom_parameter));
parameter->custom_parameter_create_func = yon_config_chooser_new; parameter->custom_parameter_create_func = yon_config_chooser_new;
parameter->custom_parameter_save_value_func = yon_config_chooser_save; parameter->custom_parameter_save_value_func = yon_config_chooser_save;

@ -208,6 +208,7 @@ typedef struct {
GtkWidget *CancelButton; GtkWidget *CancelButton;
GtkWidget *AcceptButton; GtkWidget *AcceptButton;
int doubleclick;
int icon_size; int icon_size;
} settings_window; } settings_window;
@ -256,4 +257,5 @@ GtkWidget *yon_config_chooser_new( char*);
void yon_config_chooser_update(GtkWidget *root); void yon_config_chooser_update(GtkWidget *root);
void yon_config_chooser_save(GtkWidget *root); void yon_config_chooser_save(GtkWidget *root);
void on_main_exit(GtkWidget *, GdkEvent *, main_window *widgets); void on_main_exit(GtkWidget *, GdkEvent *, main_window *widgets);
gboolean on_settings_doubleckick_switched(GtkWidget *, int state,settings_window *window);
#endif #endif

@ -1,15 +1,15 @@
#define TITLE_LABEL _("Settings manager for the system") #define TITLE_LABEL _("Settings manager for the system")
#define TITLE_INFO_LABEL _("About UBLinux Settings Manager") #define TITLE_INFO_LABEL _("About Settings manager for the system")
#define WIKI_LINK _("https://wiki.ublinux.ru/software/programs_and_utilities/all/ubl-settings-manager") #define WIKI_LINK _("https://wiki.ublinux.ru/software/programs_and_utilities/all/ubl-settings-manager")
#define ABOUT_PROJECT_COMMENTS_LABEL _("Settings manager for UBLinux") #define ABOUT_PROJECT_COMMENTS_LABEL _("Settings manager for the system")
#define BACK_TO_SETTINGS_LABEL _("Back to settings") #define BACK_TO_SETTINGS_LABEL _("Back to settings")
#define CONFIG_LOAD_ERROR _("Config loading failed!\n") #define CONFIG_LOAD_ERROR _("Config loading failed!\n")
#define DOUBLE_CLICK_SELECTION_LABEL _("Double click selection") #define DOUBLE_CLICK_SELECTION_LABEL _("Double click selection")
#define SECTIONS_MANAGEMENT_LABEL _("Sections management") #define SECTIONS_MANAGEMENT_LABEL _("Sections management")
#define UNDERSTOOD_LABEL _("Understood") #define UNDERSTOOD_LABEL _("Understood")
#define SETTINGS_LABEL _("Settings") #define SETTINGS_LABEL _("Manager settings")
#define APPLY_LABEL _("Apply") #define APPLY_LABEL _("Apply")
#define CLOSE_LABEL _("Close") #define CLOSE_LABEL _("Close")
#define CANCEL_LABEL _("Cancel") #define CANCEL_LABEL _("Cancel")

@ -13,7 +13,7 @@
<object class="GtkMenuItem" id="MainMenuItemSettings"> <object class="GtkMenuItem" id="MainMenuItemSettings">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="label" translatable="yes">Settings</property> <property name="label" translatable="yes">Manager settings</property>
<property name="use-underline">True</property> <property name="use-underline">True</property>
<style> <style>
<class name="menuitemtop"/> <class name="menuitemtop"/>

Loading…
Cancel
Save