|
|
|
|
@ -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)));
|
|
|
|
|
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==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[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;i<size;i++){
|
|
|
|
|
if (strcmp(applist[i].Name,name)==0) return &applist[i];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -706,10 +747,25 @@ int hide_if_unfound(dictionary *widgetsD){
|
|
|
|
|
GtkWidget *create_socket(actionWidgets *builder){
|
|
|
|
|
GtkWidget *socket;
|
|
|
|
|
socket = gtk_socket_new();
|
|
|
|
|
GtkWidget *socketbutton=gtk_socket_new();
|
|
|
|
|
GtkWidget *ThirdSocket=gtk_socket_new();
|
|
|
|
|
g_signal_connect(G_OBJECT(socket),"plug-added",G_CALLBACK(on_plug_added),builder);
|
|
|
|
|
g_signal_connect(G_OBJECT(socket),"plug-removed",G_CALLBACK(on_plug_removed),builder);
|
|
|
|
|
g_signal_connect(G_OBJECT(socket),"destroy",G_CALLBACK(on_plug_removed),builder);
|
|
|
|
|
|
|
|
|
|
// g_signal_connect(G_OBJECT(socketbutton),"plug-added",G_CALLBACK(on_plug_added),builder);
|
|
|
|
|
// g_signal_connect(G_OBJECT(socketbutton),"plug-removed",G_CALLBACK(on_plug_removed),builder);
|
|
|
|
|
// g_signal_connect(G_OBJECT(socketbutton),"destroy",G_CALLBACK(on_plug_removed),builder);
|
|
|
|
|
|
|
|
|
|
// g_signal_connect(G_OBJECT(ThirdSocket),"plug-added",G_CALLBACK(on_plug_added),builder);
|
|
|
|
|
// g_signal_connect(G_OBJECT(ThirdSocket),"plug-removed",G_CALLBACK(on_plug_removed),builder);
|
|
|
|
|
// g_signal_connect(G_OBJECT(ThirdSocket),"destroy",G_CALLBACK(on_plug_removed),builder);
|
|
|
|
|
|
|
|
|
|
gtk_box_pack_start(GTK_BOX(builder->socketplace),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);
|
|
|
|
|
|