diff --git a/Makefile b/Makefile index 993aa57..32ef201 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,10 @@ CMAKE_COMMAND = cmake #CMAKE_BUILD_DIR = $(MAKEFILE_PATH)compile CMAKE_SOURCE_DIR = ./source CMAKE_BUILD_DIR = ./compile +DEPENDS = cmake PKGNAME = $(MAKEFILE_DIR) -version_application = -#PKGNAME = check-hostalive +#PKGNAME = ubl-settings-manager +pkgdir = default_target: all @@ -21,10 +22,10 @@ all: init build init: @echo "Initialize ..."; \ version="$$(cat VERSION.md)"; \ - version=$${version:8}; \ - search="s/string version_application.*$&"; \ - replace="string version_application = \"$${version}\";"; \ - sed -i -e "$$search/$$replace/gi" source/ubl-settings-datetime.h; \ + version=$${version:8}; \ + search="s/char *version_application.*$&"; \ + replace="char *version_application = \"$${version}\";"; \ + sed -i -e "$$search/$$replace/gi" source/ubl-settings-manager.h; \ echo "-- Build path: ${CMAKE_BUILD_DIR}" depend: @@ -89,10 +90,13 @@ uninstall: @$(RM) "/usr/share/${PKGNAME}/ui/ublinux-logo.svg" @$(RM) "/usr/share/${PKGNAME}/ui/${PKGNAME}.glade" @$(RM) "/usr/share/${PKGNAME}/css/${PKGNAME}.css" - @$(RM) "/usr/share/${PKGNAME}/ui/${PKGNAME}.png" + @$(RM) "/usr/share/${PKGNAME}/ui/${PKGNAME}-banner.png" @$(RM) "/usr/share/${PKGNAME}/css/${PKGNAME}.css" @$(RM) "/usr/share/${PKGNAME}/css/${PKGNAME}.css" @$(RM) "/usr/share/${PKGNAME}/css/${PKGNAME}.css" + @$(RM) -d "/usr/share/${PKGNAME}/css" + @$(RM) -d "/usr/share/${PKGNAME}/ui" + @$(RM) -d "/usr/share/${PKGNAME}" @$(RM) "/etc/ubconfig-main.conf" @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null @update-desktop-database --quiet 2>/dev/null @@ -115,22 +119,15 @@ install: check uninstall done @install -Dm644 -t /usr/share/icons/hicolor/scalable/apps/ ${PKGNAME}.svg @install -Dm755 -t /usr/bin/ ${CMAKE_BUILD_DIR}/${PKGNAME} - @install -Dm644 -t /usr/share/applications/ ${PKGNAME}.desktop; \ - if [ ! -d "/usr/share/${PKGNAME}" ]; then \ - mkdir /usr/share/${PKGNAME}; \ - fi; \ - if [ ! -d "/usr/share/${PKGNAME}/ui" ]; then \ - mkdir /usr/share/${PKGNAME}/ui; \ - fi; \ - if [ ! -d "/usr/share/${PKGNAME}/css" ]; then \ - mkdir /usr/share/${PKGNAME}/css; \ - fi + @install -Dm644 -t /usr/share/applications/ ${PKGNAME}.desktop + @install -Dm755 /usr/share/${PKGNAME}/ -d ui + @install -Dm755 /usr/share/${PKGNAME}/ -d css @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}.glade @install -Dm644 -t /usr/share/${PKGNAME}/css/ ${PKGNAME}.css @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ublinux-logo.svg - @install -Dm644 -t /etc/ ubconfig-main.conf; \ - chmod 766 /etc/ubconfig-main.conf - @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}.png + @install -Dm644 -t /etc/ ubconfig-main.conf + @chmod 766 /etc/ubconfig-main.conf + @install -Dm644 -t /usr/share/${PKGNAME}/ui/ ${PKGNAME}-banner.png @gtk-update-icon-cache -fiq /usr/share/icons/hicolor/ &>/dev/null @update-desktop-database --quiet 2>/dev/null @touch /usr/share/applications diff --git a/VERSION.md b/VERSION.md index 323861e..0ca32b7 100644 --- a/VERSION.md +++ b/VERSION.md @@ -1 +1 @@ -string version_application = "1.1"; +VERSION 1.1 \ No newline at end of file diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c index 0ff72da..37d7c97 100644 --- a/source/ubl-settings-manager.c +++ b/source/ubl-settings-manager.c @@ -45,10 +45,7 @@ void on_plug_added(GtkSocket* self, actionWidgets *builder){ 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) - - // else - // gtk_widget_show(builder->appSettings); + gtk_widget_hide(builder->appSettings); if (builder->ButtonBackToMain!=NULL) gtk_widget_show(builder->ButtonBackToMain); gtk_widget_show(GTK_WIDGET(self)); gtk_widget_show(builder->socketbuttonplace); @@ -67,28 +64,23 @@ void on_plug_removed(GtkSocket* self, actionWidgets *widgets){ 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){ GtkTreeIter iter; char *name; - gtk_widget_hide(applist->appSettings); 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); + gtk_tree_model_get(gtk_icon_view_get_model(self),&iter,0,&name,-1); apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); if (!tempapp){}else{ char arg[100]; memset(arg,0,100); - 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) 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); @@ -108,7 +100,7 @@ void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets applist->socket=create_socket(applist); 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); + gtk_tree_model_get(gtk_icon_view_get_model(self),&iter,0,&name,-1); apps *tempapp=get_app_by_name(applist->applist,name,applist->appssize); char arg[100]; @@ -119,10 +111,10 @@ void on_gnome_Item_activated(GtkIconView* self, GtkTreePath* path, actionWidgets 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); + if (launch_app_with_arguments(tempapp[0].Exec,dualarg)==32512) + gtk_widget_show(applist->infoWarningWindow); } else{ launch_app_with_arguments(tempapp[0].Exec,arg); @@ -210,13 +202,13 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ int sz=1,szm=1; if (main_config.Gnomeiconsize==64) sz=4; - if (main_config.Gnomeiconsize==48) sz=3; - if (main_config.Gnomeiconsize==32) sz=2; - if (main_config.Gnomeiconsize==24) sz=1; + else if (main_config.Gnomeiconsize==48) sz=3; + else if (main_config.Gnomeiconsize==32) sz=2; + else if (main_config.Gnomeiconsize==24) sz=1; if (main_config.Mainiconsize==64) szm=4; - if (main_config.Mainiconsize==48) szm=3; - if (main_config.Mainiconsize==32) szm=2; - if (main_config.Mainiconsize==24) szm=1; + else if (main_config.Mainiconsize==48) szm=3; + else if (main_config.Mainiconsize==32) szm=2; + else if (main_config.Mainiconsize==24) szm=1; char *fromint=malloc(5); memset(fromint,0,5); GError *err=NULL; @@ -281,11 +273,11 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *widgets){ int position=gtk_paned_get_position(GTK_PANED(widgets->GnomePaned)); - if (position<250) {position=250; gtk_paned_set_position(GTK_PANED(widgets->GnomePaned),250);} + if (position<200) {position=200; gtk_paned_set_position(GTK_PANED(widgets->GnomePaned),200);} main_config.iconSegmentSize=position; - if (position <115) {position=115;} + if (position <70) {position=70;} double pos=((double)position); - if (pos<110) pos=110; + if (pos<70) pos=70; 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); @@ -297,7 +289,8 @@ void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *wi 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); + GtkIconTheme *icthm=gtk_icon_theme_get_default(); + gtk_window_set_icon(GTK_WINDOW(widgets->SettingsWindow),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); gtk_widget_show_all(widgets->SettingsWindow); gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),main_config.WindowTheme); int sz=1; @@ -309,36 +302,37 @@ int on_settingsOpen(GtkWidget *button, actionWidgets *widgets){ char *tmp=malloc(6); sprintf(tmp,"%dx%d\0",*main_config.currentThemeIconSize,*main_config.currentThemeIconSize); 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(AppIconPath,*main_config.currentThemeIconSize,*main_config.currentThemeIconSize,1,NULL)); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SVG),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)); + GtkIconTheme *icthm=gtk_icon_theme_get_default(); if ((int)val==1||(int)val==0){ - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,24,24,1,NULL)); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(24),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); if (*main_config.currentThemeIconSize!=24) main_config.changed=1; *main_config.currentThemeIconSize=24; } if ((int)val==2){ - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,32,32,1,NULL)); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); if (*main_config.currentThemeIconSize!=32) main_config.changed=1; *main_config.currentThemeIconSize=32; } if ((int)val==3){ - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,48,48,1,NULL)); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(48),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); if (*main_config.currentThemeIconSize!=48) main_config.changed=1; *main_config.currentThemeIconSize=48; } if ((int)val==4){ - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,64,64,1,NULL)); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(64),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); if (*main_config.currentThemeIconSize!=64) main_config.changed=1; @@ -693,56 +687,82 @@ void on_about_system(GtkWidget *button, actionWidgets *widgets){ void on_theme_selection_changed(GtkWidget *self, actionWidgets *widgets){ int *icsize; - printf("changed\n"); int curthm=gtk_combo_box_get_active(GTK_COMBO_BOX(widgets->settingsThemeChooser)); - if (curthm==0) - *icsize=main_config.Mainiconsize; - else if (curthm==1) - *icsize=main_config.Gnomeiconsize; - if (*icsize<=24){ + // main_config.changed=1; + if (curthm==0){ + main_config.currentThemeIconSize=&main_config.Mainiconsize; + main_config.currentThemeLabelSize=&main_config.MainlabelSize; + icsize=main_config.currentThemeIconSize; + } + else if (curthm==1){ + main_config.currentThemeIconSize=&main_config.Gnomeiconsize; + main_config.currentThemeLabelSize=&main_config.GnomelabelSize; + icsize=main_config.currentThemeIconSize; + } + GtkIconTheme *icthm=gtk_icon_theme_get_default(); + if (*icsize==24 || *icsize==1){ gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,24,24,1,NULL)); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(24),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),1.0); - } else if (*icsize<=32){ + *icsize=24; + } else if (*icsize==32 || *icsize==2){ gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32"); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,32,32,1,NULL)); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),2.0); - } else if (*icsize<=48){ + *icsize=32; + } else if (*icsize==48 || *icsize==3){ gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48"); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,48,48,1,NULL)); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(48),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),3.0); + *icsize=48; } else{ gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64"); - gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,64,64,1,NULL)); + gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(64),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); gtk_scale_set_value_pos(GTK_SCALE(widgets->settingsSizeSlider),4.0); + *icsize=64; } } -void launch(char *command){ - system(command); +int launch(thread_output *thread){ + int a=0; + a=system(thread->command); + *thread->exitcode=a; + return *thread->exitcode; } -void launch_app_with_arguments(char *name, char *args){ +int launch_app_with_arguments(char *name, char *args){ char *path=yon_char_get_augumented("/bin/",name); path=yon_char_get_augumented(path," "); path=yon_char_get_augumented(path,args); pthread_t thread_id; - pthread_create(&thread_id, NULL, (void*)launch, path); + thread_output *thread=malloc(sizeof(thread_output)); + thread->command=path; + thread->exitcode=malloc(sizeof(int)); + pthread_create(&thread_id, NULL, (void*)launch, thread); + return *thread->exitcode; }; -void launch_app(char *name){ +int launch_app(char *name){ char *path=name; + thread_output *thread=malloc(sizeof(thread_output)); + thread->command=path; + thread->exitcode=malloc(sizeof(int)); pthread_t thread_id; - pthread_create(&thread_id, NULL, (void*)launch, path); + pthread_create(&thread_id, NULL, (void*)launch, thread); + return *thread->exitcode; }; -void py_launch_app(char *name,char *args){ +int py_launch_app(char *name,char *args){ char *path=malloc(strlen("python ./")+strlen(name)+6+strlen(args)); sprintf(path,"python ./%s.py %s &",name,args); pthread_t thread_id; - pthread_create(&thread_id, NULL, (void*)launch, path); + thread_output *thread=malloc(sizeof(thread_output)); + thread->command=path; + thread->exitcode=malloc(sizeof(int)); + pthread_create(&thread_id, NULL, (void*)launch, thread); + return *thread->exitcode; }; apps *get_app_by_name(apps *applist,char *name, int size){ @@ -759,49 +779,24 @@ int reload_list(IVGraphicals *section){ int load_apps(IVGraphicals *section, apps *applist, int size){ int catstofind=sizeof(section->categories)/sizeof(char*); int i=0,sz=0; - dictionary *times=yon_dictionary_create_empty(); 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); - GdkPixbuf *pixbuf; - pixbuf=gdk_pixbuf_new_from_file_at_size(yon_char_get_augumented(path,PictureFormatMain),*main_config.currentThemeIconSize,*main_config.currentThemeIconSize,NULL); - if (!pixbuf) { - pixbuf=gdk_pixbuf_new_from_file_at_size(yon_char_get_augumented(path,PictureFormatExtra),*main_config.currentThemeIconSize,*main_config.currentThemeIconSize,NULL); - if (!pixbuf){ - GtkWidget *imag=gtk_image_new_from_icon_name(applist[i].Icon,GTK_ICON_SIZE_DIALOG); - void *a=GTK_ICON_SIZE_DIALOG; - pixbuf=gtk_image_get_pixbuf(GTK_IMAGE(imag)); - printf("%s\n",applist[i].Icon); - if (!pixbuf) - pixbuf=gdk_pixbuf_new_from_file_at_size(ErrIconPicturePath,*main_config.currentThemeIconSize,*main_config.currentThemeIconSize,NULL); - else { - gdk_pixbuf_scale(pixbuf,pixbuf,0,0,*main_config.currentThemeIconSize,*main_config.currentThemeIconSize,0,0,*main_config.currentThemeIconSize,*main_config.currentThemeIconSize,GDK_INTERP_NEAREST); - GValue a = G_VALUE_INIT; - g_value_init (&a, G_TYPE_STRING); - g_value_set_string (&a, applist[i].Icon); - g_object_set_property(G_OBJECT(section->iconRender),"icon-name", &a); - } - } - }; GtkTreeIter iter; gtk_list_store_append(section->LV,&iter); - int sz= *main_config.currentThemeIconSize; + int sz= *main_config.currentThemeIconSize+10; if (sz<50) sz=50; + GtkIconTheme *icthm=gtk_icon_theme_get_default(); + GdkPixbuf *pixbuf=gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, applist[i].Icon,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL); GtkTreePath *pth = gtk_tree_model_get_path(GTK_TREE_MODEL(section->LV),&iter); - gtk_list_store_set(section->LV,&iter,0, pixbuf, 1,applist[i].Name,2,0.0,3,0.5, 4, sz+8, 5, applist[i].Icon, -1); + gtk_list_store_set(section->LV,&iter,0,applist[i].Name,1,0.0,2,0.5, 3, sz+8, 4, pixbuf, 5,yon_get_icon_size(*main_config.currentThemeIconSize), -1); int cols = gtk_icon_view_get_columns(GTK_ICON_VIEW(section->IV)); gtk_icon_view_set_columns(GTK_ICON_VIEW(section->IV), -1); gtk_icon_view_set_columns(GTK_ICON_VIEW(section->IV), cols); - yon_time_reg_for_average(times,sz++,clock()); } } - printf("среднее время на каждую проверку: %f\n",yon_time_average(times)/1000); gtk_icon_view_set_model(GTK_ICON_VIEW(section->IV),GTK_TREE_MODEL(section->LV)); }; @@ -869,7 +864,6 @@ apps *find_apps(int *sizef){ FILE *file; char *path=yon_char_get_augumented(DesktopPath,de->d_name); file=fopen(path,"r"); - //printf("%s\n",path); if (strlen(de->d_name)>9) { char *extension=strstr(path,"."); @@ -1187,7 +1181,7 @@ IVGraphicals *yon_create_single_section_IV(char *name,char *cats){ //gtk_widget_set_name(iv,"workingbg"); gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); } - gtk_icon_view_set_text_column(GTK_ICON_VIEW(iv),1); + gtk_icon_view_set_text_column(GTK_ICON_VIEW(iv),0); GtkWidget *sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); GtkListStore *lv=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststoreTemplate")); gtk_widget_set_name(sep,"SepIcon"); @@ -1274,7 +1268,7 @@ void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned){ IVGraphicals *icv=(IVGraphicals*)dict->data; int width=gtk_paned_get_position(GTK_PANED(paned)); int pos=(int)((double)width); - if (pos < 115) pos=115; + if (pos < 100) pos=100; gtk_icon_view_set_item_width(GTK_ICON_VIEW(icv->IV),pos); } @@ -1375,6 +1369,13 @@ void yon_switch_theme(dictionary **dict, dictionary *newone){ } +int yon_get_icon_size(int size){ + if (size==1||size==24) return 24; + if (size==2||size==32) return 32; + if (size==3||size==48) return 51; + if (size==4||size==64) return 64; +} + void yon_icon_size_convert(int mode){ if (mode==0){ if (*main_config.currentThemeIconSize==1) *main_config.currentThemeIconSize=24; @@ -1649,13 +1650,14 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them 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->infoWarningWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"windowSettings-infoWarning")); curWidgets->applist=applist; curWidgets->appssize=appsize; - + GtkIconTheme *icthm=gtk_icon_theme_get_default(); 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); + gtk_window_set_icon(GTK_WINDOW(curWidgets->window),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); + gtk_window_set_icon(GTK_WINDOW(curWidgets->SectionSettingsWindow),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(32),1,GTK_ICON_LOOKUP_FORCE_SVG),NULL)); g_signal_connect(G_OBJECT(curWidgets->MenuItemDocumentation), "activate", G_CALLBACK(on_ButtonOpenHelp_activated), curWidgets->builder); g_signal_connect(G_OBJECT(curWidgets->MenuItemSettings), "activate", G_CALLBACK(on_settingsOpen), curWidgets); @@ -1716,7 +1718,6 @@ int main(int argc, char *argv[]){ for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } - printf("\n\n"); yon_show_icon_views(widg->ICSys,widg); yon_icv_resize_item(widg->ICSys,widg->GnomePaned); theme="Main"; @@ -1729,13 +1730,15 @@ int main(int argc, char *argv[]){ widg->applist=applist; widg->appssize=*size; widg->ICSys=yon_create_icon_section_list(main_config.sections); + main_config.currentThemeIconSize=&main_config.Mainiconsize; + main_config.currentThemeLabelSize=&main_config.MainlabelSize; for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } - printf("\n\n"); yon_show_icon_views(widg->ICSys,widg); main_config.WindowTheme=1; - + main_config.currentThemeIconSize=&main_config.Gnomeiconsize; + main_config.currentThemeLabelSize=&main_config.GnomelabelSize; } else { theme="Main"; @@ -1746,7 +1749,6 @@ int main(int argc, char *argv[]){ for (dictionary *cur=widg->ICSys->first; cur!=NULL;cur=cur->next){ load_apps((IVGraphicals*)cur->data,widg->applist,widg->appssize); } - printf("\n\n"); yon_show_icon_views(widg->ICSys,widg); theme="Gnome"; main_config.WindowTheme=1; @@ -1757,14 +1759,17 @@ int main(int argc, char *argv[]){ widg=(actionWidgets*)widgets->next->data; widg->applist=applist; widg->appssize=*size; + main_config.currentThemeIconSize=&main_config.Gnomeiconsize; + main_config.currentThemeLabelSize=&main_config.GnomelabelSize; 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); } - printf("\n\n"); yon_show_icon_views(widg->ICSys,widg); main_config.WindowTheme=0; yon_icv_resize_item(widg->ICSys,widg->GnomePaned); + main_config.currentThemeIconSize=&main_config.Mainiconsize; + main_config.currentThemeLabelSize=&main_config.MainlabelSize; } if (geteuid()==0){ } @@ -1785,7 +1790,8 @@ int main(int argc, char *argv[]){ 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(ublinux_logo,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.currentThemeIconSize,*main_config.currentThemeIconSize,1,NULL)); + GtkIconTheme *icthm=gtk_icon_theme_get_default(); + gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gtk_icon_info_load_icon(gtk_icon_theme_lookup_icon_for_scale(icthm, AppIconPath,yon_get_icon_size(*main_config.currentThemeIconSize),1,GTK_ICON_LOOKUP_FORCE_SVG),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(), diff --git a/source/ubl-settings-manager.h b/source/ubl-settings-manager.h index 5c8f997..d10ecef 100644 --- a/source/ubl-settings-manager.h +++ b/source/ubl-settings-manager.h @@ -9,20 +9,16 @@ #define CssPath "/usr/share/ubl-settings-manager/css/ubl-settings-manager.css" #define GlobalConfigPath "/etc/ubconfig-main.conf" #define UserConfigPath "/.config/ubl-settings-manager/ubconfig-main.conf" -#define AppIconPath "/usr/share/icons/hicolor/scalable/apps/ubl-settings-manager.svg" -#define AppBannerPath "//usr/share/ubl-settings-manager/ui/ubl-settings-manager.png" +#define AppIconPath "ubl-settings-manager" +#define AppBannerPath "/usr/share/ubl-settings-manager/ui/ubl-settings-manager-banner.png" #define DesktopPath "/usr/share/applications/" #define IconPicturesPath "/usr/share/icons/hicolor/scalable/apps/" -#define ErrIconPicturePath "/usr/share/icons/Faenza/emblems/32/emblem-important.png" #define ublinux_logo "/usr/share/ubl-settings-manager/ui/ublinux-logo.svg" -#define PictureFormatMain ".svg" -#define PictureFormatExtra ".png" #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 "ubl-settings-info" #define ubl_settings_infoPathLaunch "ubl-settings-info --socket-id=" - +char *version_application = "1.3"; typedef struct apps{ char *Name; @@ -34,6 +30,11 @@ typedef struct apps{ int DualPluggable; } apps; +typedef struct { + char *command; + int *exitcode; +} thread_output; + typedef struct dictionary { char *key; void *data; @@ -155,7 +156,7 @@ typedef struct { int appssize; apps *applist; GtkWidget *icvpack; - + GtkWidget *infoWarningWindow; } actionWidgets; @@ -176,9 +177,9 @@ void on_ButtonOpenHelp_activated(GtkWidget *button, GtkBuilder *builder); void on_backToSettingsButton_clicked(GtkWidget *button,actionWidgets *sctb); void on_CancelHelpButton_activated(GtkWidget *button,GtkBuilder *builder); void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder); -void launch_app_with_arguments(char *name, char *args); -void launch_app(char *name); -void py_launch_app(char *name,char *args); +int launch_app_with_arguments(char *name, char *args); +int launch_app(char *name); +int py_launch_app(char *name,char *args); int on_settings_accept(GtkWidget *button, dictionary **widgetsDs); void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *widgets); int on_settingsOpen(GtkWidget *button, actionWidgets *widgets); @@ -215,10 +216,11 @@ 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); +int launch(thread_output *thread); float yon_time_average(dictionary *times); void yon_time_reg_for_average(dictionary *listofregs, int size, time_t tm); void yon_dictionary_switch_to_last(dictionary **dict); dictionary *yon_dictionary_create_conneced(dictionary *targetdict); +int yon_get_icon_size(int size); #endif \ No newline at end of file diff --git a/ubl-settings-manager.png b/ubl-settings-manager-banner.png similarity index 100% rename from ubl-settings-manager.png rename to ubl-settings-manager-banner.png diff --git a/ubl-settings-manager.glade b/ubl-settings-manager.glade index 2db0b73..43378f6 100644 --- a/ubl-settings-manager.glade +++ b/ubl-settings-manager.glade @@ -138,11 +138,11 @@ - + False - 800 - 600 - ubconfig-gui + 450 + 250 + dialog-question True @@ -152,21 +152,41 @@ True False + + + True + False + start + 20 + 20 + dialog-question-symbolic + 6 + + + False + True + 0 + + True False - True vertical - + True False - center - 3 + start + 10 + 5 + Would you like to read documentation in the Web? + 0 + + + @@ -175,190 +195,60 @@ 0 - - - - False - True - 0 - - - - - True - True - 52 - True - True - + True - True - external - in - - - True - False - immediate - - - True - False - vertical - - - - - - - - + False + start + start + 15 + 10 + You will be redirected to documentation website where documentation is translated and supported by community. + True + 0 + - False - True + True + True + 1 - + + Always redirect to online documentation True - False - vertical - - - True - False - vertical - - - True - False - 3 - 3 - 3 - 3 - 3 - 0 - in - - - True - False - 12 - - - True - False - center - center - - - - False - True - 0 - - - - - True - False - - - desklabel - True - False - center - right - 1 - - - False - True - 0 - - - - - False - True - 1 - - - - - - - - - - - - - True - True - 0 - - - - - True - True - 0 - - - - - True - False - vertical - - - False - vertical - - - - - - False - True - 0 - - - - - False - True - 1 - - + True + False + end + 5 + 10 + True + - True - True + False + True + 2 + True True - end 1 + True @@ -366,209 +256,8 @@ 0 - - - - - True - False - True - - - True - False - 32 - ubconfig-gui - 5 - - - - True - False - center - center - vertical - - - - - - 1 - - - - - True - False - - - True - True - False - True - center - center - GnomeMenu - none - - - - - - - False - True - 0 - - - - - end - 2 - - - - - True - False - center - center - - - - - - end - 3 - - - - - - - - False - 450 - 250 - dialog-question - - - True - False - vertical - - - True - False - - - True - False - start - 20 - 20 - dialog-question-symbolic - 6 - - - False - True - 0 - - - - - True - False - vertical - - - True - False - start - 10 - 5 - Would you like to read documentation in the Web? - - - - - - - False - True - 0 - - - - - True - False - start - start - 15 - 10 - You will be redirected to documentation website where documentation is translated and supported by community. - True - - - - True - True - 1 - - - - - Always redirect to online documentation - True - True - False - end - 5 - 10 - True - - - - False - True - 2 - - - - - - True - True - 1 - - - - - - True - True - 0 - - - - + True False 5 @@ -943,7 +632,7 @@ True False 32 - ubconfig-gui + ubl-settings-manager 5 @@ -985,7 +674,7 @@ True False center - gtk-missing-image + ubl-settings-manager-banner 3 + + + + 2 + + + + + True + False + vertical + + + True + True + False + True + center + center + MainMenu + none + False + + + + + + False + True + 0 + + + + + end + 3 + + + + + True + False + center + center + + + + + + + end + 4 + + + + + + + + True + False + gtk-undelete + + + True + False + ubconfig-gui + 6 + + + True + False + + + True + False + Element 1 + + + + + True + False + Element 2 + + + True + False + + + True + False + Element 3 + + + + + + + + + Element 4 + True + False + image3 + False + + + + + True + False + object-select-symbolic + + + False + 800 + 600 + + + True + False + vertical + + + True + True + 5 + 5 + 5 + 5 + in + + + True + False + + + True + False + vertical + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + 5 + 0.019999999552965164 + in + + + True + False + 3 + 3 + 5 + 5 + + + True + False + + + True + True + True + center + 3 + image2 + + + False + True + 0 + + + + + True + True + True + False + Section name + name + + + True + True + 1 + + + + + True + False + + + True + False + center + + + True + True + True + 5 + image4 + + + False + True + end + 2 + + + + + True + False + 2 + + + True + True + 5 + 5 + 5 + 10 + False + Identifier + + + True + True + 0 + + + + + True + True + 2 + + + + + True + True + 1 + + + + + True + True + 2 + + + + + + + + + + + + False + True + 1 + + + + + + - 2 + True + True + 0 True False - vertical - + + Close True True - False True - center - center - MainMenu - none - False - - - + 5 + 5 False True + end 0 - - - end - 3 - - - - - True - False - center - center - + + Save and apply + True + True + True + 17 + 5 + + + False + True + end + 1 + - - end - 4 + False + True + 1 - - - - - - True - False - gtk-undelete - - - True - False - ubconfig-gui - 6 - - - True - False - - - True - False - Element 1 - - + + True False - Element 2 - - + UBLinux Settings + + True False - - - True - False - Element 3 - - + 32 + ubl-settings-manager + 5 - - - Element 4 - True - False - image3 - False - - - + True False - object-select-symbolic + go-first-symbolic - + False 800 600 + ubconfig-gui True False vertical - + True - True - 5 - 5 - 5 - 5 - in + False - + True False + True + vertical - + True False - vertical + center + 3 + + + + False + True + 0 + + + + + + False + True + 0 + + + + + True + True + 52 + True + True + + + True + True + external + in - + True False - 5 - 5 - 5 - 5 - 5 - 5 - vertical + immediate + natural - + + True + False + vertical + + + + + - - False - True - 0 - + + + False + True + + + + + True + False + vertical - + True False - 5 - 5 - 5 - 5 - 0.019999999552965164 - in + vertical - + True False - 3 - 3 - 5 - 5 + 3 + 3 + 3 + 3 + 3 + 0 + in - + True False - - - True - True - True - center - 3 - image2 - - - False - True - 0 - - - - - True - True - True - False - Section name - name - - - True - True - 1 - - + 12 True False + center + center - + + + False + True + 0 + + + + True False - center - - - True - True - True - 5 - image4 - - - False - True - end - 2 - - - + + desklabel True False - 2 - - - True - True - 5 - 5 - 5 - 10 - False - Identifier - - - True - True - 0 - - + center + right + 1 - True + False True - 2 + 0 - True + False True 1 - - True - True - 2 - + + + + + + True + True + 0 + - - + + + True + True + 0 + + + + + True + False + vertical + + + False + vertical + + + + + + False + True + 0 + @@ -1451,8 +1426,18 @@ + + True + True + + + True + True + end + 1 + @@ -1461,65 +1446,105 @@ 0 + + + + + True + False + True + + + True + False + 32 + ubl-settings-manager + 5 + + + + + Back to settings + True + False + False + False + center + center + 10 + 10 + image5 + + + 1 + + True False - - Close + True True + False True - 5 - 5 + center + center + GnomeMenu + none + + + + False True - end 0 + + + end + 2 + + + + + True + False + center + center - - Save and apply - True - True - True - 17 - 5 - - - False - True - end - 1 - + - False - True - 1 + end + 3 - - - - - True - False - UBLinux Settings - + True False - 32 - ubconfig-gui - 5 + center + center + vertical + + + + + 4 + + @@ -1539,8 +1564,6 @@ - - @@ -1549,30 +1572,34 @@ - - + + + + True True 4 + natural horizontal liststoreTemplate 135 - 10 - 0 - 0 - 0 + 2 + 2 + 5 True - + + 2 + - 4 - 2 - 3 - 5 - 0 + 3 + 1 + 2 + 4 + 5