|
|
|
|
@ -14,6 +14,7 @@
|
|
|
|
|
#include<sys/utsname.h>
|
|
|
|
|
#include<sys/sysinfo.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
#include <wctype.h>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "ubl-settings-manager.h"
|
|
|
|
|
@ -48,10 +49,7 @@ void on_plug_added(GtkSocket* self, actionWidgets *builder){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_plug_removed(GtkSocket* self, actionWidgets *widgets){
|
|
|
|
|
|
|
|
|
|
//gtk_box_pack_start(GTK_BOX(widgets->workingwindow),widgets->HideWhileLaunch,TRUE,TRUE,10);
|
|
|
|
|
gtk_widget_show(widgets->HideWhileLaunch);
|
|
|
|
|
//gtk_widget_hide(widgets->socketplace);
|
|
|
|
|
gtk_widget_set_vexpand(widgets->socketplace,0);
|
|
|
|
|
gtk_widget_set_vexpand(widgets->HideWhileLaunch,1);
|
|
|
|
|
//printf("Plug has been removed!\n\n\n");
|
|
|
|
|
@ -414,7 +412,7 @@ void on_sections_move_up(GtkWidget *button, actionWidgets *widgets){
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void on_sections_move_down(GtkWidget *button, actionWidgets *widgets){
|
|
|
|
|
for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
SectionSettingSegment *segment=(SectionSettingSegment*)dct->data;
|
|
|
|
|
if (segment!=NULL){
|
|
|
|
|
if (button==segment->DragDownButton){
|
|
|
|
|
@ -453,7 +451,7 @@ for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void on_sections_delete(GtkWidget *button, actionWidgets *widgets){
|
|
|
|
|
for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
SectionSettingSegment *segment=(SectionSettingSegment*)dct->data;
|
|
|
|
|
if (segment!=NULL){
|
|
|
|
|
if (button==segment->DragDownButton){
|
|
|
|
|
@ -463,7 +461,7 @@ for (dictionary *dct=widgets->SettingsSections->first;dct!=NULL;dct=dct->next){
|
|
|
|
|
gtk_container_remove(GTK_CONTAINER(widgets->SectionSettingsPack),segment->MainFrame);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
void on_sections_add(GtkWidget *button, actionWidgets *widgets){
|
|
|
|
|
dictionary *dict=yon_dictionary_create_empty();
|
|
|
|
|
@ -1274,7 +1272,6 @@ void yon_dictionary_make_first(dictionary *dict){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dictionary *yon_theme_new(dictionary *widgets, GtkBuilder *builder, char *theme_id, apps *applist, int appsize){
|
|
|
|
|
actionWidgets *curWidgets=(actionWidgets*)widgets->data;
|
|
|
|
|
if (!curWidgets) {
|
|
|
|
|
@ -1294,28 +1291,51 @@ dictionary *yon_theme_new(dictionary *widgets, GtkBuilder *builder, char *theme_
|
|
|
|
|
curWidgets->icvpack=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"icvpack")));
|
|
|
|
|
curWidgets->GnomePaned=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"Paned")));
|
|
|
|
|
curWidgets->GnomeInfoLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"InfoLabel")));
|
|
|
|
|
curWidgets->GnomeInfoDetailsLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,yon_char_get_augumented(theme_id,"InfoDetailsLabel")));
|
|
|
|
|
curWidgets->SettingsSections=NULL;
|
|
|
|
|
|
|
|
|
|
gtk_style_context_add_class(gtk_widget_get_style_context(curWidgets->icvpack),"iconview");
|
|
|
|
|
if (curWidgets->GnomeInfoLabel!=NULL){
|
|
|
|
|
struct utsname sysinfos;
|
|
|
|
|
uname(&sysinfos);
|
|
|
|
|
printf("System Name = %s\n", sysinfos.sysname);
|
|
|
|
|
printf("Node Name = %s\n", sysinfos.nodename);
|
|
|
|
|
printf("Version = %s\n", sysinfos.version);
|
|
|
|
|
printf("Release = %s\n", sysinfos.release);
|
|
|
|
|
printf("Machine = %s\n", sysinfos.machine);
|
|
|
|
|
struct sysinfo info;
|
|
|
|
|
sysinfo(&info);
|
|
|
|
|
char lbl[2000];
|
|
|
|
|
memset(lbl,0,2000);
|
|
|
|
|
double mind=(double)info.uptime/60;
|
|
|
|
|
while(mind>60) mind-=60;
|
|
|
|
|
int minutes=mind;
|
|
|
|
|
sprintf(lbl,"Система: UBLinux\nЯдро: %s %s %s\nВремя работы: %d ч. %d мин. \n\nОперативная память: %d MiB/%d MiB\nЗапущенные процессы: %d\nСредняя загруженность процессора за 15 минут: %d%%\n",sysinfos.machine,sysinfos.sysname,sysinfos.release,info.uptime/60/60,minutes,info.freeram/1024/1024,info.totalram/1024/1024,info.procs,info.loads[2]/1000);
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(curWidgets->GnomeInfoLabel),lbl);
|
|
|
|
|
//printf("\n\n%d\n\n",info.totalram/1024/1024);
|
|
|
|
|
//printf("\n\n%d\n\n",info.freeram/1024/1024);
|
|
|
|
|
|
|
|
|
|
if (curWidgets->GnomeInfoLabel!=NULL&&curWidgets->GnomeInfoDetailsLabel!=NULL){
|
|
|
|
|
FILE *fp;
|
|
|
|
|
char path[1035];
|
|
|
|
|
char *loc=setlocale(LC_ALL,NULL);
|
|
|
|
|
if (strcmp(loc,"ru_RU.UTF-8")==0)
|
|
|
|
|
fp = popen("screenfetch -N -n | sed 's/OS:/Система:/' | sed 's/Kernel:/Ядро:/g' | sed 's/Uptime:/Время работы:/g' | \
|
|
|
|
|
sed 's/Packages:/Установлено пакетов:/g' | sed 's/Shell:/Оболочка:/g' | sed 's/Resolution:/Разрешение:/g' | sed 's/DE:/Среда рабочего стола:/g' | \
|
|
|
|
|
sed 's/WM:/Оконный менеджер:/g' | sed 's/WM Theme:/Тема оконного менеджера:/g' | sed 's/GTK Theme:/Тема GTK:/g' | sed 's/Icon Theme:/Тема значков:/g' | sed 's/Font:/Шрифт:/g' | \
|
|
|
|
|
sed 's/Disk:/Диск:/g' | sed 's/RAM:/Оперативная память:/g'", "r");
|
|
|
|
|
else fp = popen("screenfetch -n -w -N", "r");
|
|
|
|
|
if (fp == NULL) {
|
|
|
|
|
printf("Failed to run command\n" );
|
|
|
|
|
exit(1);
|
|
|
|
|
}
|
|
|
|
|
char *line=NULL;
|
|
|
|
|
line="";
|
|
|
|
|
char *prevline=NULL;
|
|
|
|
|
char *pth;
|
|
|
|
|
char *preph="";
|
|
|
|
|
line="";
|
|
|
|
|
while (fgets(path, sizeof(path),fp)!=NULL){
|
|
|
|
|
preph=pth;
|
|
|
|
|
prevline=line;
|
|
|
|
|
line=strstr(path,": ");
|
|
|
|
|
if (line!=NULL){
|
|
|
|
|
int size=strlen(path)-strlen(line);
|
|
|
|
|
pth=yon_cut(path,size,0);
|
|
|
|
|
// pth=_(pth);;;;
|
|
|
|
|
pth=yon_char_get_augumented(preph,pth);
|
|
|
|
|
pth=yon_char_get_augumented(pth,"\n");
|
|
|
|
|
} else {
|
|
|
|
|
line=path;
|
|
|
|
|
pth="\n";
|
|
|
|
|
}
|
|
|
|
|
line=yon_char_get_augumented(prevline,line);
|
|
|
|
|
};
|
|
|
|
|
prevline=line;
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(curWidgets->GnomeInfoDetailsLabel),prevline);
|
|
|
|
|
gtk_label_set_text(GTK_LABEL(curWidgets->GnomeInfoLabel),pth);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (curWidgets->ButtonBackToMain!=NULL)
|
|
|
|
|
|