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

Reviewed-on: #27
pull/29/head
Dmitry Razumov 3 years ago
commit dce4c5cb4b

@ -257,6 +257,10 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){
g_key_file_set_string(gfile,"window","LabelDensity",fromint);
g_key_file_set_string(gfile,"window","User",login);
for (int i=0;i<removalsize;i++)
g_key_file_remove_key(gfile, "sections",sectionremoval[i] ,NULL);
removalsize=0;
sectionremoval=NULL;
for (dictionary *dict=widgets->ICSys->first;dict!=NULL;dict=dict->next){
IVGraphicals *IV=(IVGraphicals*)dict->data;
g_key_file_set_string(gfile,"sections",IV->sectionName,IV->categories);
@ -427,6 +431,7 @@ void on_sections_cancel(GtkWidget *button, actionWidgets *widgets){
gtk_widget_hide(segment->CategoriesEntry);
gtk_widget_hide(segment->EditButtonBox);
gtk_widget_show(segment->ButtonEdit);
gtk_widget_show(segment->DeleditBox);
gtk_widget_set_sensitive(segment->DragButtonBox,1);
}else {
@ -552,36 +557,45 @@ void on_sections_close(GtkWidget *button, actionWidgets *widgets){
gtk_widget_hide(widgets->SectionSettingsWindow);
}
void on_sections_save(GtkWidget *button, actionWidgets *widgets){
void on_sections_save(GtkWidget *button, dictionary *widgetsD){
actionWidgets *widgets=(actionWidgets*)widgetsD->data;
GKeyFile *gfile=g_key_file_new();
g_key_file_load_from_file(gfile,GlobalConfigPath,G_KEY_FILE_NONE,NULL);
main_config.sections=yon_dictionary_create_empty();
for (dictionary *dict=widgets->SettingsSections;dict!=NULL;dict=dict->next){
SectionSettingSegment *segment=(SectionSettingSegment*)dict->data;
char *nm=(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel));
char *ct=(char*)gtk_label_get_text(GTK_LABEL(segment->CategoriesLabel));
main_config.sections=yon_section_new(main_config.sections,nm,ct);
g_key_file_set_string(gfile,"sections",nm,ct);
for( int i=0;i<removalsize;i++){
g_key_file_remove_key(gfile,"sections",sectionremoval[i],NULL);
}
}
main_config.sections->next=NULL;
g_key_file_save_to_file(gfile,GlobalConfigPath,NULL);
for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){
IVGraphicals *IV=cur->data;
gtk_container_remove(GTK_CONTAINER(widgets->icvpack),IV->Box);
}
widgets->ICSys=yon_create_icon_section_list(main_config.sections);
for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){
load_apps((IVGraphicals*)cur->data,widgets->applist,widgets->appssize);
int curtheme=main_config.WindowTheme;
for (dictionary *widgetsd=widgetsD->first;widgetsd!=NULL;widgetsd=widgetsd->next){
if (strcmp(widgetsd->key,"Gnome")==0){
main_config.WindowTheme=1;
main_config.currentThemeIconSize=&main_config.Gnomeiconsize;
main_config.currentThemeLabelSize=&main_config.GnomelabelSize;
}
else{
main_config.WindowTheme=0;
main_config.currentThemeIconSize=&main_config.Mainiconsize;
main_config.currentThemeLabelSize=&main_config.MainlabelSize;
}
widgets=(actionWidgets*)widgetsd->data;
for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){
IVGraphicals *IV=cur->data;
gtk_container_remove(GTK_CONTAINER(widgets->icvpack),IV->Box);
}
widgets->ICSys=yon_create_icon_section_list(main_config.sections);
for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){
load_apps_with_clear((IVGraphicals*)cur->data,widgets->applist,widgets->appssize);
}
yon_show_icon_views(widgets->ICSys,widgets);
dictionary *yond=yon_dictionary_create_empty();
yond->data=widgets;
hide_if_unfound(yond);
}
yon_show_icon_views(widgets->ICSys,widgets);
dictionary *yond=yon_dictionary_create_empty();
yond->data=widgets;
hide_if_unfound(yond);
main_config.WindowTheme=curtheme;
}
void on_section_delete(GtkWidget *button, actionWidgets *widgets){
@ -723,7 +737,7 @@ int launch(thread_output *thread){
}
int launch_app_with_arguments(char *name, char *args){
char *path=yon_char_get_augumented("/bin/",name);
char *path=yon_char_get_augumented("/usr/bin/",name);
path=yon_char_get_augumented(path," ");
path=yon_char_get_augumented(path,args);
pthread_t thread_id;
@ -948,6 +962,7 @@ int setup_config(){
FILE *file;
GError *err=NULL;
main_config.sections=yon_dictionary_create_empty();
main_config.lock_settings=0;
GKeyFile *configfile = g_key_file_new();
char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin()));
sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath);
@ -1358,8 +1373,8 @@ SectionSettingSegment *yon_create_section_setting(char *name, char *categories){
gtk_widget_set_size_request(segment->ElemBox,0,20);
segment->DragButtonBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
gtk_widget_set_name(segment->DragButtonBox,"noborders");
segment->DragUpButton=gtk_button_new_from_icon_name("gtk-goto-top",GTK_ICON_SIZE_BUTTON);
segment->DragDownButton=gtk_button_new_from_icon_name("gtk-goto-bottom",GTK_ICON_SIZE_BUTTON);
segment->DragUpButton=gtk_button_new_from_icon_name("go-top-symbolic",GTK_ICON_SIZE_BUTTON);
segment->DragDownButton=gtk_button_new_from_icon_name("go-bottom-symbolic",GTK_ICON_SIZE_BUTTON);
segment->NameBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
segment->CategoriesBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
segment->OptionBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
@ -1375,11 +1390,11 @@ SectionSettingSegment *yon_create_section_setting(char *name, char *categories){
gtk_entry_set_text(GTK_ENTRY(segment->CategoriesEntry),categories);
segment->CategoriesLabel=gtk_label_new(categories);
segment->EditButtonBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
segment->EditButtonAccept=gtk_button_new_from_icon_name("dialog-ok",GTK_ICON_SIZE_BUTTON);
segment->EditButtonCancel=gtk_button_new_from_icon_name("dialog-no",GTK_ICON_SIZE_BUTTON);
segment->ButtonEdit=gtk_button_new_from_icon_name("gtk-edit",GTK_ICON_SIZE_BUTTON);
segment->EditButtonAccept=gtk_button_new_from_icon_name("emblem-ok-symbolic",GTK_ICON_SIZE_BUTTON);
segment->EditButtonCancel=gtk_button_new_from_icon_name("process-stop-symbolic",GTK_ICON_SIZE_BUTTON);
segment->ButtonEdit=gtk_button_new_from_icon_name("document-edit-symbolic",GTK_ICON_SIZE_BUTTON);
segment->DeleditBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0);
segment->ButtonDelete=gtk_button_new_from_icon_name("edit-delete",GTK_ICON_SIZE_BUTTON);
segment->ButtonDelete=gtk_button_new_from_icon_name("edit-delete-symbolic",GTK_ICON_SIZE_BUTTON);
gtk_widget_set_name(segment->NameLabel,"SegName");
gtk_widget_set_name(segment->CategoriesLabel,"SegCat");
@ -1559,7 +1574,9 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them
curWidgets->MenuItemDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemDocumentation")));
curWidgets->MenuItemAboutSystem=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemAboutSystem")));
curWidgets->SettingsSections=NULL;
if (main_config.lock_settings==1){
gtk_widget_set_sensitive(curWidgets->MenuItemSettings,0);
}
gtk_style_context_add_class(gtk_widget_get_style_context(curWidgets->icvpack),"iconview");
curWidgets->socket=GTK_WIDGET(create_socket(curWidgets));
if (curWidgets->ButtonBackToMain!=NULL)
@ -1578,7 +1595,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them
if (curWidgets->ButtonBackToMain!=NULL)
g_signal_connect(G_OBJECT(curWidgets->ButtonBackToMain), "clicked", G_CALLBACK(on_backToSettingsButton_clicked), curWidgets);
curWidgets->LabelTitle=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"LabelTitle"));
gtk_window_set_title(GTK_WINDOW(curWidgets->window),_("UBLinux Settings Manager"));
gtk_window_set_title(GTK_WINDOW(curWidgets->window),_("UBLinux Settings Manager"));
// Standard for all themes
@ -1632,7 +1649,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them
g_signal_connect(G_OBJECT(curWidgets->SectionSettingAddButton), "clicked", G_CALLBACK(on_sections_add), curWidgets);
g_signal_connect(G_OBJECT(curWidgets->SectionSettingsClearEntryButton), "clicked", G_CALLBACK(on_sections_new_clear), curWidgets);
g_signal_connect(G_OBJECT(curWidgets->SectionSettingsCloseButton), "clicked", G_CALLBACK(on_sections_close), curWidgets);
g_signal_connect(G_OBJECT(curWidgets->SectionSettingsSaveButton), "clicked", G_CALLBACK(on_sections_save), curWidgets);
g_signal_connect(G_OBJECT(curWidgets->SectionSettingsSaveButton), "clicked", G_CALLBACK(on_sections_save), widgets);
g_signal_connect(G_OBJECT(curWidgets->CautionUnderstandButton), "clicked", G_CALLBACK(on_caution_understand), curWidgets);
g_signal_connect(G_OBJECT(curWidgets->settingsSectionsSettingsButton), "clicked", G_CALLBACK(on_section_settings_open), widgets);
}
@ -1660,6 +1677,15 @@ int main(int argc, char *argv[]){
printf("Ошибка загрузки конфига!\n");
return -1;
}
static struct option long_options[] = {
{"lock-settings", 0, 0, 'l'},
};
int socket_find;
int option_index=0;
for (int i=0;i<argc;i++){
socket_find=getopt_long(argc,argv,"",long_options,&option_index);
if (socket_find=='l') main_config.lock_settings=1;
}
local=setlocale(LC_ALL, "");
textdomain (LocaleName);
actionWidgets *widget=NULL;

