diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 8459f65..318ac88 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -19,12 +19,7 @@ set(LIBRARIES ${GTK_LIBRARIES} pthread) -add_custom_target(glade ALL - COMMAND cmake -E copy_directory ${CMAKE_SOURCE_DIR}/ui ${CMAKE_BINARY_DIR}/ui -) -add_custom_target(css ALL - COMMAND cmake -E copy_directory ${CMAKE_SOURCE_DIR}/css ${CMAKE_BINARY_DIR}/css -) + add_executable(ubl-settings-manager ${SOURCE_FILES}) target_link_libraries(ubl-settings-manager ${LIBRARIES}) install(TARGETS ubl-settings-manager DESTINATION bin) \ No newline at end of file diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c index f5cfe91..dfe83a4 100644 --- a/source/ubl-settings-manager.c +++ b/source/ubl-settings-manager.c @@ -38,45 +38,60 @@ int cmld=0; void on_plug_added(GtkSocket* self, actionWidgets *builder){ - //printf("Plug has been added!\n"); + gtk_widget_show(builder->socketbutton); + gtk_widget_show(builder->ThirdSocket); + // 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 (main_config.WindowTheme==0) + gtk_widget_hide(builder->appSettings); 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->appSettings); 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"); + // printf("Plug has been removed!\n\n\n"); + if(widgets->socketbutton) + gtk_widget_destroy(widgets->socketbutton); + if(widgets->ThirdSocket) + gtk_widget_destroy(widgets->ThirdSocket); + gtk_widget_show(widgets->appSettings); } void on_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets *applist){ - //printf("\n\n\nActivated\n\n\n"); + // 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); + // printf("%s\n",tempapp->Name); if (!tempapp){}else{ char arg[100]; + // printf("%s\n",tempapp->Exec); + // printf("%d\n",tempapp->Type); + // printf("%d\n",tempapp->Pluggable); 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){ + printf("%d\n%d\n\n\n\n",gtk_socket_get_id(GTK_SOCKET(applist->socket)),gtk_socket_get_id(GTK_SOCKET(applist->socketbutton))); + sprintf(arg,"--socket-id=%d",gtk_socket_get_id(GTK_SOCKET(applist->socket)),gtk_socket_get_id(GTK_SOCKET(applist->socketbutton))); + + if (tempapp[0].Type==1){ if (tempapp->Pluggable==1) - launch_app_with_arguments(tempapp[0].Exec,arg); + if (tempapp->DualPluggable==1){ + char *dualarg=malloc(strlen("--socket-id= --socket-ext-id= --socket-trd-id=")+30); + sprintf(dualarg,"--socket-id=%d --socket-ext-id=%d --socket-trd-id=%d",gtk_socket_get_id(GTK_SOCKET(applist->socket)),gtk_socket_get_id(GTK_SOCKET(applist->socketbutton)),gtk_socket_get_id(GTK_SOCKET(applist->ThirdSocket))); + launch_app_with_arguments(tempapp[0].Exec,dualarg); + } else + launch_app_with_arguments(tempapp[0].Exec,arg); else launch_app(tempapp[0].Exec); } } @@ -89,11 +104,6 @@ void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets 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); @@ -103,14 +113,25 @@ void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets 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) + if (tempapp[0].Type==1){ + if (tempapp->Pluggable==1){ + + if (tempapp->DualPluggable==1){ + gtk_widget_hide(applist->appSettings); + char *dualarg=malloc(strlen("--socket-id= --socket-ext-id= --socket-trd-id=")+30); + sprintf(dualarg,"--socket-id=%d --socket-ext-id=%d --socket-trd-id=%d",gtk_socket_get_id(GTK_SOCKET(applist->socket)),gtk_socket_get_id(GTK_SOCKET(applist->socketbutton)),gtk_socket_get_id(GTK_SOCKET(applist->ThirdSocket))); + launch_app_with_arguments(tempapp[0].Exec,dualarg); + } + else{ launch_app_with_arguments(tempapp[0].Exec,arg); - else launch_app(tempapp[0].Exec); + gtk_widget_destroy(applist->socketbutton); + } + } + else { + on_about_system(NULL,applist); + launch_app(tempapp[0].Exec); + gtk_widget_destroy(applist->socketbutton); + } } } @@ -119,7 +140,7 @@ void on_item_selection_changed(GtkIconView *IV, actionWidgets *widgets){ 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(IVG->IV)!=GTK_ICON_VIEW(IV)) if (gtk_icon_view_get_selected_items(GTK_ICON_VIEW(IVG->IV))>0) gtk_icon_view_unselect_all(GTK_ICON_VIEW(IVG->IV)); } @@ -163,7 +184,7 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ else if (main_config.WindowTheme==1) main_config.curThemeName="Gnome"; dictionary *widgetsD=yon_dictionary_find(widgetsDs,main_config.curThemeName); - printf("Saving config...\n"); + // 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); @@ -192,6 +213,12 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ 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); @@ -221,6 +248,11 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ g_key_file_set_string(gfile,"window","IconSize",fromint); sprintf(fromint,"%d",main_config.iconSegmentSize); g_key_file_set_string(gfile,"window","IconSegmentSize",fromint); + sprintf(fromint,"%d",(int)((float)main_config.labelSize/1000)); + g_key_file_set_string(gfile,"window","LabelSize",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); 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); @@ -309,7 +341,7 @@ void on_section_settings_open(GtkButton* self,dictionary *cWidgets){ 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->key=(char*)gtk_label_get_text(GTK_LABEL(Sgm->NameLabel)); dict->next=malloc(sizeof(dictionary)); dict->next->prev=dict; dict->next->first=dict->first; @@ -366,6 +398,7 @@ void on_sections_accept(GtkWidget *button, actionWidgets *widgets){ } }; + void on_sections_cancel(GtkWidget *button, actionWidgets *widgets){ for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){ SectionSettingSegment *segment=(SectionSettingSegment*)dct->data; @@ -389,6 +422,7 @@ void on_sections_cancel(GtkWidget *button, actionWidgets *widgets){ } }; + 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; @@ -478,6 +512,7 @@ void on_sections_delete(GtkWidget *button, actionWidgets *widgets){ } } }; + void on_sections_add(GtkWidget *button, actionWidgets *widgets){ dictionary *dict=yon_dictionary_create_empty(); dictionary *dct=NULL; @@ -531,7 +566,9 @@ void on_sections_save(GtkWidget *button, actionWidgets *widgets){ load_apps((IVGraphicals*)cur->data,widgets->applist,widgets->appssize); } yon_show_icon_views(widgets->ICSys,widgets); - //hide_if_unfound(widgets); + dictionary *yond=yon_dictionary_create_empty(); + yond->data=widgets; + hide_if_unfound(yond); } @@ -572,6 +609,7 @@ void on_section_delete(GtkWidget *button, actionWidgets *widgets){ } } } + void on_resized (GtkWidget *window, GdkEventConfigure *event, dictionary *widgetsD){ actionWidgets *widgets=(actionWidgets*)widgetsD->data; int x,y; @@ -613,40 +651,43 @@ void on_resized_done (GtkWidget *window, GdkEvent *event, dictionary *widgetsD){ } 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); + char arg[100]; + memset(arg,0,100); + // printf("%d\n%d\n\n\n\n",gtk_socket_get_id(GTK_SOCKET(widgets->socket)),gtk_socket_get_id(GTK_SOCKET(widgets->socketbutton))); + sprintf(arg,"--socket-id=%d --socket-ext-id=%d",gtk_socket_get_id(GTK_SOCKET(widgets->socket)),gtk_socket_get_id(GTK_SOCKET(widgets->socketbutton))); + launch_app_with_arguments("ubl-settings-info",arg); +} + +void launch(char *command){ + system(command); } 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)); + char *path=yon_char_get_augumented("/bin/",name); + path=yon_char_get_augumented(path," "); + path=yon_char_get_augumented(path,args); + // printf("%s\n",path); + pthread_t thread_id; + pthread_create(&thread_id, NULL, (void*)launch, path); }; void launch_app(char *name){ - char *path=yon_char_get_augumented(name," &"); - system(path); + char *path=name; + pthread_t thread_id; + pthread_create(&thread_id, NULL, (void*)launch, 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); + pthread_t thread_id; + pthread_create(&thread_id, NULL, (void*)launch, path); }; - apps *get_app_by_name(apps *applist,char *name, int size){ for (int i=0;isocketplace),socket,true,true,0); + gtk_box_pack_start(GTK_BOX(builder->socketbuttonplace),socketbutton,1,1,0); + builder->socketbutton=socketbutton; + gtk_box_pack_start(GTK_BOX(builder->ThirdSocketPlace),ThirdSocket,1,1,0); + builder->ThirdSocket=ThirdSocket; return socket; }; @@ -764,40 +820,26 @@ apps *find_apps(int *sizef){ 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 (!tempapp.Pluggable) tempapp.Pluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-XfcePluggable",NULL); + if (tempapp.Pluggable) tempapp.DualPluggable=g_key_file_get_boolean(gfile,"Desktop Entry", "X-UBLPluggable",NULL); if (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].Name=yon_char_new(tempapp.Name); + applist[0].Categories=yon_char_new(tempapp.Categories); + applist[0].Exec=yon_char_new(tempapp.Exec); + applist[0].Icon=yon_char_new(tempapp.Icon); applist[0].Type=tempapp.Type; applist[0].Pluggable=tempapp.Pluggable; + applist[0].DualPluggable=tempapp.DualPluggable; size++; } else { applist=(apps*)realloc(applist,(size+1)*sizeof(apps)); - applist[size].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].Name=yon_char_new(tempapp.Name); + applist[size].Categories=yon_char_new(tempapp.Categories); + applist[size].Exec=yon_char_new(tempapp.Exec); + applist[size].Icon=yon_char_new(tempapp.Icon); applist[size].Pluggable=tempapp.Pluggable; + applist[size].DualPluggable=tempapp.DualPluggable; applist[size].Type=tempapp.Type; size++; } @@ -806,7 +848,6 @@ apps *find_apps(int *sizef){ } } } - //printf("Closing apps configuration...\n"); *sizef=size; return applist; }; @@ -849,7 +890,6 @@ int check_categories(apps app, char *catstocheck){ 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; @@ -858,9 +898,6 @@ int setup_config(){ 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); @@ -873,7 +910,6 @@ int setup_config(){ } 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); @@ -881,9 +917,14 @@ int setup_config(){ 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); + main_config.labelSize=g_key_file_get_integer(configfile,"window","LabelSize",NULL); + main_config.labelDensity=g_key_file_get_integer(configfile,"window","LabelDensity",NULL); + main_config.lastUser=g_key_file_get_string(configfile,"window","User",NULL); + if (main_config.labelSize==0) main_config.labelSize=12; + if (main_config.labelDensity==0) main_config.labelDensity=0; + main_config.labelSize=main_config.labelSize*1000; 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 { @@ -894,12 +935,12 @@ int setup_config(){ main_config.sections->next=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); @@ -966,15 +1007,21 @@ IVGraphicals *yon_create_single_section_IV(char *name,char *cats){ GtkWidget *box=gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); GtkWidget *iv=gtk_icon_view_new(); GtkWidget *label=gtk_label_new(_(name)); + PangoAttrList *attrs=pango_attr_list_new(); + pango_attr_list_insert(attrs,pango_attr_size_new(main_config.labelSize)); + gtk_label_set_attributes(GTK_LABEL(label),attrs); 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); + } else { + gtk_widget_set_name(iv,"Icon"); } GtkWidget *sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); + gtk_widget_set_name(sep,"thinborder"); 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); @@ -1072,6 +1119,13 @@ char *yon_char_get_augumented(char *source, char *append){ return final; } +char *yon_char_new(char *chr){ + char *newchar=malloc(strlen(chr)+1); + memset(newchar,0,strlen(chr)+1); + memcpy(newchar,chr,strlen(chr)); + return newchar; +} + int yon_show_icon_views(dictionary *IVS,actionWidgets *widgets){ for (dictionary *dct=IVS->first;dct!=NULL;dct=dct->next){ IVGraphicals *iv=dct->data; @@ -1096,6 +1150,7 @@ dictionary *yon_dictionary_find(dictionary **dict, char *key){ } return NULL; } + void yon_switch_theme(dictionary **dict, dictionary *newone){ dictionary *dct=*dict; actionWidgets *widgets=(actionWidgets*)dct->data; @@ -1147,7 +1202,6 @@ void yon_switch_theme(dictionary **dict, dictionary *newone){ } - void yon_icon_size_convert(int mode){ if (mode==0){ if (main_config.iconsize==1) main_config.iconsize=24; @@ -1183,7 +1237,6 @@ SectionSettingSegment *yon_create_section_setting(char *name, char *categories){ 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); @@ -1296,6 +1349,7 @@ void yon_segments_hide(actionWidgets *widgets){ } else return; } } + void yon_dictionary_make_first(dictionary *dict){ for (dictionary *dct=dict->first;dct!=NULL;dct=dct->next){ dct->first=dict; @@ -1303,7 +1357,6 @@ void yon_dictionary_make_first(dictionary *dict){ } void yon_small_window_theme_change(actionWidgets *widgets){ - } dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *theme_id, apps *applist, int appsize){ @@ -1328,10 +1381,15 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them 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->socketbuttonplace=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"socketbuttonplace"))); + curWidgets->Overlay=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Overlay"))); + curWidgets->ThirdSocketPlace=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"ThirdSocketPlace"))); curWidgets->SettingsSections=NULL; + gtk_style_context_add_class(gtk_widget_get_style_context(curWidgets->icvpack),"iconview"); curWidgets->socket=GTK_WIDGET(create_socket(curWidgets)); - + curWidgets->MenuItemAboutSystem=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"MenuItemAboutSystem")); + g_signal_connect(G_OBJECT(curWidgets->MenuItemAboutSystem), "activate", G_CALLBACK(on_about_system),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"); @@ -1342,11 +1400,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them } 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); + on_about_system(NULL,curWidgets); 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); @@ -1411,7 +1465,6 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them 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")); @@ -1438,7 +1491,7 @@ int main(int argc, char *argv[]){ return -1; } local=setlocale(LC_ALL, ""); - bindtextdomain (LocaleName, LocalePath); + // printf("%s\n\n\n",bindtextdomain (LocaleName, LocalePath)); textdomain (LocaleName); actionWidgets *widget=malloc(sizeof(actionWidgets)); dictionary *widgets=yon_dictionary_create_empty(); @@ -1458,6 +1511,7 @@ int main(int argc, char *argv[]){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } yon_show_icon_views(widg->ICSys,widg); + gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),GTK_WIDGET(gtk_builder_get_object(builder,"GnomeScroll"))); yon_icv_resize_item(widg->ICSys,widg->GnomePaned); theme="Main"; main_config.WindowTheme=0; @@ -1473,6 +1527,7 @@ int main(int argc, char *argv[]){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } yon_show_icon_views(widg->ICSys,widg); + gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),widg->workingwindow); main_config.WindowTheme=1; } @@ -1485,6 +1540,7 @@ int main(int argc, char *argv[]){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } yon_show_icon_views(widg->ICSys,widg); + gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),GTK_WIDGET(gtk_builder_get_object(builder,"GnomeScroll"))); theme="Gnome"; main_config.WindowTheme=1; widgets->next=yon_dictionary_create_empty(); @@ -1499,12 +1555,15 @@ int main(int argc, char *argv[]){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } yon_show_icon_views(widg->ICSys,widg); + gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),widg->icvpack); 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")); + if (geteuid()==0){ + gtk_widget_set_sensitive(widg->settingsSectionsSettingsButton,1); + } + 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); diff --git a/source/ubl-settings-manager.h b/source/ubl-settings-manager.h index 6caf2c1..92f3100 100644 --- a/source/ubl-settings-manager.h +++ b/source/ubl-settings-manager.h @@ -17,8 +17,8 @@ #define LocalePath "/usr/share/locale" #define LocaleName "ubl-settings-manager" #define LogoPath "/usr/share/icons/hicolor/scalable/apps/ubl-settings-manager.svg" -#define ubl_settings_infoPath "/home/superadmin/Документы/ubl-settings-manager/ub-settings-manager/ubl-info/ubl-settings-info" -#define ubl_settings_infoPathLaunch "/home/superadmin/Документы/ubl-settings-manager/ub-settings-manager/ubl-info/ubl-settings-info --socket-id=" +#define ubl_settings_infoPath "ubl-settings-info" +#define ubl_settings_infoPathLaunch "ubl-settings-info --socket-id=" typedef struct apps{ @@ -28,7 +28,7 @@ typedef struct apps{ char *Exec; char *Icon; int Pluggable; - + int DualPluggable; } apps; typedef struct dictionary { @@ -64,7 +64,9 @@ typedef struct { int iconsize; int iconSegmentSize; dictionary *sections; - + int labelSize; + int labelDensity; + char *lastUser; } config; typedef struct { @@ -135,6 +137,11 @@ typedef struct { GtkWidget *GnomeInfoDetailsLabel; GtkWidget *CautionWindow; GtkWidget *CautionUnderstandButton; + GtkWidget *socketbuttonplace; + GtkWidget *socketbutton; + GtkWidget *Overlay; + GtkWidget *ThirdSocketPlace; + GtkWidget *ThirdSocket; int appssize; apps *applist; GtkWidget *icvpack; @@ -196,4 +203,7 @@ void yon_dictionary_make_first(dictionary *dict); dictionary *yon_create_icon_section_list(dictionary *sections); int yon_show_icon_views(dictionary *IVS,actionWidgets *widgets); void yon_icon_size_convert(int mode); +void on_about_system(GtkWidget *button, actionWidgets *widgets); +char *yon_char_new(char *chr); +void launch(char *command); #endif \ No newline at end of file diff --git a/ubconfig-main.conf b/ubconfig-main.conf index 27f06dd..4d5b3a4 100644 --- a/ubconfig-main.conf +++ b/ubconfig-main.conf @@ -1,14 +1,17 @@ [window] WindowPosX=0 WindowPosY=0 -WindowWidth=1920 -WindowHeight=1004 +WindowWidth=800 +WindowHeight=600 WindowTheme=0 IconSize=2 -IconSegmentSize=321 +IconSegmentSize=250 +LabelSize=12 +LabelDensity=0 +User= [sections] -Personal=XFCE; +Personal=X-UBL-SettingsManager;X-UBL-PersonalSettings; Hardware=X-UBL-SettingsManager;X-UBL-HardwareSettings; System=X-UBL-SettingsManager;X-UBL-SystemSettings; Misc= diff --git a/ubl-settings-manager.css b/ubl-settings-manager.css index 05d6eb1..437117d 100644 --- a/ubl-settings-manager.css +++ b/ubl-settings-manager.css @@ -1,55 +1,21 @@ -.label { - font-size: 13px; -} -.noborder{ - border:none; - border-width:0px; - border-radius:0px; - box-shadow: none; -} -.darkborder{ - border-width:1px; - border-radius:1px; -} .bannerbackground { background-color: #404040; } -.elseps { - border-style:solid; - border-bottom-width: 1px; - border-image: linear-gradient(90deg, #aaaaaa 0%, #dcddde 100%); - border-image-slice: 1; - -} -#Icon { - background-color: transparent; - color: transparent; -} -iconview#GnomeIcon{ + +#GnomeIcon{ border-style:solid; border-bottom-width: 1px; border-image: linear-gradient(90deg, #aaaaaa 0%, #dcddde 100%); border-image-slice: 1; - - background-color: transparent; } -#noborders{ - border-style:solid; - border: 0px; -} - #iconlabel { font-size:14px; font-weight: bold; + +} +.roundborder * { + border-style:solid; + border-width:1px; + border-radius:5px; } - - #desclabel { - font-size:100%; - } - .bold { - color:#1a5fb4; - } - iconview { - background-image:none; - } diff --git a/ubl-settings-manager.glade b/ubl-settings-manager.glade index 16cf32d..8566978 100644 --- a/ubl-settings-manager.glade +++ b/ubl-settings-manager.glade @@ -114,6 +114,34 @@ + + True + True + in + 150 + True + + + True + False + + + True + False + 3 + 3 + 3 + 3 + 3 + vertical + + + + + + + + False 450 @@ -278,6 +306,77 @@ + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + vertical + + + True + True + in + + + True + False + natural + + + True + False + vertical + 2 + + + + + + + + + + + True + True + 0 + + + + + True + True + 0 + + + + + False + vertical + + + + + + + False + True + 1 + + + True False @@ -327,6 +426,21 @@ + + True + False + + + True + True + 6 + + + True + -1 + + + 1 5 @@ -515,6 +629,7 @@ Sections management True + False True True 10 @@ -1018,32 +1133,18 @@ True True - + True - True - in - 150 - True + False - + True - False - - - True - False - 3 - 3 - 3 - 3 - 3 - vertical - - - - - + True + 6 + + -1 + @@ -1202,10 +1303,21 @@ False True - + True False - UBLinux Settings Manager + + + True + False + UBLinux Settings Manager + + + True + True + 0 + + True @@ -1214,14 +1326,9 @@ - + True - True - False - True - menu1 - none - False + False @@ -1232,6 +1339,37 @@ 1 + + + True + False + + + True + True + False + True + menu1 + none + False + + + + + + False + True + 0 + + + + + False + True + end + 2 + + @@ -1242,6 +1380,19 @@ 5 + + + True + False + vertical + + + + + + 1 + + @@ -1319,10 +1470,6 @@ - - - - - - - - - - True - True - 0 - - - - - - True - True - 0 - - - - - False - vertical - - - - + True + 6 - False - True - 1 + -1 @@ -1573,9 +1653,6 @@ 1 - True @@ -1596,10 +1673,21 @@ False True - + True False - UBLinux Settings Manager + + + True + False + UBLinux Settings Manager + + + True + True + 0 + + True @@ -1608,17 +1696,17 @@ - + True - True - False - True - menu1 - none - False + False + center + center + False @@ -1626,6 +1714,38 @@ 1 + + + True + False + vertical + + + True + True + False + True + menu1 + none + False + + + + + + False + True + 0 + + + + + False + True + end + 2 + + @@ -1658,12 +1778,26 @@ 1 + + + True + False + center + center + vertical + + + + + + + 2 + + - diff --git a/ubl-settings-manager_ru.po b/ubl-settings-manager_ru.po index 422642f..19df6c7 100644 --- a/ubl-settings-manager_ru.po +++ b/ubl-settings-manager_ru.po @@ -8,80 +8,98 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2023-01-31 11:50+0000\n" +"POT-Creation-Date: 2023-02-09 16:45+0600\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ubl-settings-manager.c:1373 +#: ubl-settings-manager.c:1338 msgid "Back to settings" msgstr "Назад" -#: ubl-settings-manager.c:1451 +#: ubl-settings-manager.c:1418 msgid "UBLinux Settings Manager" msgstr "Настройки UBLinux" -#: ubl-settings-manager.c:1452 +#: ubl-settings-manager.c:1419 msgid "Icon size" msgstr "Размер иконок" -#: ubl-settings-manager.c:1453 +#: ubl-settings-manager.c:1420 msgid "Window theme" msgstr "Выбор темы" -#: ubl-settings-manager.c:1454 +#: ubl-settings-manager.c:1421 msgid "Would you like to read documentation in the Web?" msgstr "Вы хотите прочитать руководство в сети?" -#: ubl-settings-manager.c:1455 -msgid "You will be redirected to documentation site, where user help pages are " +#: ubl-settings-manager.c:1422 +msgid "" +"You will be redirected to documentation site, where user help pages are " "translated and supported by community." msgstr "Вы будете перенаправлены на сайт с документацией, где страницы помощи переводятся и поддерживаются сообществом." -#: ubl-settings-manager.c:1456 +#: ubl-settings-manager.c:1423 msgid "Read online" msgstr "Прочитать онлайн" -#: ubl-settings-manager.c:1457 +#: ubl-settings-manager.c:1424 msgid "Cancel" msgstr "Отменить" -#: ubl-settings-manager.c:1458 +#: ubl-settings-manager.c:1425 msgid "Close" msgstr "Закрыть" -#: ubl-settings-manager.c:1459 +#: ubl-settings-manager.c:1426 msgid "Save and apply" msgstr "Сохранить и применить" -#: ubl-settings-manager.c:1460 +#: ubl-settings-manager.c:1427 msgid "Always redirect" msgstr "Всегда перенаправлять" -#: ubl-settings-manager.c:1461 +#: ubl-settings-manager.c:1428 msgid "Settings" msgstr "Настройки" -#: ubl-settings-manager.c:1462 +#: ubl-settings-manager.c:1429 msgid "About..." +msgstr "О программе" + +#: ubl-settings-manager.c:1430 +msgid "About system" msgstr "О системе" -#: ubl-settings-manager.c:1463 +#: ubl-settings-manager.c:1431 msgid "Understood" msgstr "Понятно" -#: ubl-settings-manager.c:1464 +#: ubl-settings-manager.c:1432 msgid "Section management" msgstr "Точная настройка" -#: ubl-settings-manager.c:1538 +#: ubl-settings-manager.c:1508 msgid "Standard theme" msgstr "Основная тема" -#: ubl-settings-manager.c:1539 +#: ubl-settings-manager.c:1509 msgid "GNOME theme" msgstr "GNOME тема" + +msgid "Personal" +msgstr "Личные" + +msgid "Hardware" +msgstr "Оборудование" + +msgid "System" +msgstr "Система" + +msgid "Misc" +msgstr "Прочее" +