#ifndef UBL_SETTINGS_MANAGER_MAIN #define UBL_SETTINGS_MANAGER_MAIN #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "ubl-settings-manager.h" #define _(String) gettext(String) char **sectionremoval=NULL; int removalsize=0; char *local; config main_config; char *cats[2]={"XFCE","GTK"}; char *ubcatsPersonal[2]={"X-UBL-SettingsManager","X-UBL-PersonalSettings"}; char *ubcatsSystem[2]={"X-UBL-SettingsManager","X-UBL-SystemSettings"}; char *ubcatsHardware[2]={"X-UBL-SettingsManager","X-UBL-HardwareSettings"}; char *ubcatsMisc[1]={NULL}; int gnld=0; int stld=0; int cmld=0; void on_plug_added(GtkSocket* self, actionWidgets *builder){ //printf("Plug has been added!\n"); gtk_widget_set_vexpand(builder->HideWhileLaunch,0); gtk_widget_hide(builder->HideWhileLaunch); gtk_widget_set_vexpand(GTK_WIDGET(builder->socketplace),1); gtk_widget_set_vexpand(GTK_WIDGET(self),1); gtk_widget_show(builder->socketplace); if (builder->ButtonBackToMain!=NULL) gtk_widget_set_sensitive(builder->ButtonBackToMain,1); gtk_widget_show(GTK_WIDGET(self)); } void on_plug_removed(GtkSocket* self, actionWidgets *widgets){ gtk_widget_show(widgets->HideWhileLaunch); gtk_widget_set_vexpand(widgets->socketplace,0); gtk_widget_set_vexpand(widgets->HideWhileLaunch,1); //printf("Plug has been removed!\n\n\n"); } void on_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist){ //printf("\n\n\nActivated\n\n\n"); GtkTreeIter iter; char *name; gtk_tree_model_get_iter(gtk_icon_view_get_model(self),&iter,path); gtk_tree_model_get(gtk_icon_view_get_model(self),&iter,1,&name,-1); apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); if (!tempapp){}else{ char arg[100]; memset(arg,0,100); sprintf(arg,"--socket-id=%d",gtk_socket_get_id(GTK_SOCKET(applist->socket))); if (tempapp[0].Type==2) if (tempapp->Pluggable==1) py_launch_app(tempapp[0].Exec,arg); else py_launch_app(tempapp[0].Exec,""); else if (tempapp[0].Type==1){ if (tempapp->Pluggable==1) launch_app_with_arguments(tempapp[0].Exec,arg); else launch_app(tempapp[0].Exec); } } }; void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist){ GtkTreeIter iter; char *name; if (!applist->socket){}else{ gtk_widget_destroy(applist->socket); } applist->socket=create_socket(applist); char *socket_id=malloc(sizeof(gtk_socket_get_id(GTK_SOCKET(applist->socket)))/sizeof(int)); sprintf(socket_id,"%d",gtk_socket_get_id(GTK_SOCKET(applist->socket))); socket_id=yon_char_get_augumented("../ubl-info/ubl-info-bin --socket-id=",socket_id); socket_id=yon_char_get_augumented(socket_id," &"); system(socket_id); gtk_tree_model_get_iter(gtk_icon_view_get_model(self),&iter,path); gtk_tree_model_get(gtk_icon_view_get_model(self),&iter,1,&name,-1); apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); char arg[100]; memset(arg,0,100); sprintf(arg,"--socket-id=%d",gtk_socket_get_id(GTK_SOCKET(applist->socket))); if (tempapp[0].Type==2) if (tempapp->Pluggable==1) py_launch_app(tempapp[0].Exec,arg); else py_launch_app(tempapp[0].Exec,""); else if (tempapp[0].Type==1){ if (tempapp->Pluggable==1) launch_app_with_arguments(tempapp[0].Exec,arg); else launch_app(tempapp[0].Exec); } } void on_item_selection_changed(GtkIconView *IV, actionWidgets *widgets){ if (gtk_icon_view_get_selected_items(IV)>0){ dictionary *next=widgets->ICSys->first; for (dictionary *dct=next;dct!=NULL;dct=dct->next){ IVGraphicals *IVG=(IVGraphicals*)dct->data; if (IVG->IV!=IV) if (gtk_icon_view_get_selected_items(GTK_ICON_VIEW(IVG->IV))>0) gtk_icon_view_unselect_all(GTK_ICON_VIEW(IVG->IV)); } } }; void on_ButtonOpenHelp_activated(GtkWidget *button, GtkBuilder *builder){ if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder,"AlwaysOpenHelpCheckbox")))) { system("xdg-open http://ublinux.com"); } else { GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); gtk_widget_show(window); }; }; void on_backToSettingsButton_clicked(GtkWidget *button,actionWidgets *sctb){ GtkWidget *window=GTK_WIDGET(gtk_builder_get_object(sctb->builder,"HideWhileLaunch")); GtkWidget *socketplace=GTK_WIDGET(gtk_builder_get_object(sctb->builder,"socketplace")); gtk_widget_destroy(sctb->socket); sctb->socket=GTK_WIDGET(create_socket(sctb)); GtkWidget *backbutton=sctb->ButtonBackToMain; gtk_widget_set_sensitive(backbutton,0); }; void on_CancelHelpButton_activated(GtkWidget *button,GtkBuilder *builder){ GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); gtk_widget_hide(window); }; void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder){ system("xdg-open http://ublinux.com"); GtkWidget *window = GTK_WIDGET(gtk_builder_get_object(builder,"HelpSureWindow")); gtk_widget_hide(window); }; 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); printf("Saving config...\n"); actionWidgets *widgets=(actionWidgets*)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!=(actionWidgets*)widgetsD->data) widgets=(actionWidgets*)widgetsD->data; gtk_widget_hide(loaderWindow); gtk_window_present(GTK_WINDOW(widgets->SettingsWindow)); } GKeyFile *gfile=g_key_file_new(); int sz; if (main_config.iconsize==64) sz=4; if (main_config.iconsize==48) sz=3; if (main_config.iconsize==32) sz=2; if (main_config.iconsize==24) sz=1; char *fromint=malloc(5); memset(fromint,0,5); GError *err=NULL; 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); 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","IconSize",fromint); sprintf(fromint,"%d",main_config.iconSegmentSize); g_key_file_set_string(gfile,"window","IconSegmentSize",fromint); 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); load_apps_with_clear(IV,widgets->applist,widgets->appssize); } g_key_file_save_to_file(gfile,pth,NULL); gtk_widget_hide(widgets->SettingsWindow); //gtk_window_present(GTK_WINDOW(widgets->SettingsWindow)); }; void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *widgets){ /* TODO */ int position=gtk_paned_get_position(GTK_PANED(widgets->GnomePaned)); main_config.iconSegmentSize=position; if (position <115) position=115; double pos=((double)position-(1/(double)position*4)*500)/1.8; if (pos<110) pos=110; //printf("Paned moved to %f\n",pos); for (dictionary *dict=widgets->ICSys;dict!=NULL;dict=dict->next){ IVGraphicals *IV=(IVGraphicals*)dict->data; gtk_icon_view_set_item_width(GTK_ICON_VIEW(IV->IV),pos); } } int on_settingsOpen(GtkWidget *button, actionWidgets *widgets){ gtk_window_set_title(GTK_WINDOW(widgets->SettingsWindow),"UBLinux Settings Manager"); gtk_widget_set_size_request(widgets->SettingsWindow,400,250); gtk_window_set_icon_from_file(GTK_WINDOW(widgets->SettingsWindow),AppIconPath,NULL); gtk_widget_show_all(widgets->SettingsWindow); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),main_config.WindowTheme); int sz=1; if (main_config.iconsize==64) sz=4; if (main_config.iconsize==48) sz=3; if (main_config.iconsize==32) sz=2; if (main_config.iconsize==24) sz=1; gtk_range_set_value(GTK_RANGE(widgets->settingsSizeSlider),sz); char *tmp=malloc(6); sprintf(tmp,"%dx%d\0",main_config.iconsize,main_config.iconsize); gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),tmp); gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale("/usr/share/icons/hicolor/32x32/apps/ublinux-ubconfig.svg",main_config.iconsize,main_config.iconsize,1,NULL)); gtk_window_present(GTK_WINDOW(widgets->SettingsWindow)); }; int on_settings_icon_size_changed(GtkWidget* self, actionWidgets *widgets){ int val=(int)gtk_range_get_value(GTK_RANGE(self)); if ((int)val==1||(int)val==0){ gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale("/usr/share/icons/hicolor/32x32/apps/ublinux-ubconfig.svg",24,24,1,NULL)); gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); main_config.iconsize=24; } if ((int)val==2){ gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale("/usr/share/icons/hicolor/32x32/apps/ublinux-ubconfig.svg",32,32,1,NULL)); gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); main_config.iconsize=32; } if ((int)val==3){ gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale("/usr/share/icons/hicolor/32x32/apps/ublinux-ubconfig.svg",48,48,1,NULL)); gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); main_config.iconsize=48; } if ((int)val==4){ gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale("/usr/share/icons/hicolor/32x32/apps/ublinux-ubconfig.svg",64,64,1,NULL)); gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); main_config.iconsize=64; } }; int on_settings_cancel(GtkWidget *button, actionWidgets *widgets){ gtk_widget_hide(widgets->SettingsWindow); setup_config(); }; void on_caution_understand(GtkWidget *button,actionWidgets *widgets){ gtk_widget_hide(widgets->CautionWindow); } void on_section_settings_open(GtkButton* self,dictionary *cWidgets){ actionWidgets *widgets=(actionWidgets*)cWidgets->data; if (widgets->SettingsSections==NULL){ dictionary *dict=yon_dictionary_create_empty(); widgets->SettingsSections=dict; for (dictionary *pointer=widgets->ICSys->first;pointer!=NULL;pointer=pointer->next){ IVGraphicals *IV=(IVGraphicals*)pointer->data; SectionSettingSegment *Sgm=yon_create_section_setting(IV->sectionName,IV->categories); yon_segment_show(widgets,Sgm); dict->data=Sgm; dict->key=gtk_label_get_text(GTK_LABEL(Sgm->NameLabel)); dict->next=malloc(sizeof(dictionary)); dict->next->prev=dict; dict->next->first=dict->first; dict=dict->next; } dict=dict->prev; dict->next=NULL; } gtk_widget_show(widgets->SectionSettingsWindow); } void on_sections_edit(GtkWidget *button, actionWidgets *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, actionWidgets *widgets){ for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; if (segment!=NULL){ if (button==segment->EditButtonAccept){ 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))); 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, actionWidgets *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_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, actionWidgets *widgets){ for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; if (segment!=NULL){ if (button==segment->DragUpButton){ if (dct->prev!=NULL){ if (dct->prev==dct->first){ yon_dictionary_make_first(dct); dct->next->prev=dct->prev; dct->prev->next=dct->next; dct->next=dct->prev; dct->prev=NULL; dct->next->prev=dct; } else if (dct->next==NULL){ dct->next=dct->prev; dct->next->next=NULL; dct->next->prev->next=dct; dct->prev=dct->prev->prev; dct->next->prev=dct; } else{ dct->next->prev=dct->prev; dct->prev->next=dct->next; dct->next=dct->prev; dct->prev=dct->prev->prev; dct->prev->next=dct; dct->next->prev=dct; } yon_segments_hide(widgets); yon_segments_show(widgets); } } } else return; } }; void on_sections_move_down(GtkWidget *button, actionWidgets *widgets){ for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; if (segment!=NULL){ if (button==segment->DragDownButton){ if (dct->next!=NULL){ if (dct->next->next==NULL){ dct->next->prev=dct->prev; dct->prev->next=dct->next; dct->prev=dct->next; dct->next=NULL; //dct->next->prev=dct; dct->prev->next=dct; } else if (dct->prev==NULL){ yon_dictionary_make_first(dct->next); dct->prev=dct->next; dct->next=dct->next->next; dct->prev->prev=NULL; dct->next->prev=dct; dct->prev->next=dct; } else{ dct->next->prev=dct->prev; dct->prev->next=dct->next; dct->prev=dct->next; dct->next=dct->next->next; dct->next->prev=dct; dct->prev->next=dct; } yon_segments_hide(widgets); yon_segments_show(widgets); } } } else return; } }; void on_sections_delete(GtkWidget *button, actionWidgets *widgets){ for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; if (segment!=NULL){ if (button==segment->DragDownButton){ dct->prev->next=dct->next; dct->next->prev=dct->prev; gtk_container_remove(GTK_CONTAINER(widgets->SectionSettingsPack),segment->MainFrame); } } } }; void on_sections_add(GtkWidget *button, actionWidgets *widgets){ dictionary *dict=yon_dictionary_create_empty(); dictionary *dct=NULL; SectionSettingSegment *segment=yon_create_section_setting((char*)gtk_entry_get_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry)),(char*)gtk_entry_get_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry))); for (dct=widgets->SettingsSections->first;dct->next!=NULL;dct=dct->next){} dict->data=segment; dict->key=(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel)); dct->next=dict; dict->prev=dct; dict->first=dct->first; yon_segments_hide(widgets); yon_segments_show(widgets); gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry),""); } void on_sections_new_clear(GtkWidget *button, actionWidgets *widgets){ //printf("w54y3563sthts\n"); gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddNameEntry),""); gtk_entry_set_text(GTK_ENTRY(widgets->SectionSettingAddCategoriesEntry),""); } void on_sections_close(GtkWidget *button, actionWidgets *widgets){ //printf("snnnnnnthtsgyuilgg\n"); gtk_widget_hide(widgets->SectionSettingsWindow); } void on_sections_save(GtkWidget *button, actionWidgets *widgets){ 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;inext=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); } yon_show_icon_views(widgets->ICSys,widgets); //hide_if_unfound(widgets); } void on_section_delete(GtkWidget *button, actionWidgets *widgets){ for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; if (segment!=NULL){ if (button==segment->ButtonDelete){ if (dct->prev==NULL&&dct->next==NULL){ }else if (dct->next==NULL){ dct->prev->next=NULL; }else if (dct->prev==NULL){ dct->next->prev=NULL; } else if (dct->prev==NULL){ dct->next->prev=NULL; }else { dct->prev->next=dct->next; dct->next->prev=dct->prev; } if (sectionremoval==NULL){ removalsize++; sectionremoval=malloc(removalsize*sizeof(char**)); char *nm=(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel)); sectionremoval[0]=malloc(strlen(nm)); memset(sectionremoval[0],0,strlen(nm)); sprintf(sectionremoval[0],"%s",nm); } else { removalsize++; sectionremoval=realloc(sectionremoval,removalsize*sizeof(char**)); char *nm=(char*)gtk_label_get_text(GTK_LABEL(segment->NameLabel)); sectionremoval[removalsize-1]=malloc(strlen(nm)); memset(sectionremoval[removalsize-1],0,strlen(nm)); sprintf(sectionremoval[removalsize-1],"%s",nm); } gtk_container_remove(GTK_CONTAINER(widgets->SectionSettingsPack),segment->MainFrame); } } } } void on_resized (GtkWidget *window, GdkEventConfigure *event, dictionary *widgetsD){ actionWidgets *widgets=(actionWidgets*)widgetsD->data; int x,y; gtk_window_get_size(GTK_WINDOW(window),&main_config.windowWidth,&main_config.windowHeight); if (main_config.windowWidth<1240){ if (stld==0){ stld=1; main_config.WindowTheme=0; gtk_window_set_resizable(GTK_WINDOW(window),0); gtk_window_get_position(GTK_WINDOW(window),&main_config.windowPosX,&main_config.windowPosY); gtk_window_get_size(GTK_WINDOW(window),&main_config.windowWidth,&main_config.windowHeight); yon_switch_theme(&widgetsD,yon_dictionary_find(&widgetsD,"Main")); main_config.iconsize=24; for (dictionary *dict=widgets->ICSys->first;dict!=NULL;dict=dict->next){ IVGraphicals *IV=(IVGraphicals*)dict->data; load_apps_with_clear(IV,widgets->applist,widgets->appssize); } gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); gtk_widget_hide(widgets->window); } }else { if (stld==1){ stld=0; cmld=0; } } } void on_resized_done (GtkWidget *window, GdkEvent *event, dictionary *widgetsD){ actionWidgets *widgets=(actionWidgets*)widgetsD->data; if (event->type==GDK_CONFIGURE){ if (stld==1){ gtk_window_set_resizable(GTK_WINDOW(window),1); } } } void on_about_system(GtkWidget *button, actionWidgets *widgets){ char *socket_id=malloc(sizeof(gtk_socket_get_id(GTK_SOCKET(widgets->socket)))/sizeof(int)); sprintf(socket_id,"%d",gtk_socket_get_id(GTK_SOCKET(widgets->socket))); socket_id=yon_char_get_augumented(ubl_settings_infoPathLaunch,socket_id); socket_id=yon_char_get_augumented(socket_id," &"); system(socket_id); } void launch_app_with_arguments(char *name, char *args){ char *path=malloc(strlen(name)+strlen(args)+4); memset(path,0,strlen(name)+strlen(args)+4); memcpy(path,name,strlen(name)); memcpy(path+strlen(name)," ",1); strcat(args," &"); strcat(path,args); system(("/usr/bin/%s",path)); }; void launch_app(char *name){ char *path=yon_char_get_augumented(name," &"); system(path); }; void 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); system(path); }; apps *get_app_by_name(apps *applist,char *name, int size){ for (int i=0;iIV),GTK_TREE_MODEL(section->LV)); gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(section->IV),0); gtk_icon_view_set_text_column(GTK_ICON_VIEW(section->IV),1); } int load_apps(IVGraphicals *section, apps *applist, int size){ int catstofind=sizeof(section->categories)/sizeof(char*); int i=0; for (int i=0;icategories)==1){ GError *err=NULL; char *path=malloc(strlen(IconPicturesPath)+strlen(applist[i].Icon)+7); memset(path,0,strlen(IconPicturesPath)+strlen(applist[i].Icon)+7); memcpy(path,IconPicturesPath,strlen(IconPicturesPath)); path=yon_char_get_augumented(path,applist[i].Icon); path=yon_char_get_augumented(path,PictureFormatMain); GdkPixbuf *pixbuf; pixbuf=gdk_pixbuf_new_from_file_at_size(path,main_config.iconsize,main_config.iconsize,NULL); if (!pixbuf) { pixbuf=gdk_pixbuf_new_from_file_at_size(ErrIconPicturePath,main_config.iconsize,main_config.iconsize,NULL); }; GtkTreeIter iter; gtk_list_store_append(section->LV,&iter); char *ChosenName; ChosenName=applist[i].Name; gtk_list_store_set(section->LV,&iter,0,pixbuf,1,ChosenName,-1); } } gtk_icon_view_set_model(GTK_ICON_VIEW(section->IV),GTK_TREE_MODEL(section->LV)); gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(section->IV),0); gtk_icon_view_set_text_column(GTK_ICON_VIEW(section->IV),1); }; 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){ actionWidgets *widgets=(actionWidgets*)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)); } } } } GtkWidget *create_socket(actionWidgets *builder){ GtkWidget *socket; socket = gtk_socket_new(); g_signal_connect(G_OBJECT(socket),"plug-added",G_CALLBACK(on_plug_added),builder); g_signal_connect(G_OBJECT(socket),"plug-removed",G_CALLBACK(on_plug_removed),builder); g_signal_connect(G_OBJECT(socket),"destroy",G_CALLBACK(on_plug_removed),builder); gtk_box_pack_start(GTK_BOX(builder->socketplace),socket,true,true,0); return socket; }; void sort_apps(apps *applist,int size){ apps tmp; if (size>2) { for (int i=1;id_name); file=fopen(path,"r"); //printf("%s\n",path); if (strlen(de->d_name)>9) { char *extension=strstr(path,"."); if (extension!=NULL) { if (strcmp(extension,".desktop")==0) { apps tempapp; GKeyFile *gfile=g_key_file_new(); 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",NULL); 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==NULL) tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-XfcePluggable",NULL); if (size==0){ applist=(apps*)malloc(size+1*sizeof(apps)); applist[0].Name=malloc(strlen(tempapp.Name)+1); applist[0].Categories=malloc(strlen(tempapp.Categories)+1); applist[0].Exec=malloc(strlen(tempapp.Exec)+1); applist[0].Icon=malloc(strlen(tempapp.Icon)+1); strncpy(applist[0].Name,tempapp.Name,strlen(tempapp.Name)); applist[0].Name[strlen(tempapp.Name)]='\0'; strncpy(applist[0].Categories,tempapp.Categories,strlen(tempapp.Categories)); applist[0].Categories[strlen(tempapp.Categories)]='\0'; strncpy(applist[0].Exec,tempapp.Exec,strlen(tempapp.Exec)); applist[0].Exec[strlen(tempapp.Exec)]='\0'; strncpy(applist[0].Icon,tempapp.Icon,strlen(tempapp.Icon)); applist[0].Icon[strlen(tempapp.Icon)]='\0'; applist[0].Type=tempapp.Type; applist[0].Pluggable=tempapp.Pluggable; size++; } else { applist=(apps*)realloc(applist,(size+1)*sizeof(apps)); applist[size].Name=malloc(strlen(tempapp.Name)+1); applist[size].Categories=malloc(strlen(tempapp.Categories)+1); applist[size].Exec=malloc(strlen(tempapp.Exec)+1); applist[size].Icon=malloc(strlen(tempapp.Icon)+1); strncpy(applist[size].Name,tempapp.Name,strlen(tempapp.Name)); applist[size].Name[strlen(tempapp.Name)]='\0'; //printf("%s\n",applist[size].Name); strncpy(applist[size].Categories,tempapp.Categories,strlen(tempapp.Categories)); applist[size].Categories[strlen(tempapp.Categories)]='\0'; strncpy(applist[size].Exec,tempapp.Exec,strlen(tempapp.Exec)); applist[size].Exec[strlen(tempapp.Exec)]='\0'; strncpy(applist[size].Icon,tempapp.Icon,strlen(tempapp.Icon)); applist[size].Icon[strlen(tempapp.Icon)]='\0'; applist[size].Pluggable=tempapp.Pluggable; applist[size].Type=tempapp.Type; size++; } } } } } } //printf("Closing apps configuration...\n"); *sizef=size; return applist; }; int check_categories(apps app, char *catstocheck){ if (!catstocheck || strcmp(catstocheck,"")==0){ char *found=strstr(app.Categories,"X-UBL-SettingsManager"); char *perfound=strstr(app.Categories,"X-UBL-PersonalSettings"); char *harfound=strstr(app.Categories,"X-UBL-HardwareSettings"); char *sysfound=strstr(app.Categories,"X-UBL-SystemSettings"); if (found==NULL||perfound!=NULL||harfound!=NULL||sysfound!=NULL) return 0; return 1; } else { char *left_cats=catstocheck; char *cat=strstr(left_cats,";"); if (!cat) return 0; char *find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); char *found=strstr(app.Categories,find_it); int to_find=0, n_found=0; to_find++; if (!found) return 0; n_found++; while (cat){ char *fcat=strstr(app.Categories,";"); cat=strstr(cat+1,";"); if (!cat) break; find_it=yon_cut(left_cats,(strlen(left_cats)-strlen(cat)),0); char *found=strstr(app.Categories,find_it); to_find++; if (!found) break; n_found++; left_cats=cat+1; if (strlen(left_cats)==0 ||strcmp(left_cats,'\0')==0) break; } if (to_find==n_found) return 1; else return 0; } }; int setup_config(){ FILE *file; GError *err=NULL; printf("1\n"); main_config.sections=malloc(sizeof(dictionary)); main_config.sections->data=NULL; main_config.sections->next=NULL; main_config.sections->prev=NULL; main_config.sections->first=NULL; GKeyFile *configfile = g_key_file_new(); char *pth=malloc(7+strlen(UserConfigPath)+strlen(getlogin())); sprintf(pth,"%s%s%s","/home/",getlogin(),UserConfigPath); printf("%s\n",getlogin()); printf("%s\n",pth); printf("%s\n",GlobalConfigPath); g_key_file_load_from_file(configfile,pth,G_KEY_FILE_KEEP_TRANSLATIONS,&err); if (err){ g_error_free(err); err=NULL; g_key_file_load_from_file(configfile,GlobalConfigPath,G_KEY_FILE_KEEP_TRANSLATIONS,&err); if (err){ g_error_free(err); return 0; } } char *foroutput=NULL; char *line=NULL; printf("1\n"); main_config.windowPosX=g_key_file_get_integer(configfile,"window","WindowPosX",NULL); main_config.windowPosY=g_key_file_get_integer(configfile,"window","WindowPosY",NULL); main_config.windowWidth=g_key_file_get_integer(configfile,"window","WindowWidth",NULL); main_config.windowHeight=g_key_file_get_integer(configfile,"window","WindowHeight",NULL); main_config.WindowTheme=g_key_file_get_integer(configfile,"window","WindowTheme",NULL); main_config.iconsize=g_key_file_get_integer(configfile,"window","IconSize",NULL); main_config.iconSegmentSize=g_key_file_get_integer(configfile,"window","IconSegmentSize",NULL); yon_icon_size_convert(0); gsize length=0; printf("1\n"); char **a=g_key_file_get_keys(configfile,"sections",&length,NULL); if (!a){yon_set_default_sections(&main_config.sections);} else { for (int i=0;inext=NULL; } printf("1\n"); if (main_config.windowWidth<1024&&main_config.windowHeight<720){ main_config.WindowTheme=0; } return 1; }; char *yon_cut(char *source, int size, int startpos){ char *cut=NULL; cut=malloc(size+1); memset(cut,0,size+1); memcpy(cut,source+startpos,size); return cut; } char *yon_char_divide(char *source, int dividepos){ char *cut=malloc(dividepos+1); memset(cut,0,dividepos+1); memcpy(cut,source,dividepos); char *left=malloc(strlen(source)-strlen(cut)); memset(left,0,strlen(source)-strlen(cut)); memcpy(left,source+dividepos+1,(strlen(source)-dividepos)); memset(source,0,strlen(source)); memcpy(source,left,strlen(left)); return cut; } char *yon_char_divide_search(char *source, char* dividepos, int delete_divider){ char *cut=strstr(source,dividepos); int leng=strlen(source)-strlen(cut); cut=yon_char_divide(source,leng); return cut; } void yon_set_default_sections(dictionary **section){ *section=malloc(sizeof(dictionary)); IconSection *sec=malloc(sizeof(IconSection)); sec->section="Personal"; sec->categories="X-UBL-SettingsManager;X-UBL-PersonalSettings;"; (*section)->data=sec; (*section)->first=*section; (*section)->next=malloc(sizeof(dictionary)); (*section)->next->prev=*section; (*section)->next->first=(*section)->first; *section=(*section)->next; sec=malloc(sizeof(IconSection)); sec->section="Hardware"; sec->categories="X-UBL-SettingsManager;X-UBL-HardwareSettings;"; (*section)->data=sec; (*section)->next=malloc(sizeof(dictionary)); (*section)->next->prev=*section; (*section)->next->first=(*section)->first; *section=(*section)->next; sec=malloc(sizeof(IconSection)); sec->section="System"; sec->categories="X-UBL-SettingsManager;X-UBL-SystemSettings;"; (*section)->data=sec; (*section)->next=malloc(sizeof(dictionary)); (*section)->next->prev=*section; (*section)->next->first=(*section)->first; *section=(*section)->next; sec=malloc(sizeof(IconSection)); sec->section="Misc"; sec->categories="X-UBL-SettingsManager;"; (*section)->data=sec; *section=(*section)->first; } IVGraphicals *yon_create_single_section_IV(char *name,char *cats){ IVGraphicals *IVG=malloc(sizeof(IVGraphicals)); GtkWidget *box=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); GtkWidget *iv=gtk_icon_view_new(); GtkWidget *label=gtk_label_new(_(name)); gtk_widget_set_name(label,"iconlabel"); if (main_config.WindowTheme==1) { gtk_icon_view_set_columns(GTK_ICON_VIEW(iv),1); gtk_widget_set_name(iv,"GnomeIcon"); gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(iv),1); gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); } GtkWidget *sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); GtkListStore *lv=gtk_list_store_new(2, GDK_TYPE_PIXBUF,G_TYPE_STRING); gtk_widget_set_halign(box,0); gtk_widget_set_valign(box,1); gtk_icon_view_set_pixbuf_column(GTK_ICON_VIEW(iv),0); gtk_icon_view_set_text_column(GTK_ICON_VIEW(iv),1); gtk_icon_view_set_item_width(GTK_ICON_VIEW(iv),75); gtk_icon_view_set_model(GTK_ICON_VIEW(iv),GTK_TREE_MODEL(lv)); gtk_label_set_xalign(GTK_LABEL(label),0); gtk_box_pack_start(GTK_BOX(box),label,FALSE,FALSE,0); gtk_box_pack_start(GTK_BOX(box),sep,FALSE,FALSE,0); gtk_box_pack_start(GTK_BOX(box),iv,FALSE,FALSE,0); IVG->sectionName=name; IVG->categories=cats; IVG->LV=lv; IVG->Box=box; IVG->IV=iv; IVG->label=label; IVG->sep=sep; return IVG; } dictionary *yon_create_icon_section_list(dictionary *sections){ if (!sections) return NULL; IVGraphicals *IVSections; dictionary *IVDict=NULL; sections=sections->first; while (sections!=NULL){ IconSection *name=(IconSection*)sections->data; IVSections=yon_create_single_section_IV(name->section,name->categories); // loadapps(IVSections,// applist,size //); if (!IVDict) { IVDict=yon_dictionary_create_empty(); IVDict->key=name->section; IVDict->data=IVSections; IVDict->first=IVDict; } else { IVDict->next=malloc(sizeof(dictionary)); IVDict->next->prev=IVDict; IVDict->next->first=IVDict->first; IVDict=IVDict->next; IVDict->key=name->section; IVDict->data=IVSections; } sections=sections->next; } IVDict->next=NULL; return IVDict->first; } void yon_check_path(char *path){ FILE *fp; char *pth=malloc(255); memset(path,0,255); fp = popen("screenfetch -n -w -N", "r"); fgets(pth, 255,fp)!=NULL; } dictionary *yon_section_new(dictionary *section, char *section_name, char *categories){ section->next=NULL; IconSection *sct=malloc(sizeof(IconSection)); dictionary *dict=malloc(sizeof(dictionary)); sct->section=section_name; sct->categories=categories; dict->data=sct; if (!section->data){ section->data=dict->data; section->first=section; section->key=section_name; } else { dict->first=section->first; section->next=dict; dict->prev=section; dict->key=section_name; section=section->next; } return section; } void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned){ for (dictionary *dict=icdict->first;dict!=NULL;dict=dict->next){ IVGraphicals *icv=(IVGraphicals*)dict->data; int width=gtk_paned_get_position(GTK_PANED(paned)); if (width < 115) width=115; gtk_icon_view_set_item_width(GTK_ICON_VIEW(icv->IV),width); } } char *yon_char_get_augumented(char *source, char *append){ int size=strlen(source)+strlen(append)+1; char *final=malloc(size); memset(final,0,size); sprintf(final,"%s%s",source,append); return final; } int yon_show_icon_views(dictionary *IVS,actionWidgets *widgets){ for (dictionary *dct=IVS->first;dct!=NULL;dct=dct->next){ IVGraphicals *iv=dct->data; gtk_widget_show_all(iv->Box); gtk_box_pack_start(GTK_BOX(widgets->icvpack),iv->Box,FALSE,FALSE,0); if (main_config.WindowTheme==0) g_signal_connect(G_OBJECT(iv->IV),"item-activated",G_CALLBACK(on_Item_activated),widgets); else if (main_config.WindowTheme==1) g_signal_connect(G_OBJECT(iv->IV),"item-activated",G_CALLBACK(on_gnome_Item_activated),widgets); g_signal_connect(G_OBJECT(iv->IV),"selection-changed",G_CALLBACK(on_item_selection_changed),widgets); } } dictionary *yon_dictionary_find(dictionary **dict, char *key){ dictionary *dct=*dict; for (dictionary *pointer=dct->first;pointer!=NULL;pointer=pointer->next){ if (strcmp(pointer->key,key)==0){ *dict=pointer; return pointer; } } return NULL; } void yon_switch_theme(dictionary **dict, dictionary *newone){ dictionary *dct=*dict; actionWidgets *widgets=(actionWidgets*)dct->data; gtk_widget_hide(widgets->window); *dict=newone; dct=*dict; widgets=(actionWidgets*)dct->data; gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY); if (strcmp(dct->key,"Gnome")==0){ int x,y; GdkRectangle workarea; gdk_monitor_get_workarea(gdk_display_get_monitor(gdk_screen_get_display(gtk_window_get_screen(GTK_WINDOW(widgets->window))),0),&workarea); gtk_window_get_size(GTK_WINDOW(widgets->window),&x, &y); if (workarea.width<1240&&workarea.height<720){ gtk_widget_show(widgets->CautionWindow); dictionary *founddict=yon_dictionary_find(dict,"Main"); dct=yon_dictionary_find(dict,"Gnome"); yon_switch_theme(&dct,founddict); gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight); gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY); main_config.WindowTheme=0; main_config.curThemeName="Main"; gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),0); gtk_window_present(GTK_WINDOW(widgets->CautionWindow)); gtk_widget_show(widgets->MenuItemAboutSystem); } else if (x<1240){ gtk_window_resize(GTK_WINDOW(widgets->window),1245,y); main_config.WindowTheme=1; main_config.curThemeName="Gnome"; gtk_widget_show(widgets->window); gtk_widget_hide(widgets->MenuItemAboutSystem); }else{ main_config.WindowTheme=1; main_config.curThemeName="Gnome"; gtk_widget_show(widgets->window); gtk_widget_hide(widgets->MenuItemAboutSystem); } } else { gtk_widget_show(widgets->window); main_config.WindowTheme=0; main_config.curThemeName="Main"; gtk_widget_show(widgets->MenuItemAboutSystem); } } void yon_icon_size_convert(int mode){ if (mode==0){ if (main_config.iconsize==1) main_config.iconsize=24; if (main_config.iconsize==2) main_config.iconsize=32; if (main_config.iconsize==3) main_config.iconsize=48; if (main_config.iconsize==4) main_config.iconsize=64; } else if (mode==1){ if (main_config.iconsize==24) main_config.iconsize=1; if (main_config.iconsize==32) main_config.iconsize=2; if (main_config.iconsize==48) main_config.iconsize=3; if (main_config.iconsize==64) main_config.iconsize=4; } } SectionSettingSegment *yon_create_section_setting(char *name, char *categories){ SectionSettingSegment *segment=malloc(sizeof(SectionSettingSegment)); segment->MainFrame=gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME(segment->MainFrame),GTK_SHADOW_IN); segment->MainBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); segment->ElemBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); 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->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); segment->NameEntry=gtk_entry_new(); gtk_entry_set_text(GTK_ENTRY(segment->NameEntry),name); segment->NameLabel=gtk_label_new(name); segment->CategoriesEntry=gtk_entry_new(); if (categories[strlen(categories)-1]!=';'){ char *tmp=malloc(strlen(categories)+1); sprintf(tmp,"%s;",categories); printf("\n\n"); categories=realloc(tmp,strlen(tmp)); } 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->DeleditBox=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,0); segment->ButtonDelete=gtk_button_new_from_icon_name("edit-delete",GTK_ICON_SIZE_BUTTON); gtk_widget_set_name(segment->NameLabel,"SegName"); gtk_widget_set_name(segment->CategoriesLabel,"SegCat"); gtk_container_add(GTK_CONTAINER(segment->MainFrame),segment->MainBox); gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->DragButtonBox,FALSE,FALSE,0); gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->ElemBox,TRUE,TRUE,0); gtk_box_pack_start(GTK_BOX(segment->DragButtonBox),segment->DragUpButton,FALSE,FALSE,0); gtk_box_pack_start(GTK_BOX(segment->DragButtonBox),segment->DragDownButton,FALSE,FALSE,0); gtk_box_pack_start(GTK_BOX(segment->ElemBox),segment->NameBox,FALSE,FALSE,0); gtk_box_pack_end(GTK_BOX(segment->ElemBox),segment->CategoriesBox,FALSE,FALSE,0); gtk_box_pack_start(GTK_BOX(segment->MainBox),segment->OptionBox,FALSE,FALSE,0); gtk_box_pack_start(GTK_BOX(segment->NameBox),segment->NameEntry,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(segment->NameBox),segment->NameLabel,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(segment->CategoriesBox),segment->CategoriesEntry,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(segment->CategoriesBox),segment->CategoriesLabel,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(segment->EditButtonBox),segment->EditButtonAccept,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(segment->EditButtonBox),segment->EditButtonCancel,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(segment->DeleditBox),segment->ButtonEdit,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(segment->DeleditBox),segment->ButtonDelete,FALSE,FALSE,5); gtk_box_pack_start(GTK_BOX(segment->OptionBox),segment->DeleditBox,FALSE,FALSE,0); gtk_box_pack_start(GTK_BOX(segment->OptionBox),segment->EditButtonBox,FALSE,FALSE,0); gtk_widget_set_size_request(segment->NameLabel,60,10); gtk_widget_set_margin_start(segment->DragButtonBox,5); gtk_widget_set_margin_end(segment->OptionBox,5); gtk_widget_set_margin_bottom(segment->MainFrame,3); gtk_widget_set_margin_bottom(segment->DragButtonBox,3); gtk_widget_set_margin_top(segment->DragButtonBox,3); gtk_widget_set_margin_end(segment->DragUpButton,3); gtk_widget_set_halign(segment->NameEntry,GTK_ALIGN_START); gtk_widget_set_halign(segment->NameLabel,GTK_ALIGN_END); gtk_widget_set_valign(segment->OptionBox,GTK_ALIGN_CENTER); gtk_label_set_xalign(GTK_LABEL(segment->NameLabel),0); gtk_label_set_xalign(GTK_LABEL(segment->CategoriesLabel),0); gtk_widget_set_vexpand(segment->ElemBox,0); gtk_widget_set_vexpand(segment->NameBox,0); gtk_widget_set_vexpand(segment->CategoriesBox,0); gtk_widget_set_vexpand(segment->NameEntry,0); gtk_widget_set_vexpand(segment->NameLabel,0); gtk_widget_set_vexpand(segment->CategoriesEntry,0); gtk_widget_set_vexpand(segment->CategoriesLabel,0); gtk_widget_show_all(segment->MainFrame); gtk_widget_hide(segment->NameEntry); gtk_widget_hide(segment->CategoriesEntry); gtk_widget_hide(segment->EditButtonBox); return segment; } dictionary *yon_dictionary_create_empty(){ dictionary *dict=malloc(sizeof(dictionary)); dict->data=NULL; dict->key=NULL; dict->next=NULL; dict->prev=NULL; dict->first=dict; return dict; } void yon_segment_show(actionWidgets *widgets, SectionSettingSegment *sgm){ gtk_box_pack_start(GTK_BOX(widgets->SectionSettingsPack),sgm->MainFrame,FALSE,FALSE,5); g_signal_connect(G_OBJECT(sgm->ButtonEdit),"clicked",G_CALLBACK(on_sections_edit), widgets); g_signal_connect(G_OBJECT(sgm->EditButtonAccept),"clicked",G_CALLBACK(on_sections_accept), widgets); g_signal_connect(G_OBJECT(sgm->EditButtonCancel),"clicked",G_CALLBACK(on_sections_cancel), widgets); g_signal_connect(G_OBJECT(sgm->DragUpButton),"clicked",G_CALLBACK(on_sections_move_up), widgets); g_signal_connect(G_OBJECT(sgm->DragDownButton),"clicked",G_CALLBACK(on_sections_move_down), widgets); g_signal_connect(G_OBJECT(sgm->ButtonDelete),"clicked",G_CALLBACK(on_section_delete), widgets); } void yon_segments_show(actionWidgets *widgets){ for (dictionary *dict=widgets->SettingsSections->first;dict!=NULL;dict=dict->next){ SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data; if (sgm!=NULL) gtk_box_pack_start(GTK_BOX(widgets->SectionSettingsPack),sgm->MainFrame,FALSE,FALSE,5); else return; } }; void yon_segments_hide(actionWidgets *widgets){ for (dictionary *dict=widgets->SettingsSections->first;dict!=NULL;dict=dict->next){ SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data; if (sgm!=NULL){ g_object_ref(G_OBJECT(sgm->MainFrame)); gtk_container_remove(GTK_CONTAINER(widgets->SectionSettingsPack),sgm->MainFrame); } else return; } } void yon_dictionary_make_first(dictionary *dict){ for (dictionary *dct=dict->first;dct!=NULL;dct=dct->next){ dct->first=dict; } } void yon_small_window_theme_change(actionWidgets *widgets){ } dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *theme_id, apps *applist, int appsize){ dictionary *widgets=*widgetss; actionWidgets *curWidgets=(actionWidgets*)widgets->data; if (curWidgets==NULL) { curWidgets=malloc(sizeof(actionWidgets)); widgets->data=curWidgets; } widgets->key=theme_id; curWidgets->builder=builder; curWidgets->window=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Window"))); curWidgets->DesktopBasic=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"HideWhileLaunch"))); curWidgets->DesktopSocket=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"socketplace"))); curWidgets->ButtonBackToMain=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"backToSettingsButton"))); curWidgets->appSettings=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"appSettings"))); curWidgets->socketplace=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"socketplace"))); curWidgets->HideWhileLaunch=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"HideWhileLaunch"))); curWidgets->workingwindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"workingwindow"))); curWidgets->icvpack=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"icvpack"))); curWidgets->GnomePaned=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Paned"))); curWidgets->GnomeInfoLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"InfoLabel"))); curWidgets->GnomeInfoDetailsLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"InfoDetailsLabel"))); curWidgets->SettingsSections=NULL; gtk_style_context_add_class(gtk_widget_get_style_context(curWidgets->icvpack),"iconview"); curWidgets->socket=GTK_WIDGET(create_socket(curWidgets)); if (curWidgets->ButtonBackToMain!=NULL) gtk_button_set_label(GTK_BUTTON(curWidgets->ButtonBackToMain),_("Back to settings")); gtk_window_set_title(GTK_WINDOW(curWidgets->window),"UBLinux Settings Manager"); g_signal_connect(G_OBJECT(curWidgets->window), "destroy", G_CALLBACK(gtk_main_quit), NULL); if (curWidgets->GnomePaned!=NULL){ gtk_paned_set_position(GTK_PANED(curWidgets->GnomePaned),main_config.iconSegmentSize); g_signal_connect(G_OBJECT(curWidgets->GnomePaned), "notify::position", G_CALLBACK(on_paned_move), curWidgets); } if (strcmp(theme_id,"Gnome")==0){ char *socket_id=malloc(sizeof(gtk_socket_get_id(GTK_SOCKET(curWidgets->socket)))/sizeof(int)); sprintf(socket_id,"%d",gtk_socket_get_id(GTK_SOCKET(curWidgets->socket))); socket_id=yon_char_get_augumented(ubl_settings_infoPathLaunch,socket_id); socket_id=yon_char_get_augumented(socket_id," &"); system(socket_id); g_signal_connect(G_OBJECT(curWidgets->window), "configure-event", G_CALLBACK(on_resized), widgets); g_signal_connect(G_OBJECT(curWidgets->window), "event-after", G_CALLBACK(on_resized_done), widgets); } 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 GNOME"); // Standard for all themes curWidgets->settingsThemeChooser=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsThemeChooser")); curWidgets->SettingsWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SettingsWindow")); curWidgets->MenuItemSettings=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"MenuItemSettings")); curWidgets->MenuItemDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"MenuItemDocumentation")); curWidgets->MenuItemAboutSystem=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"MenuItemAboutSystem")); curWidgets->DialogOpenDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"HelpSureWindow")); curWidgets->CancelHelpButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"CancelHelpButton")); curWidgets->ReadHelpButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"ReadHelpButton")); curWidgets->AlwaysOpenDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"AlwaysOpenHelpCheckbox")); curWidgets->helpHeader=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"helpHeader")); curWidgets->helpText=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"helpText")); curWidgets->settingsSizeInfoLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSizeInfoLabel")); curWidgets->settingsIcon=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsIcon")); curWidgets->settingsSectionsSettingsButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSectionsSettingsButton")); curWidgets->SectionSettingsWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsWindow")); curWidgets->SectionSettingsPack=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsPack")); curWidgets->settingsSizeSlider=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSizeSlider")); curWidgets->settingsAccept=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsAccept")); curWidgets->settingsCancel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsCancel")); curWidgets->settingsSubmenuLabelSize=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSubmenuLabelSize")); curWidgets->settingsSubmenuLabelTheme=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsSubmenuLabelTheme")); curWidgets->SectionSettingAddButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsAddButton")); curWidgets->SectionSettingAddNameEntry=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsAddNameEntry")); curWidgets->SectionSettingAddCategoriesEntry=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsAddCategoriesEntry")); curWidgets->SectionSettingsClearEntryButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsClearEntryButton")); curWidgets->SectionSettingsSaveButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsSaveButton")); curWidgets->SectionSettingsCloseButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"SectionSettingsCloseButton")); curWidgets->CautionWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"CautionWindow")); curWidgets->CautionUnderstandButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"CautionUnderstandButton")); curWidgets->applist=applist; curWidgets->appssize=appsize; gtk_widget_set_size_request(curWidgets->window,800,600); gtk_window_resize(GTK_WINDOW(curWidgets->window),main_config.windowWidth,main_config.windowHeight); gtk_window_set_icon_from_file(GTK_WINDOW(curWidgets->window),AppIconPath,NULL); gtk_window_set_icon_from_file(GTK_WINDOW(curWidgets->SectionSettingsWindow),AppIconPath,NULL); if (gnld==0){ gnld=1; g_signal_connect(G_OBJECT(curWidgets->MenuItemDocumentation), "activate", G_CALLBACK(on_ButtonOpenHelp_activated), curWidgets->builder); g_signal_connect(G_OBJECT(curWidgets->CancelHelpButton), "clicked", G_CALLBACK(on_CancelHelpButton_activated), curWidgets->builder); g_signal_connect(G_OBJECT(curWidgets->ReadHelpButton), "clicked", G_CALLBACK(on_ReadHelpButton_activated), curWidgets->builder); g_signal_connect(G_OBJECT(curWidgets->MenuItemSettings), "activate", G_CALLBACK(on_settingsOpen), curWidgets); g_signal_connect(G_OBJECT(curWidgets->settingsSizeSlider), "value-changed", G_CALLBACK(on_settings_icon_size_changed), curWidgets); g_signal_connect(G_OBJECT(curWidgets->settingsCancel), "clicked", G_CALLBACK(on_settings_cancel), curWidgets); g_signal_connect(G_OBJECT(curWidgets->settingsAccept), "clicked", G_CALLBACK(on_settings_accept), widgetss); g_signal_connect(G_OBJECT(curWidgets->settingsSectionsSettingsButton), "clicked", G_CALLBACK(on_section_settings_open), widgets); 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->CautionUnderstandButton), "clicked", G_CALLBACK(on_caution_understand), curWidgets); g_signal_connect(G_OBJECT(curWidgets->MenuItemAboutSystem), "activate", G_CALLBACK(on_about_system),curWidgets); } gtk_label_set_text(GTK_LABEL(curWidgets->LabelTitle),_("UBLinux Settings Manager")); gtk_label_set_text(GTK_LABEL(curWidgets->settingsSubmenuLabelSize),_("Icon size")); gtk_label_set_text(GTK_LABEL(curWidgets->settingsSubmenuLabelTheme),_("Window theme")); gtk_label_set_text(GTK_LABEL(curWidgets->helpHeader),_("Would you like to read documentation in the Web?")); gtk_label_set_text(GTK_LABEL(curWidgets->helpText),_("You will be redirected to documentation site, where user help pages are translated and supported by community.")); gtk_button_set_label(GTK_BUTTON(curWidgets->ReadHelpButton),_("Read online")); gtk_button_set_label(GTK_BUTTON(curWidgets->CancelHelpButton),_("Cancel")); gtk_button_set_label(GTK_BUTTON(curWidgets->settingsCancel),_("Close")); gtk_button_set_label(GTK_BUTTON(curWidgets->settingsAccept),_("Save and apply")); gtk_button_set_label(GTK_BUTTON(curWidgets->AlwaysOpenDocumentation),_("Always redirect")); gtk_menu_item_set_label(GTK_MENU_ITEM(curWidgets->MenuItemSettings),_("Settings")); gtk_menu_item_set_label(GTK_MENU_ITEM(curWidgets->MenuItemDocumentation),_("About...")); gtk_menu_item_set_label(GTK_MENU_ITEM(curWidgets->MenuItemAboutSystem),_("About system")); gtk_button_set_label(GTK_BUTTON(curWidgets->CautionUnderstandButton),_("Understood")); gtk_button_set_label(GTK_BUTTON(curWidgets->settingsSectionsSettingsButton),_("Section management")); return widgets; } int main(int argc, char *argv[]){ gtk_init(&argc, &argv); if (setup_config()==0){ printf("Ошибка загрузки конфига!\n"); return -1; } local=setlocale(LC_ALL, ""); bindtextdomain (LocaleName, LocalePath); textdomain (LocaleName); actionWidgets *widget=malloc(sizeof(actionWidgets)); dictionary *widgets=yon_dictionary_create_empty(); widgets->data=widget; int *size=malloc(sizeof(int)); apps *applist=find_apps(size); sort_apps(applist,*size); GtkBuilder *builder=gtk_builder_new_from_file(GladePath); actionWidgets *widg=(actionWidgets*)widgets->first->data; char *theme; if (main_config.WindowTheme==1){ theme="Gnome"; yon_theme_new(&widgets->first, builder,theme,applist,*size); widg->applist=applist; widg->appssize=*size; widg->ICSys=yon_create_icon_section_list(main_config.sections); for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } yon_show_icon_views(widg->ICSys,widg); yon_icv_resize_item(widg->ICSys,widg->GnomePaned); theme="Main"; main_config.WindowTheme=0; widgets->next=yon_dictionary_create_empty(); widgets->next->first=widgets; widgets->next->prev=widgets; yon_theme_new(&widgets->next, builder,theme,applist,*size); widg=(actionWidgets*)widgets->next->data; widg->applist=applist; widg->appssize=*size; widg->ICSys=yon_create_icon_section_list(main_config.sections); for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } yon_show_icon_views(widg->ICSys,widg); main_config.WindowTheme=1; } else {theme="Main"; yon_theme_new(&widgets->first, builder,theme,applist,*size); widg->applist=applist; widg->appssize=*size; widg->ICSys=yon_create_icon_section_list(main_config.sections); for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } yon_show_icon_views(widg->ICSys,widg); theme="Gnome"; main_config.WindowTheme=1; widgets->next=yon_dictionary_create_empty(); widgets->next->first=widgets; widgets->next->prev=widgets; yon_theme_new(&widgets->next, builder,theme,applist,*size); widg=(actionWidgets*)widgets->next->data; widg->applist=applist; widg->appssize=*size; widg->ICSys=yon_create_icon_section_list(main_config.sections); for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } yon_show_icon_views(widg->ICSys,widg); main_config.WindowTheme=0; yon_icv_resize_item(widg->ICSys,widg->GnomePaned); } gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widg->settingsThemeChooser),NULL,_("Standard theme")); gtk_combo_box_text_append(GTK_COMBO_BOX_TEXT(widg->settingsThemeChooser),NULL,_("GNOME theme")); widg=(actionWidgets*)widgets->data; gtk_window_maximize(GTK_WINDOW(widg->window)); gtk_widget_show_all(widg->window); hide_if_unfound(widgets); if (main_config.WindowTheme==1) gtk_widget_hide(widg->MenuItemAboutSystem); GtkWidget *banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"MainBanner")); gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_file(AppBannerPath,NULL)); banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"GnomeBanner")); gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_file(AppBannerPath,NULL)); banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"loaderBanner")); gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_file(AppBannerPath,NULL)); banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"GnomeInfoLogo")); gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_file_at_scale(LogoPath,512,512,1,NULL)); banner = GTK_WIDGET(gtk_builder_get_object(widg->builder,"settingsIcon")); gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_file_at_scale(AppIconPath,main_config.iconsize,main_config.iconsize,1,NULL)); GtkCssProvider *css=gtk_css_provider_new(); gtk_css_provider_load_from_path(css,CssPath,NULL); gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER(css), 0); gtk_main(); } #endif