@ -3,6 +3,7 @@
#include <gtk/gtk.h>
#include <time.h>
#include <getopt.h>
#define GladePath "/usr/share/ubl-settings-manager/ui/ubl-settings-manager.glade"
@ -79,6 +80,7 @@ typedef struct {
char *lastUser;
int changed;
int fullscreen;
int lock_settings;
} config;
typedef struct {

@ -20,8 +20,7 @@ background-color: #404040;
}
.roundborder * {
border-style:solid;
border-width:1px;
border-width:0px;
border-radius:5px;
}
.noborder {

@ -456,7 +456,7 @@
<property name="height-request">64</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">ubconfig-gui</property>
<property name="icon-name">ru.ublinux.ubl-settings-manager</property>
</object>
<packing>
<property name="expand">False</property>
@ -627,7 +627,7 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">32</property>
<property name="icon-name">ubl-settings-manager</property>
<property name="icon-name">ru.ublinux.ubl-settings-manager</property>
<property name="icon_size">5</property>
</object>
</child>
@ -653,14 +653,16 @@
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="app-paintable">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="app-paintable">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<object class="GtkBox" id="MainImageBackground">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
@ -798,7 +800,7 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">32</property>
<property name="icon-name">ubl-settings-manager</property>
<property name="icon-name">ru.ublinux.ubl-settings-manager</property>
<property name="icon_size">5</property>
</object>
</child>
@ -831,7 +833,6 @@
<placeholder/>
</child>
<style>
<class name="roundborder"/>
<class name="bkim"/>
</style>
</object>
@ -881,7 +882,6 @@
<placeholder/>
</child>
<style>
<class name="roundborder"/>
<class name="bkim"/>
</style>
</object>
@ -892,6 +892,7 @@
</child>
<style>
<class name="bkim"/>
<class name="roundborder"/>
</style>
</object>
</child>
@ -1201,7 +1202,7 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">32</property>
<property name="icon-name">ubl-settings-manager</property>
<property name="icon-name">ru.ublinux.ubl-settings-manager</property>
<property name="icon_size">5</property>
</object>
</child>
@ -1454,7 +1455,7 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">32</property>
<property name="icon-name">ubl-settings-manager</property>
<property name="icon-name">ru.ublinux.ubl-settings-manager</property>
<property name="icon_size">5</property>
</object>
</child>
@ -1538,6 +1539,7 @@
</child>
<style>
<class name="bkim"/>
<class name="roundborder"/>
</style>
</object>
</child>
@ -1579,7 +1581,6 @@
<property name="hscroll-policy">natural</property>
<property name="item-orientation">horizontal</property>
<property name="model">liststoreTemplate</property>
<property name="item-width">135</property>
<property name="row-spacing">0</property>
<property name="column-spacing">2</property>
<property name="item-padding">5</property>
@ -1600,7 +1601,7 @@
<object class="GtkCellRendererText">
<property name="xalign">0</property>
<property name="wrap-mode">word</property>
<property name="wrap-width">18</property>
<property name="wrap-width">150</property>
</object>
<attributes>
<attribute name="height">3</attribute>
@ -1884,7 +1885,7 @@
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="pixel-size">32</property>
<property name="icon-name">ubl-settings-manager</property>
<property name="icon-name">ru.ublinux.ubl-settings-manager</property>
<property name="icon_size">5</property>
</object>
</child>
@ -1970,7 +1971,7 @@
<property name="website-label" translatable="yes">Project Home Page</property>
<property name="authors">UBGroup</property>
<property name="artists">UBGroup</property>
<property name="logo-icon-name">ubl-settings-manager</property>
<property name="logo-icon-name">ru.ublinux.ubl-settings-manager</property>
<property name="license-type">gpl-2-0</property>
<child internal-child="vbox">
<object class="GtkBox">

Loading…
Cancel
Save