|
|
|
|
@ -1,336 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "ubl-settings-manager.h"
|
|
|
|
|
|
|
|
|
|
config main_config;
|
|
|
|
|
|
|
|
|
|
// int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){
|
|
|
|
|
// if (main_config.WindowTheme==0)
|
|
|
|
|
// main_config.curThemeName="Main";
|
|
|
|
|
// else if (main_config.WindowTheme==1)
|
|
|
|
|
// main_config.curThemeName="Gnome";
|
|
|
|
|
// dictionary *widgetsD=yon_dictionary_find(widgetsDs,main_config.curThemeName);
|
|
|
|
|
// main_window *widgets=(main_window*)widgetsD->data;
|
|
|
|
|
// int theme=gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->settingsThemeChooser));
|
|
|
|
|
// gtk_window_get_position(GTK_WINDOW(widgets->window),&main_config.windowPosX,&main_config.windowPosY);
|
|
|
|
|
// gtk_window_get_size(GTK_WINDOW(widgets->window),&main_config.windowWidth,&main_config.windowHeight);
|
|
|
|
|
// if (theme==0)
|
|
|
|
|
// main_config.curThemeName="Main";
|
|
|
|
|
// else if (theme==1)
|
|
|
|
|
// main_config.curThemeName="Gnome";
|
|
|
|
|
// if (main_config.WindowTheme!=theme){
|
|
|
|
|
// main_config.WindowTheme=theme;
|
|
|
|
|
// GtkWidget *loaderWindow=GTK_WIDGET(gtk_builder_get_object(widgets->builder,"LoaderWindow"));
|
|
|
|
|
// gtk_window_resize(GTK_WINDOW(loaderWindow),main_config.windowWidth,main_config.windowHeight);
|
|
|
|
|
// gtk_window_move(GTK_WINDOW(loaderWindow),main_config.windowPosX,main_config.windowPosY);
|
|
|
|
|
// gtk_widget_show(loaderWindow);
|
|
|
|
|
// yon_switch_theme(widgetsDs,yon_dictionary_find(&widgetsD,main_config.curThemeName));
|
|
|
|
|
// if (widgets!=(main_window*)widgetsD->data) widgets=(main_window*)widgetsD->data;
|
|
|
|
|
// gtk_widget_hide(loaderWindow);
|
|
|
|
|
// gtk_window_present(GTK_WINDOW(widgets->SettingsWindow));
|
|
|
|
|
// }
|
|
|
|
|
// GKeyFile *gfile=g_key_file_new();
|
|
|
|
|
|
|
|
|
|
// int sz=1,szm=1;
|
|
|
|
|
// if (main_config.Gnomeiconsize==64) sz=4;
|
|
|
|
|
// else if (main_config.Gnomeiconsize==48) sz=3;
|
|
|
|
|
// else if (main_config.Gnomeiconsize==32) sz=2;
|
|
|
|
|
// else if (main_config.Gnomeiconsize==24) sz=1;
|
|
|
|
|
// if (main_config.Mainiconsize==64) szm=4;
|
|
|
|
|
// else if (main_config.Mainiconsize==48) szm=3;
|
|
|
|
|
// else if (main_config.Mainiconsize==32) szm=2;
|
|
|
|
|
// else if (main_config.Mainiconsize==24) szm=1;
|
|
|
|
|
// char *fromint=malloc(5);
|
|
|
|
|
// memset(fromint,0,5);
|
|
|
|
|
// GError *err=NULL;
|
|
|
|
|
// char *login=getlogin();
|
|
|
|
|
// if (geteuid()==0){
|
|
|
|
|
// login=main_config.lastUser;
|
|
|
|
|
// } else {
|
|
|
|
|
// main_config.lastUser=login;
|
|
|
|
|
// }
|
|
|
|
|
// char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin()));
|
|
|
|
|
// sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath);
|
|
|
|
|
// g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err);
|
|
|
|
|
// if (err){
|
|
|
|
|
// struct stat st = {0};
|
|
|
|
|
// char *ptdir=malloc(36+strlen(getlogin()));
|
|
|
|
|
// sprintf(ptdir,"%s%s%s","/home/",getlogin(),"/.config/ubl-settings-manager");
|
|
|
|
|
// if (stat(ptdir, &st) == -1) {
|
|
|
|
|
// mkdir(ptdir, 0777);
|
|
|
|
|
// }
|
|
|
|
|
// FILE *fp;
|
|
|
|
|
// fp=fopen(pth,"w");
|
|
|
|
|
// fclose(fp);
|
|
|
|
|
// }
|
|
|
|
|
// g_key_file_load_from_file(gfile,pth,G_KEY_FILE_NONE,&err);
|
|
|
|
|
// if (gtk_window_is_maximized(GTK_WINDOW(widgets->window))==0){
|
|
|
|
|
// sprintf(fromint,"%d",main_config.windowPosX);
|
|
|
|
|
// g_key_file_set_string(gfile,"window","WindowPosX",fromint);
|
|
|
|
|
// sprintf(fromint,"%d",main_config.windowPosY);
|
|
|
|
|
// g_key_file_set_string(gfile,"window","WindowPosY",fromint);
|
|
|
|
|
// sprintf(fromint,"%d",main_config.windowWidth);
|
|
|
|
|
// g_key_file_set_string(gfile,"window","WindowWidth",fromint);
|
|
|
|
|
// sprintf(fromint,"%d",main_config.windowHeight);
|
|
|
|
|
// g_key_file_set_string(gfile,"window","WindowHeight",fromint);
|
|
|
|
|
// }
|
|
|
|
|
// sprintf(fromint,"%d",main_config.WindowTheme);
|
|
|
|
|
// g_key_file_set_string(gfile,"window","WindowTheme",fromint);
|
|
|
|
|
// sprintf(fromint,"%d",sz);
|
|
|
|
|
// g_key_file_set_string(gfile,"window","GnomeIconSize",fromint);
|
|
|
|
|
// sprintf(fromint,"%d",szm);
|
|
|
|
|
// g_key_file_set_string(gfile,"window","MainIconSize",fromint);
|
|
|
|
|
// sprintf(fromint,"%d",main_config.iconSegmentSize);
|
|
|
|
|
// g_key_file_set_string(gfile,"window","IconSegmentSize",fromint);
|
|
|
|
|
// sprintf(fromint,"%d",(int)((float)main_config.GnomelabelSize/1000));
|
|
|
|
|
// g_key_file_set_string(gfile,"window","GnomeLabelSize",fromint);
|
|
|
|
|
// sprintf(fromint,"%d",(int)((float)main_config.MainlabelSize/1000));
|
|
|
|
|
// g_key_file_set_string(gfile,"window","MainLabelSize",fromint);
|
|
|
|
|
// sprintf(fromint,"%d",(int)((float)main_config.labelDensity/1000));
|
|
|
|
|
// g_key_file_set_string(gfile,"window","LabelDensity",fromint);
|
|
|
|
|
// g_key_file_set_string(gfile,"window","User",login);
|
|
|
|
|
// g_key_file_set_boolean(gfile,"window","GnomeDoubleClick",main_config.GnomeDoubleClick);
|
|
|
|
|
// g_key_file_set_boolean(gfile,"window","MainDoubleClick",main_config.MainDoubleClick);
|
|
|
|
|
|
|
|
|
|
// g_key_file_remove_group(gfile, "sections",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);
|
|
|
|
|
// if (main_config.changed==1){
|
|
|
|
|
// load_apps_with_clear(IV,widgets->applist,widgets->appssize);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// main_config.changed=0;
|
|
|
|
|
// g_key_file_save_to_file(gfile,pth,NULL);
|
|
|
|
|
// gtk_widget_hide(widgets->SettingsWindow);
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// void on_section_settings_open(GtkButton* self,dictionary *cWidgets){
|
|
|
|
|
// main_window *widgets=(main_window*)cWidgets->data;
|
|
|
|
|
// if (main_config.SettingsSections->first->data==NULL){
|
|
|
|
|
// char *name=((IconSection*)main_config.sections->first->data)->section;
|
|
|
|
|
// char *categories=((IconSection*)main_config.sections->first->data)->categories;
|
|
|
|
|
// main_config.SettingsSections->first->data=yon_create_section_setting(name, categories);
|
|
|
|
|
// main_config.SettingsSections->first->key=name;
|
|
|
|
|
// yon_segments_hide(widgets);
|
|
|
|
|
// yon_segment_show(widgets, (SectionSettingSegment*)main_config.SettingsSections->data);
|
|
|
|
|
// for (dictionary *dct=main_config.sections->first->next;dct!=NULL;dct=dct->next){
|
|
|
|
|
// name=((IconSection*)dct->data)->section;
|
|
|
|
|
// categories=((IconSection*)dct->data)->categories;
|
|
|
|
|
// main_config.SettingsSections=yon_dictionary_create_with_data_connected(main_config.SettingsSections,name,yon_create_section_setting(name, categories));
|
|
|
|
|
// main_config.SettingsSections->key=name;
|
|
|
|
|
// yon_segment_show(widgets, (SectionSettingSegment*)main_config.SettingsSections->data);
|
|
|
|
|
// }
|
|
|
|
|
// yon_segments_show(widgets);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// gtk_window_present(GTK_WINDOW(widgets->SectionSettingsWindow));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_sections_edit(GtkWidget *button, main_window *widgets){
|
|
|
|
|
// for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data;
|
|
|
|
|
// if (segment!=NULL){
|
|
|
|
|
// if (button==segment->ButtonEdit){
|
|
|
|
|
// gtk_widget_hide(segment->NameLabel);
|
|
|
|
|
// gtk_widget_hide(segment->CategoriesLabel);
|
|
|
|
|
// gtk_widget_show(segment->NameEntry);
|
|
|
|
|
// gtk_widget_show(segment->CategoriesEntry);
|
|
|
|
|
// gtk_widget_show(segment->EditButtonBox);
|
|
|
|
|
// gtk_widget_hide(segment->DeleditBox);
|
|
|
|
|
// gtk_widget_set_sensitive(segment->DragButtonBox,0);
|
|
|
|
|
|
|
|
|
|
// } else {
|
|
|
|
|
// gtk_widget_set_sensitive(segment->OptionBox,0);
|
|
|
|
|
// gtk_widget_set_sensitive(segment->DragButtonBox,0);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// void on_sections_accept(GtkWidget *button, main_window *widgets){
|
|
|
|
|
// for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data;
|
|
|
|
|
// if (segment!=NULL){
|
|
|
|
|
// if (button==segment->EditButtonAccept){
|
|
|
|
|
// char *name=yon_char_get_augumented((char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel)),"");
|
|
|
|
|
// char *newname=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(segment->NameEntry)),"");
|
|
|
|
|
// char *newcats=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(segment->CategoriesEntry)),"");
|
|
|
|
|
// if (newcats[strlen(newcats)-1]!=';')
|
|
|
|
|
// newcats=yon_char_get_augumented(newcats,";");
|
|
|
|
|
// gtk_label_set_text(GTK_LABEL(segment->NameLabel),gtk_entry_get_text(GTK_ENTRY(segment->NameEntry)));
|
|
|
|
|
// gtk_label_set_text(GTK_LABEL(segment->CategoriesLabel),gtk_entry_get_text(GTK_ENTRY(segment->CategoriesEntry)));
|
|
|
|
|
// dictionary *toedit=yon_dictionary_find(&main_config.sections,name);
|
|
|
|
|
// toedit->key=newname;
|
|
|
|
|
// ((IconSection*)toedit->data)->section=newname;
|
|
|
|
|
// ((IconSection*)toedit->data)->categories=newcats;
|
|
|
|
|
// toedit=yon_dictionary_find(&main_config.SettingsSections,name);
|
|
|
|
|
// toedit->key=newname;
|
|
|
|
|
// ((IconSection*)toedit->data)->section=newname;
|
|
|
|
|
// ((IconSection*)toedit->data)->categories=newcats;
|
|
|
|
|
// gtk_widget_show(segment->NameLabel);
|
|
|
|
|
// gtk_widget_show(segment->CategoriesLabel);
|
|
|
|
|
// gtk_widget_hide(segment->NameEntry);
|
|
|
|
|
// gtk_widget_hide(segment->CategoriesEntry);
|
|
|
|
|
// gtk_widget_hide(segment->EditButtonBox);
|
|
|
|
|
// gtk_widget_show(segment->DeleditBox);
|
|
|
|
|
// gtk_widget_set_sensitive(segment->DragButtonBox,1);
|
|
|
|
|
|
|
|
|
|
// }else {
|
|
|
|
|
// gtk_widget_set_sensitive(segment->OptionBox,1);
|
|
|
|
|
// gtk_widget_set_sensitive(segment->DragButtonBox,1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// void on_sections_cancel(GtkWidget *button, main_window *widgets){
|
|
|
|
|
// for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data;
|
|
|
|
|
// if (segment!=NULL){
|
|
|
|
|
// if (button==segment->EditButtonCancel){
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(segment->NameEntry),gtk_label_get_text(GTK_LABEL(segment->NameLabel)));
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(segment->CategoriesEntry),gtk_label_get_text(GTK_LABEL(segment->CategoriesLabel)));
|
|
|
|
|
// gtk_widget_show(segment->NameLabel);
|
|
|
|
|
// gtk_widget_show(segment->CategoriesLabel);
|
|
|
|
|
// gtk_widget_hide(segment->NameEntry);
|
|
|
|
|
// 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 {
|
|
|
|
|
// gtk_widget_set_sensitive(segment->OptionBox,1);
|
|
|
|
|
// gtk_widget_set_sensitive(segment->DragButtonBox,1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// void on_sections_move_up(GtkWidget *button, main_window *widgets){
|
|
|
|
|
// for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data;
|
|
|
|
|
// if (segment!=NULL){
|
|
|
|
|
// if (button==segment->DragUpButton){
|
|
|
|
|
// yon_dictionary_switch_places(yon_dictionary_find(&main_config.sections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),-1);
|
|
|
|
|
// yon_dictionary_switch_places(yon_dictionary_find(&main_config.SettingsSections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),-1);
|
|
|
|
|
// yon_segments_hide(widgets);
|
|
|
|
|
// yon_segments_show(widgets);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// void on_sections_move_down(GtkWidget *button, main_window *widgets){
|
|
|
|
|
// for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data;
|
|
|
|
|
// if (segment!=NULL){
|
|
|
|
|
// if (button==segment->DragDownButton){
|
|
|
|
|
// yon_dictionary_switch_places(yon_dictionary_find(&main_config.sections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),1);
|
|
|
|
|
// yon_dictionary_switch_places(yon_dictionary_find(&main_config.SettingsSections,(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel))),1);
|
|
|
|
|
// yon_segments_hide(widgets);
|
|
|
|
|
// yon_segments_show(widgets);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// void on_sections_add(GtkWidget *button, main_window *widgets){
|
|
|
|
|
// char *category_name = yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry)),"");
|
|
|
|
|
// if (strcmp(category_name,"")!=0){
|
|
|
|
|
// char *category_categories=yon_char_get_augumented((char*)gtk_entry_get_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry)),"");
|
|
|
|
|
// if (category_categories[strlen(category_categories)-1]!=';')
|
|
|
|
|
// category_categories=yon_char_get_augumented(category_categories,";");
|
|
|
|
|
// SectionSettingSegment *segment=yon_create_section_setting(category_name,category_categories);
|
|
|
|
|
// dictionary *newsection = yon_dictionary_get_last(main_config.SettingsSections);
|
|
|
|
|
// newsection=yon_dictionary_create_with_data_connected(newsection,category_name,segment);
|
|
|
|
|
// dictionary *newsec=yon_dictionary_create_empty();
|
|
|
|
|
// newsec=yon_section_new(newsec,category_name,category_categories);
|
|
|
|
|
// main_config.sections=yon_dictionary_create_with_data_connected(main_config.sections,category_name,newsec->data);
|
|
|
|
|
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry),"");
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry),"");
|
|
|
|
|
// yon_segment_show(widgets, segment);
|
|
|
|
|
// yon_segments_hide(widgets);
|
|
|
|
|
// yon_segments_show(widgets);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_sections_new_clear(GtkWidget *button, main_window *widgets){
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry),"");
|
|
|
|
|
// gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry),"");
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_sections_close(GtkWidget *button, main_window *widgets){
|
|
|
|
|
// gtk_widget_hide(widgets->SectionSettingsWindow);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_sections_save(GtkWidget *button, dictionary *widgetsD){
|
|
|
|
|
// int temptheme=main_config.WindowTheme;
|
|
|
|
|
// for (dictionary *dict=widgetsD->first;dict!=NULL;dict=dict->next){
|
|
|
|
|
// main_window *widgets=(main_window*)dict->data;
|
|
|
|
|
// if (strcmp(dict->key,"Gnome")==0) main_config.WindowTheme=1;
|
|
|
|
|
// else main_config.WindowTheme=0;
|
|
|
|
|
|
|
|
|
|
// for (dictionary *ICSys=widgets->ICSys->first;ICSys!=NULL;ICSys=ICSys->next){
|
|
|
|
|
// gtk_container_remove(GTK_CONTAINER(widgets->icvpack),((IVGraphicals*)ICSys->data)->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);
|
|
|
|
|
// }
|
|
|
|
|
// yon_show_icon_views(widgets->ICSys,widgets);
|
|
|
|
|
// hide_if_unfound(widgetsD);
|
|
|
|
|
// if (main_config.WindowTheme==1)
|
|
|
|
|
// yon_icv_resize_item(dict,widgets->GnomePaned);
|
|
|
|
|
// }
|
|
|
|
|
// main_config.WindowTheme=temptheme;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_section_delete(GtkWidget *button, main_window *widgets){
|
|
|
|
|
// gtk_widget_destroy(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(gtk_widget_get_parent(button)))));
|
|
|
|
|
// for (dictionary *dct=main_config.SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
// SectionSettingSegment *segment=(SectionSettingSegment*)dct->data;
|
|
|
|
|
// if (segment!=NULL){
|
|
|
|
|
// if (button==segment->ButtonDelete){
|
|
|
|
|
// main_config.sections=yon_dictionary_rip(yon_dictionary_find(&main_config.sections, dct->key));
|
|
|
|
|
// main_config.SettingsSections=yon_dictionary_rip(yon_dictionary_find(&main_config.SettingsSections, dct->key));
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_resized (GtkWidget *window, GdkEventConfigure *event, dictionary *widgetsD){
|
|
|
|
|
// main_window *widgets=(main_window*)widgetsD->data;
|
|
|
|
|
// if (gtk_window_is_maximized(GTK_WINDOW(widgets->window))==0){
|
|
|
|
|
// main_config.fullscreen=0;
|
|
|
|
|
// gtk_window_get_size(GTK_WINDOW(window),&main_config.windowWidth,&main_config.windowHeight);
|
|
|
|
|
// gtk_window_get_position(GTK_WINDOW(window),&main_config.windowPosX,&main_config.windowPosY);
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// main_config.fullscreen=1;
|
|
|
|
|
// gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->Revealer),!gtk_revealer_get_child_revealed(GTK_REVEALER(widgets->Revealer)));
|
|
|
|
|
// gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->Revealer),gtk_revealer_get_child_revealed(GTK_REVEALER(widgets->Revealer)));
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void on_resized_done (GtkWidget *window, GdkEvent *event, dictionary *widgetsD){
|
|
|
|
|
// main_window *widgets=(main_window*)widgetsD->data;
|
|
|
|
|
// if (event->type==GDK_CONFIGURE){
|
|
|
|
|
// if (stld==1){
|
|
|
|
|
// gtk_window_set_resizable(GTK_WINDOW(window),1);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void on_reveal_banner(GtkWidget *, main_window *widgets){
|
|
|
|
|
if (gtk_revealer_get_reveal_child(GTK_REVEALER(widgets->BannerRevealer))){
|
|
|
|
|
gtk_revealer_set_transition_type(GTK_REVEALER(widgets->BannerRevealer),GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
|
|
|
|
|
@ -347,90 +18,11 @@ void on_reveal_banner(GtkWidget *, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// void on_double_click_changed(GtkWidget *Switch, gboolean state, dictionary *widgetsD){
|
|
|
|
|
// *main_config.currentDoubleClick=state;
|
|
|
|
|
// update_double_clicks(widgetsD);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// int py_launch_app(char *name,char *args){
|
|
|
|
|
// char *path=malloc(strlen("python ./")+strlen(name)+6+strlen(args));
|
|
|
|
|
// sprintf(path,"python ./%s.py %s &",name,args);
|
|
|
|
|
// pthread_t thread_id;
|
|
|
|
|
// thread_output *thread=malloc(sizeof(thread_output));
|
|
|
|
|
// thread->command=path;
|
|
|
|
|
// thread->exitcode=malloc(sizeof(int));
|
|
|
|
|
// pthread_create(&thread_id, NULL, (void*)launch, thread);
|
|
|
|
|
// return *thread->exitcode;
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// int reload_list(IVGraphicals *section){
|
|
|
|
|
// gtk_icon_view_set_model(GTK_ICON_VIEW(section->IV),GTK_TREE_MODEL(section->LV));
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// void update_double_clicks(dictionary *widgetsD){
|
|
|
|
|
// for (dictionary *dict=widgetsD->first;dict!=NULL;dict=dict->next){
|
|
|
|
|
// main_window *widgets=(main_window*)dict->data;
|
|
|
|
|
// for (dictionary *ivdct=widgets->ICSys->first;ivdct!=NULL;ivdct=ivdct->next){
|
|
|
|
|
// IVGraphicals *IV=(IVGraphicals*)ivdct->data;
|
|
|
|
|
// if (strcmp(dict->key,"Gnome")==0){
|
|
|
|
|
// gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(IV->IV),!main_config.GnomeDoubleClick);
|
|
|
|
|
// } else{
|
|
|
|
|
// gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(IV->IV),!main_config.MainDoubleClick);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// int load_apps(IVGraphicals *section, apps *applist, int size){
|
|
|
|
|
// int catstofind=sizeof(section->categories)/sizeof(char*);
|
|
|
|
|
// int i=0,sz=0;
|
|
|
|
|
// for (int i=0;i<size;i++){
|
|
|
|
|
// if (check_categories(applist[i],section->categories)==1){
|
|
|
|
|
// GError *err=NULL;
|
|
|
|
|
// GtkTreeIter iter;
|
|
|
|
|
// gtk_list_store_append(section->LV,&iter);
|
|
|
|
|
// int sz= yon_get_icon_size(*main_config.currentThemeIconSize)+3;
|
|
|
|
|
// if (sz<34) sz=34;
|
|
|
|
|
// GtkIconTheme *icthm=gtk_icon_theme_get_default();
|
|
|
|
|
// GdkPixbuf *pixbuf=gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, applist[i].Icon,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SIZE),NULL);
|
|
|
|
|
// GtkTreePath *pth = gtk_tree_model_get_path(GTK_TREE_MODEL(section->LV),&iter);
|
|
|
|
|
// gtk_list_store_set(section->LV,&iter,0,applist[i].Name,1,0.0,2,0.5, 3, sz+5, 4, pixbuf, 5,yon_get_icon_size(*main_config.currentThemeIconSize)+10, -1);
|
|
|
|
|
// int cols = gtk_icon_view_get_columns(GTK_ICON_VIEW(section->IV));
|
|
|
|
|
// gtk_icon_view_set_columns(GTK_ICON_VIEW(section->IV), -1);
|
|
|
|
|
// gtk_icon_view_set_columns(GTK_ICON_VIEW(section->IV), cols);
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
// gtk_icon_view_set_model(GTK_ICON_VIEW(section->IV),GTK_TREE_MODEL(section->LV));
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// int load_apps_with_clear(IVGraphicals *section, apps *applist, int size){
|
|
|
|
|
// gtk_list_store_clear(section->LV);
|
|
|
|
|
// load_apps(section,applist,size);
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
// int hide_if_unfound(dictionary *widgetsD){
|
|
|
|
|
// for (dictionary *widgetsDc=widgetsD->first;widgetsDc!=NULL;widgetsDc=widgetsDc->next){
|
|
|
|
|
// main_window *widgets=(main_window*)widgetsDc->data;
|
|
|
|
|
// for (dictionary *icvd=widgets->ICSys->first;icvd!=NULL;icvd=icvd->next){
|
|
|
|
|
// IVGraphicals *icv=icvd->data;
|
|
|
|
|
// GtkTreeIter iter;
|
|
|
|
|
// if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(icv->LV),&iter)==0){
|
|
|
|
|
// gtk_widget_hide(icv->Box);
|
|
|
|
|
// gtk_widget_hide(GTK_WIDGET(icv->sep));
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void config_init(){
|
|
|
|
|
main_config.sections=NULL;
|
|
|
|
|
main_config.SettingsSections=NULL;
|
|
|
|
|
main_config.double_click=0;
|
|
|
|
|
main_config.apps_icon_size=24;
|
|
|
|
|
main_config.apps_icon_size=56;
|
|
|
|
|
main_config.labelDensity=0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -440,7 +32,7 @@ void yon_config_update(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (!yon_window_config_get_parameter(settings_section,icon_size_parameter,&main_config.apps_icon_size,YON_TYPE_INT)){
|
|
|
|
|
main_config.apps_icon_size=24;
|
|
|
|
|
main_config.apps_icon_size=56;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main_config.themes = g_hash_table_new(g_str_hash,g_str_equal);
|
|
|
|
|
@ -562,7 +154,7 @@ void yon_interface_update(main_window *widgets){
|
|
|
|
|
{
|
|
|
|
|
app_section *cur_section = yon_app_section_new();
|
|
|
|
|
cur_section->name = yon_char_new(_("Misc"));
|
|
|
|
|
cur_section->categories = yon_char_parsed_new(&cur_section->categories_size,"",NULL);
|
|
|
|
|
cur_section->categories = yon_char_parsed_new(&cur_section->categories_size,"X-UBL-SettingsManager;",NULL);
|
|
|
|
|
yon_dictionary_add_or_create_if_exists_with_data(main_config.sections,cur_section->name,cur_section);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -596,6 +188,7 @@ main_window *yon_main_window_setup(){
|
|
|
|
|
widgets->MainMenuItemAbout = yon_gtk_builder_get_widget(builder,"MainMenuItemAbout");
|
|
|
|
|
widgets->MainMenuItemDocumentation = yon_gtk_builder_get_widget(builder,"MainMenuItemDocumentation");
|
|
|
|
|
|
|
|
|
|
yon_gtk_window_setup(GTK_WINDOW(widgets->Window),NULL,TITLE_LABEL,icon_path,NULL);
|
|
|
|
|
yon_apps_init();
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->MainMenuItemSettings),"activate",G_CALLBACK(on_settings_open),widgets);
|
|
|
|
|
@ -624,28 +217,42 @@ main_window *yon_main_window_setup(){
|
|
|
|
|
int main(int argc, char *argv[]){
|
|
|
|
|
setlocale(LC_ALL, "");
|
|
|
|
|
textdomain (LocaleName);
|
|
|
|
|
yon_ubl_connect_config((_template_config*)&main_config);
|
|
|
|
|
yon_ubl_window_init(TITLE_LABEL,TITLE_INFO_LABEL,LocaleName,CssPath,LocaleName,version_application,WIKI_LINK);
|
|
|
|
|
|
|
|
|
|
static struct option long_options[] = {
|
|
|
|
|
{"lock-settings", 0, 0, 'l'},
|
|
|
|
|
{"help", 0, 0, 'h'},
|
|
|
|
|
{"version", 0, 0, 'v'},
|
|
|
|
|
{"clear-config", 0,0, 'c'},
|
|
|
|
|
};
|
|
|
|
|
int socket_find;
|
|
|
|
|
int option_index=0;
|
|
|
|
|
for (int i=0;i<argc;i++){
|
|
|
|
|
socket_find=getopt_long(argc,argv,"lhv",long_options,&option_index);
|
|
|
|
|
if (socket_find=='l')
|
|
|
|
|
main_config.lock_settings=1;
|
|
|
|
|
if (socket_find=='h') {
|
|
|
|
|
printf("%s\n",HELP_LABEL(NULL));
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
if (socket_find=='v') {
|
|
|
|
|
printf("%s\n",VERSION_LABEL);
|
|
|
|
|
exit(0);
|
|
|
|
|
}
|
|
|
|
|
int argument = getopt_long(argc,argv,"lhvc",long_options,&option_index);
|
|
|
|
|
switch (argument){
|
|
|
|
|
case 'l':
|
|
|
|
|
main_config.lock_settings=1;
|
|
|
|
|
break;
|
|
|
|
|
case 'h':
|
|
|
|
|
printf("%s\n",HELP_LABEL(NULL));
|
|
|
|
|
exit(0);
|
|
|
|
|
break;
|
|
|
|
|
case 'v':
|
|
|
|
|
printf("%s\n",VERSION_LABEL);
|
|
|
|
|
exit(0);
|
|
|
|
|
break;
|
|
|
|
|
case 'c': char *path = yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",template_app_information.app_tech_name,"/",NULL);
|
|
|
|
|
struct passwd *user = getpwnam(yon_ubl_root_user_get());
|
|
|
|
|
if (chown(path,user->pw_uid,user->pw_gid)){};
|
|
|
|
|
if (system(remove_config_dir_command)){};
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gtk_init(&argc, &argv);
|
|
|
|
|
yon_main_window_setup();
|
|
|
|
|
main_window *widgets = yon_main_window_setup();
|
|
|
|
|
GtkWidget *root_button = yon_root_button_new(argv,argc);
|
|
|
|
|
yon_root_button_init(root_button,GTK_WINDOW(widgets->Window));
|
|
|
|
|
gtk_menu_shell_prepend(GTK_MENU_SHELL(gtk_widget_get_parent(widgets->MainMenuItemDocumentation)),root_button);
|
|
|
|
|
|
|
|
|
|
GtkCssProvider *css=gtk_css_provider_new();
|
|
|
|
|
gtk_css_provider_load_from_resource(css,CssPath);
|
|
|
|
|
|