|
|
|
|
@ -50,6 +50,10 @@ void on_plug_added(GtkSocket* self, actionWidgets *builder){
|
|
|
|
|
gtk_widget_hide(builder->appSettings);
|
|
|
|
|
if (builder->ButtonBackToMain!=NULL) gtk_widget_set_sensitive(builder->ButtonBackToMain,1);
|
|
|
|
|
gtk_widget_show(GTK_WIDGET(self));
|
|
|
|
|
gtk_widget_show(builder->socketbuttonplace);
|
|
|
|
|
gtk_widget_show(builder->ThirdSocketPlace);
|
|
|
|
|
gtk_widget_show(builder->socketbutton);
|
|
|
|
|
gtk_widget_show(builder->ThirdSocket);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_plug_removed(GtkSocket* self, actionWidgets *widgets){
|
|
|
|
|
@ -205,11 +209,16 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
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;
|
|
|
|
|
char *fromint=malloc(5);
|
|
|
|
|
memset(fromint,0,5);
|
|
|
|
|
GError *err=NULL;
|
|
|
|
|
@ -245,19 +254,27 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){
|
|
|
|
|
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);
|
|
|
|
|
g_key_file_set_string(gfile,"window","GnomeIconSize",fromint);
|
|
|
|
|
sprintf(fromint,"%d",szm);
|
|
|
|
|
g_key_file_set_string(gfile,"window","MainIconSize",fromint);
|
|
|
|
|
sprintf(fromint,"%d",main_config.iconSegmentSize);
|
|
|
|
|
g_key_file_set_string(gfile,"window","IconSegmentSize",fromint);
|
|
|
|
|
sprintf(fromint,"%d",(int)((float)main_config.labelSize/1000));
|
|
|
|
|
g_key_file_set_string(gfile,"window","LabelSize",fromint);
|
|
|
|
|
sprintf(fromint,"%d",(int)((float)main_config.GnomelabelSize/1000));
|
|
|
|
|
g_key_file_set_string(gfile,"window","GnomeLabelSize",fromint);
|
|
|
|
|
sprintf(fromint,"%d",(int)((float)main_config.MainlabelSize/1000));
|
|
|
|
|
g_key_file_set_string(gfile,"window","MainLabelSize",fromint);
|
|
|
|
|
sprintf(fromint,"%d",(int)((float)main_config.labelDensity/1000));
|
|
|
|
|
g_key_file_set_string(gfile,"window","LabelDensity",fromint);
|
|
|
|
|
g_key_file_set_string(gfile,"window","User",login);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
if (main_config.changed==1){
|
|
|
|
|
load_apps_with_clear(IV,widgets->applist,widgets->appssize);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
main_config.changed=0;
|
|
|
|
|
g_key_file_save_to_file(gfile,pth,NULL);
|
|
|
|
|
gtk_widget_hide(widgets->SettingsWindow);
|
|
|
|
|
//gtk_window_present(GTK_WINDOW(widgets->SettingsWindow));
|
|
|
|
|
@ -267,7 +284,7 @@ void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *wi
|
|
|
|
|
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;
|
|
|
|
|
double pos=((double)position-(11/(double)position*4)*500)/1.3;
|
|
|
|
|
if (pos<110) pos=110;
|
|
|
|
|
//printf("Paned moved to %f\n",pos);
|
|
|
|
|
for (dictionary *dict=widgets->ICSys;dict!=NULL;dict=dict->next){
|
|
|
|
|
@ -285,15 +302,15 @@ int on_settingsOpen(GtkWidget *button, actionWidgets *widgets){
|
|
|
|
|
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;
|
|
|
|
|
if (*main_config.currentThemeIconSize==64) sz=4;
|
|
|
|
|
if (*main_config.currentThemeIconSize==48) sz=3;
|
|
|
|
|
if (*main_config.currentThemeIconSize==32) sz=2;
|
|
|
|
|
if (*main_config.currentThemeIconSize==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);
|
|
|
|
|
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("/usr/share/icons/hicolor/32x32/apps/ublinux-ubconfig.svg",main_config.iconsize,main_config.iconsize,1,NULL));
|
|
|
|
|
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_window_present(GTK_WINDOW(widgets->SettingsWindow));
|
|
|
|
|
};
|
|
|
|
|
@ -301,24 +318,32 @@ int on_settingsOpen(GtkWidget *button, actionWidgets *widgets){
|
|
|
|
|
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_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,24,24,1,NULL));
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24");
|
|
|
|
|
main_config.iconsize=24;
|
|
|
|
|
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("/usr/share/icons/hicolor/32x32/apps/ublinux-ubconfig.svg",32,32,1,NULL));
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,32,32,1,NULL));
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"32x32");
|
|
|
|
|
main_config.iconsize=32;
|
|
|
|
|
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("/usr/share/icons/hicolor/32x32/apps/ublinux-ubconfig.svg",48,48,1,NULL));
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,48,48,1,NULL));
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"48x48");
|
|
|
|
|
main_config.iconsize=48;
|
|
|
|
|
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("/usr/share/icons/hicolor/32x32/apps/ublinux-ubconfig.svg",64,64,1,NULL));
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(widgets->settingsIcon),gdk_pixbuf_new_from_file_at_scale(AppIconPath,64,64,1,NULL));
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"64x64");
|
|
|
|
|
main_config.iconsize=64;
|
|
|
|
|
if (*main_config.currentThemeIconSize!=64)
|
|
|
|
|
main_config.changed=1;
|
|
|
|
|
*main_config.currentThemeIconSize=64;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -613,6 +638,8 @@ 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;
|
|
|
|
|
|
|
|
|
|
// printf("1\n");
|
|
|
|
|
gtk_window_get_size(GTK_WINDOW(window),&main_config.windowWidth,&main_config.windowHeight);
|
|
|
|
|
if (main_config.windowWidth<1240){
|
|
|
|
|
if (stld==0){
|
|
|
|
|
@ -623,7 +650,7 @@ void on_resized (GtkWidget *window, GdkEventConfigure *event, dictionary *widget
|
|
|
|
|
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;
|
|
|
|
|
*main_config.currentThemeIconSize=24;
|
|
|
|
|
|
|
|
|
|
for (dictionary *dict=widgets->ICSys->first;dict!=NULL;dict=dict->next){
|
|
|
|
|
IVGraphicals *IV=(IVGraphicals*)dict->data;
|
|
|
|
|
@ -633,6 +660,8 @@ void on_resized (GtkWidget *window, GdkEventConfigure *event, dictionary *widget
|
|
|
|
|
gtk_widget_hide(widgets->window);
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
yon_segments_hide(widgets);
|
|
|
|
|
yon_segments_show(widgets);
|
|
|
|
|
if (stld==1){
|
|
|
|
|
stld=0;
|
|
|
|
|
cmld=0;
|
|
|
|
|
@ -693,13 +722,14 @@ apps *get_app_by_name(apps *applist,char *name, int size){
|
|
|
|
|
|
|
|
|
|
int reload_list(IVGraphicals *section){
|
|
|
|
|
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);
|
|
|
|
|
//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;
|
|
|
|
|
int i=0,sz=0;
|
|
|
|
|
dictionary *times=yon_dictionary_create_empty();
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
if (check_categories(applist[i],section->categories)==1){
|
|
|
|
|
GError *err=NULL;
|
|
|
|
|
@ -709,20 +739,23 @@ int load_apps(IVGraphicals *section, apps *applist, int size){
|
|
|
|
|
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);
|
|
|
|
|
pixbuf=gdk_pixbuf_new_from_file_at_size(path,*main_config.currentThemeIconSize,*main_config.currentThemeIconSize,NULL);
|
|
|
|
|
if (!pixbuf) {
|
|
|
|
|
pixbuf=gdk_pixbuf_new_from_file_at_size(ErrIconPicturePath,main_config.iconsize,main_config.iconsize,NULL);
|
|
|
|
|
pixbuf=gdk_pixbuf_new_from_file_at_size(ErrIconPicturePath,*main_config.currentThemeIconSize,*main_config.currentThemeIconSize,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);
|
|
|
|
|
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,-1);
|
|
|
|
|
yon_time_reg_for_average(times,sz++,clock());
|
|
|
|
|
}
|
|
|
|
|
//printf("Конец\n");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
printf("среднее время на каждую проверку: %f\n",yon_time_average(times)/1000);
|
|
|
|
|
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);
|
|
|
|
|
//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){
|
|
|
|
|
@ -915,14 +948,27 @@ int setup_config(){
|
|
|
|
|
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.Mainiconsize=g_key_file_get_integer(configfile,"window","MainIconSize",NULL);
|
|
|
|
|
main_config.Gnomeiconsize=g_key_file_get_integer(configfile,"window","GnomeIconSize",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.MainlabelSize=g_key_file_get_integer(configfile,"window","MainLabelSize",NULL);
|
|
|
|
|
main_config.GnomelabelSize=g_key_file_get_integer(configfile,"window","GnomeLabelSize",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.MainlabelSize==0) main_config.MainlabelSize=12;
|
|
|
|
|
if (main_config.labelDensity==0) main_config.labelDensity=0;
|
|
|
|
|
main_config.labelSize=main_config.labelSize*1000;
|
|
|
|
|
main_config.MainlabelSize=main_config.MainlabelSize*1000;
|
|
|
|
|
if (main_config.GnomelabelSize==0) main_config.GnomelabelSize=12;
|
|
|
|
|
main_config.GnomelabelSize=main_config.GnomelabelSize*1000;
|
|
|
|
|
|
|
|
|
|
if (main_config.WindowTheme==0){
|
|
|
|
|
main_config.currentThemeLabelSize=&main_config.MainlabelSize;
|
|
|
|
|
main_config.currentThemeIconSize=&main_config.Mainiconsize;
|
|
|
|
|
} else if (main_config.WindowTheme==1){
|
|
|
|
|
main_config.currentThemeLabelSize=&main_config.GnomelabelSize;
|
|
|
|
|
main_config.currentThemeIconSize=&main_config.Gnomeiconsize;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
yon_icon_size_convert(0);
|
|
|
|
|
gsize length=0;
|
|
|
|
|
char **a=g_key_file_get_keys(configfile,"sections",&length,NULL);
|
|
|
|
|
@ -1005,12 +1051,23 @@ void yon_set_default_sections(dictionary **section){
|
|
|
|
|
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();
|
|
|
|
|
GtkBuilder *builder=gtk_builder_new_from_file(GladePath);
|
|
|
|
|
GtkWidget *iv=GTK_WIDGET(gtk_builder_get_object(builder,"iconTemplate"));
|
|
|
|
|
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");
|
|
|
|
|
PangoFontDescription *descr=pango_font_description_new();
|
|
|
|
|
pango_font_description_set_weight(descr,PANGO_WEIGHT_BOLD);
|
|
|
|
|
int stretch = main_config.labelDensity;
|
|
|
|
|
if (stretch>8)
|
|
|
|
|
stretch = 4;
|
|
|
|
|
pango_font_description_set_stretch(descr,main_config.labelDensity);
|
|
|
|
|
pango_attr_list_insert(attrs,pango_attr_size_new(*main_config.currentThemeLabelSize));
|
|
|
|
|
pango_attr_list_insert(attrs, pango_attr_font_desc_new(descr));
|
|
|
|
|
//gtk_label_set_attributes(GTK_LABEL(label),attrs);
|
|
|
|
|
gtk_widget_set_margin_end(label,6);
|
|
|
|
|
gtk_widget_set_margin_start(label,6);
|
|
|
|
|
gtk_widget_set_margin_bottom(label,2);
|
|
|
|
|
//gtk_widget_set_name(label,"SepIcon");
|
|
|
|
|
if (main_config.WindowTheme==1) {
|
|
|
|
|
gtk_icon_view_set_columns(GTK_ICON_VIEW(iv),1);
|
|
|
|
|
gtk_widget_set_name(iv,"GnomeIcon");
|
|
|
|
|
@ -1018,17 +1075,23 @@ IVGraphicals *yon_create_single_section_IV(char *name,char *cats){
|
|
|
|
|
gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_name(iv,"Icon");
|
|
|
|
|
gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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_name(sep,"SepIcon");
|
|
|
|
|
GtkListStore *lv=GTK_LIST_STORE(gtk_builder_get_object(builder,"liststoreTemplate"));
|
|
|
|
|
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_widget_set_margin_end(sep,6);
|
|
|
|
|
gtk_widget_set_margin_start(sep,6);
|
|
|
|
|
|
|
|
|
|
//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),150);
|
|
|
|
|
gtk_icon_view_set_model(GTK_ICON_VIEW(iv),GTK_TREE_MODEL(lv));
|
|
|
|
|
//gtk_icon_view_set_item_padding(GTK_ICON_VIEW(iv),0);
|
|
|
|
|
//gtk_icon_view_set_row_spacing(GTK_ICON_VIEW(iv),10);
|
|
|
|
|
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);
|
|
|
|
|
@ -1106,8 +1169,10 @@ 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);
|
|
|
|
|
int pos=(int)((double)width-(11/(double)width*4)*500)/1.3;
|
|
|
|
|
if (pos < 115) pos=115;
|
|
|
|
|
|
|
|
|
|
gtk_icon_view_set_item_width(GTK_ICON_VIEW(icv->IV),pos);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1204,15 +1269,15 @@ 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;
|
|
|
|
|
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;
|
|
|
|
|
if (*main_config.currentThemeIconSize==1) *main_config.currentThemeIconSize=24;
|
|
|
|
|
if (*main_config.currentThemeIconSize==2) *main_config.currentThemeIconSize=32;
|
|
|
|
|
if (*main_config.currentThemeIconSize==3) *main_config.currentThemeIconSize=48;
|
|
|
|
|
if (*main_config.currentThemeIconSize==4) *main_config.currentThemeIconSize=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;
|
|
|
|
|
if (*main_config.currentThemeIconSize==24) *main_config.currentThemeIconSize=1;
|
|
|
|
|
if (*main_config.currentThemeIconSize==32) *main_config.currentThemeIconSize=2;
|
|
|
|
|
if (*main_config.currentThemeIconSize==48) *main_config.currentThemeIconSize=3;
|
|
|
|
|
if (*main_config.currentThemeIconSize==64) *main_config.currentThemeIconSize=4;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1319,6 +1384,19 @@ dictionary *yon_dictionary_create_empty(){
|
|
|
|
|
return dict;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_dictionary_switch_to_last(dictionary **dict){
|
|
|
|
|
if ((*dict)->next!=NULL)
|
|
|
|
|
for ((*dict)=(*dict)->first;(*dict)->next!=NULL;(*dict)=(*dict)->next){}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dictionary * yon_dictionary_create_conneced(dictionary *targetdict){
|
|
|
|
|
yon_dictionary_switch_to_last(&targetdict);
|
|
|
|
|
targetdict->next=yon_dictionary_create_empty();
|
|
|
|
|
targetdict->next->prev=targetdict;
|
|
|
|
|
targetdict->next->first=targetdict->first;
|
|
|
|
|
return targetdict->next;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
@ -1331,6 +1409,7 @@ void yon_segment_show(actionWidgets *widgets, SectionSettingSegment *sgm){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_segments_show(actionWidgets *widgets){
|
|
|
|
|
if(widgets->SettingsSections)
|
|
|
|
|
for (dictionary *dict=widgets->SettingsSections->first;dict!=NULL;dict=dict->next){
|
|
|
|
|
SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data;
|
|
|
|
|
if (sgm!=NULL)
|
|
|
|
|
@ -1341,6 +1420,7 @@ void yon_segments_show(actionWidgets *widgets){
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void yon_segments_hide(actionWidgets *widgets){
|
|
|
|
|
if(widgets->SettingsSections)
|
|
|
|
|
for (dictionary *dict=widgets->SettingsSections->first;dict!=NULL;dict=dict->next){
|
|
|
|
|
SectionSettingSegment *sgm=(SectionSettingSegment*)dict->data;
|
|
|
|
|
if (sgm!=NULL){
|
|
|
|
|
@ -1356,6 +1436,24 @@ void yon_dictionary_make_first(dictionary *dict){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float yon_time_average(dictionary *times){
|
|
|
|
|
int sum=0;
|
|
|
|
|
int size=0;
|
|
|
|
|
for (dictionary *i=times->first;i!=NULL;i=i->next){
|
|
|
|
|
sum+=(time_t)i->data;
|
|
|
|
|
size++;
|
|
|
|
|
}
|
|
|
|
|
return (float)sum/size;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_time_reg_for_average(dictionary *listofregs, int size, time_t tm){
|
|
|
|
|
yon_dictionary_switch_to_last(&listofregs);
|
|
|
|
|
time_t prev=(time_t)listofregs->data;
|
|
|
|
|
listofregs=yon_dictionary_create_conneced(listofregs);
|
|
|
|
|
listofregs->data=(void*)(tm-prev);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_small_window_theme_change(actionWidgets *widgets){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -1384,12 +1482,15 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them
|
|
|
|
|
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->MenuItemSettings=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemSettings")));
|
|
|
|
|
curWidgets->MenuItemDocumentation=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemDocumentation")));
|
|
|
|
|
curWidgets->MenuItemAboutSystem=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"MenuItemAboutSystem")));
|
|
|
|
|
curWidgets->SettingsSections=NULL;
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
// curWidgets->MenuItemAboutSystem=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"MenuItemAboutSystem"));
|
|
|
|
|
g_signal_connect(G_OBJECT(curWidgets->MenuItemAboutSystem), "clicked", 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");
|
|
|
|
|
@ -1414,9 +1515,6 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them
|
|
|
|
|
|
|
|
|
|
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"));
|
|
|
|
|
@ -1448,14 +1546,15 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(curWidgets->MenuItemDocumentation), "clicked", G_CALLBACK(on_ButtonOpenHelp_activated), curWidgets->builder);
|
|
|
|
|
g_signal_connect(G_OBJECT(curWidgets->MenuItemSettings), "clicked", G_CALLBACK(on_settingsOpen), curWidgets);
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
@ -1476,9 +1575,9 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them
|
|
|
|
|
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->MenuItemSettings),_("Settings"));
|
|
|
|
|
gtk_button_set_label(GTK_BUTTON(curWidgets->MenuItemDocumentation),_("About..."));
|
|
|
|
|
gtk_button_set_label(GTK_BUTTON(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;
|
|
|
|
|
@ -1510,8 +1609,9 @@ 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);
|
|
|
|
|
gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),GTK_WIDGET(gtk_builder_get_object(builder,"GnomeScroll")));
|
|
|
|
|
//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;
|
|
|
|
|
@ -1526,12 +1626,14 @@ 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);
|
|
|
|
|
gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),widg->workingwindow);
|
|
|
|
|
//gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),widg->workingwindow);
|
|
|
|
|
main_config.WindowTheme=1;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {theme="Main";
|
|
|
|
|
else {
|
|
|
|
|
theme="Main";
|
|
|
|
|
yon_theme_new(&widgets->first, builder,theme,applist,*size);
|
|
|
|
|
widg->applist=applist;
|
|
|
|
|
widg->appssize=*size;
|
|
|
|
|
@ -1539,8 +1641,9 @@ 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);
|
|
|
|
|
gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),widg->workingwindow);
|
|
|
|
|
//gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),widg->workingwindow);
|
|
|
|
|
theme="Gnome";
|
|
|
|
|
main_config.WindowTheme=1;
|
|
|
|
|
widgets->next=yon_dictionary_create_empty();
|
|
|
|
|
@ -1554,8 +1657,9 @@ 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);
|
|
|
|
|
gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),GTK_WIDGET(gtk_builder_get_object(builder,"GnomeScroll")));
|
|
|
|
|
//gtk_overlay_add_overlay(GTK_OVERLAY(widg->Overlay),GTK_WIDGET(gtk_builder_get_object(builder,"GnomeScroll")));
|
|
|
|
|
main_config.WindowTheme=0;
|
|
|
|
|
yon_icv_resize_item(widg->ICSys,widg->GnomePaned);
|
|
|
|
|
}
|
|
|
|
|
@ -1566,7 +1670,7 @@ int main(int argc, char *argv[]){
|
|
|
|
|
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);
|
|
|
|
|
gtk_widget_show(widg->window);
|
|
|
|
|
hide_if_unfound(widgets);
|
|
|
|
|
if (main_config.WindowTheme==1)
|
|
|
|
|
gtk_widget_hide(widg->MenuItemAboutSystem);
|
|
|
|
|
@ -1579,7 +1683,7 @@ 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(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));
|
|
|
|
|
gtk_image_set_from_pixbuf(GTK_IMAGE(banner),gdk_pixbuf_new_from_file_at_scale(AppIconPath,*main_config.currentThemeIconSize,*main_config.currentThemeIconSize,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(),
|
|
|
|
|
|