Merge pull request 'devel' (#2) from devel into master

Reviewed-on: YanTheKaller/ubl-settings-manager#2
pull/2/head
commit 49121f1806

@ -151,13 +151,18 @@ void on_ReadHelpButton_activated(GtkWidget *button, GtkBuilder *builder){
};
int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){
dictionary *widgetsD=*widgetsDs;
if (main_config.WindowTheme==0)
main_config.curThemeName="Main";
else if (main_config.WindowTheme==1)
main_config.curThemeName="Gnome";
dictionary *widgetsD=yon_dictionary_find(widgetsDs,main_config.curThemeName);
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);
gtk_window_get_size(GTK_WINDOW(widgets->window),&main_config.windowWidth,&main_config.windowHeight);
if (theme==0)
main_config.curThemeName="Main";
else if (theme==1)
@ -170,29 +175,13 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){
gtk_window_move(GTK_WINDOW(loaderWindow),main_config.windowPosX,main_config.windowPosY);
gtk_widget_show(loaderWindow);
gtk_window_present(GTK_WINDOW(widgets->SettingsWindow));
gtk_widget_hide(widgets->window);
if (yon_dictionary_find(&widgetsD,main_config.curThemeName)==NULL){
dictionary *DCT=yon_dictionary_create_empty();
widgetsD->next=yon_theme_new(&DCT,widgets->builder,main_config.curThemeName,widgets->applist,widgets->appssize);
widgetsD->next->prev=widgetsD;
yon_switch_theme(widgetsDs,yon_dictionary_find(&widgetsD,main_config.curThemeName));
widgets=(actionWidgets*)widgetsD->data;
widgets->ICSys=yon_create_icon_section_list(main_config.sections);
for (dictionary *cur=widgets->ICSys->first; cur!=NULL;cur=cur->next){
load_apps((IVGraphicals*)cur->data,widgets->applist,widgets->appssize);
}
yon_show_icon_views(widgets->ICSys,widgets);
}
// gtk_widget_hide(widgets->window);
yon_switch_theme(widgetsDs,yon_dictionary_find(&widgetsD,main_config.curThemeName));
if (widgets!=(actionWidgets*)widgetsD->data) widgets=(actionWidgets*)widgetsD->data;
gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight);
gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY);
gtk_widget_show(widgets->window);
// gtk_widget_show(widgets->window);
gtk_widget_hide(loaderWindow);
main_config.WindowTheme=theme;
// main_config.WindowTheme=theme;
gtk_window_present(GTK_WINDOW(widgets->SettingsWindow));
}
GKeyFile *gfile=g_key_file_new();
int sz;
@ -228,6 +217,7 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){
void on_paned_move(GtkPaned* self, GtkScrollType* scroll_type, actionWidgets *widgets){ /* TODO */
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;
if (pos<110) pos=110;
@ -563,70 +553,51 @@ void on_section_delete(GtkWidget *button, actionWidgets *widgets){
}
void on_resized (GtkWidget *window, GdkEventConfigure *event, dictionary *widgetsD){
actionWidgets *widgets=(actionWidgets*)widgetsD->data;
gtk_window_get_position(GTK_WINDOW(widgets->window),&main_config.windowPosX,&main_config.windowPosY);
gtk_window_get_size(GTK_WINDOW(widgets->window),&main_config.windowWidth,&main_config.windowHeight);
dictionary *dct;
if (yon_dictionary_find(&widgetsD,"Main")==NULL){
dct=yon_dictionary_create_empty();
dictionary *newd=yon_theme_new(&dct,widgets->builder,"Main", widgets->applist,widgets->appssize);
widgetsD->next=newd;
newd->prev=widgetsD;
newd->first=widgetsD;
actionWidgets *widgetss=(actionWidgets*)widgetsD->data;
widgetss->ICSys=yon_create_icon_section_list(main_config.sections);
for (dictionary *cur=widgetss->ICSys->first; cur!=NULL;cur=cur->next){
load_apps((IVGraphicals*)cur->data,widgetss->applist,widgetss->appssize);
}
yon_show_icon_views(widgetss->ICSys,widgetss);
}
dictionary *newdd;
if (yon_dictionary_find(&widgetsD,"Gnome")==NULL){
newdd=yon_theme_new(&dct,widgets->builder,"Gnome", widgets->applist,widgets->appssize);
widgetsD->next=newdd;
newdd->prev=widgetsD;
newdd->first=widgetsD;
actionWidgets *widgetss=(actionWidgets*)widgetsD->data;
widgetss->ICSys=yon_create_icon_section_list(main_config.sections);
for (dictionary *cur=widgetss->ICSys->first; cur!=NULL;cur=cur->next){
load_apps((IVGraphicals*)cur->data,widgetss->applist,widgetss->appssize);
}
yon_show_icon_views(widgetss->ICSys,widgetss);
}
if (main_config.WindowTheme==1){
printf("\nAaAaAaAa\n");
actionWidgets *widgetss=(actionWidgets*)widgetsD->data;
GtkWidget *loaderWindow=GTK_WIDGET(gtk_builder_get_object(widgets->builder,"LoaderWindow"));
// gtk_window_resize(GTK_WINDOW(widgetss->window),main_config.windowWidth,main_config.windowHeight);
widgetsD=yon_dictionary_find(&widgetsD,"Gnome");
if (gtk_widget_get_visible(widgetss->window)==1){
widgetsD=yon_dictionary_find(&widgetsD,"Gnome");
gtk_window_resize(GTK_WINDOW(widgetss->window),1025,721);
if (main_config.windowWidth<1024&&main_config.windowHeight<720){
gtk_widget_hide(widgetss->window);
gtk_combo_box_set_active(GTK_COMBO_BOX(widgetss->settingsThemeChooser),0);
widgetsD=yon_dictionary_find(&widgetsD,"Main");
actionWidgets *widgetss=(actionWidgets*)widgetsD->data;
// gtk_window_resize(GTK_WINDOW(widgetss->window),1023,719);
gtk_widget_show(widgetss->window);
}
} else {
widgetsD=yon_dictionary_find(&widgetsD,"Main");
gtk_window_resize(GTK_WINDOW(widgetss->window),1024,720);
if (main_config.windowWidth>1024&&main_config.windowHeight>720){
gtk_widget_hide(widgetss->window);
gtk_combo_box_set_active(GTK_COMBO_BOX(widgetss->settingsThemeChooser),1);
widgetsD=yon_dictionary_find(&widgetsD,"Gnome");
actionWidgets *widgetss=(actionWidgets*)widgetsD->data;
// gtk_window_resize(GTK_WINDOW(widgetss->window),1025,721);
gtk_widget_show(widgetss->window);
}
int x,y;
gtk_window_get_size(GTK_WINDOW(window),&main_config.windowWidth,&main_config.windowHeight);
if (main_config.windowWidth<1024){
if (stld==0){
stld=1;
char *details=gtk_label_get_label(GTK_LABEL(widgets->GnomeInfoDetailsLabel));
//gtk_window_set_resizable(GTK_WINDOW(window),0);
// yon_switch_theme(&widgetsD,yon_dictionary_find(&widgetsD,"Main"));
details[12]='0';
details[13]='9';
printf("SSSSS\n");
gtk_label_set_markup(GTK_LABEL(widgets->GnomeInfoDetailsLabel),details);
GtkWidget *logo = gtk_builder_get_object(widgets->builder,"GnomeInfoLogo");
gtk_image_set_from_pixbuf(GTK_IMAGE(logo),gdk_pixbuf_new_from_file_at_scale(LogoPath,256,256,1,NULL));
// gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight);
// gtk_widget_hide(widgets->window);
}
}else {
if (stld==1){
stld=0;
char *details=gtk_label_get_label(GTK_LABEL(widgets->GnomeInfoDetailsLabel));
details[12]='1';
details[13]='2';
printf("SSSSS\n");
gtk_label_set_markup(GTK_LABEL(widgets->GnomeInfoDetailsLabel),details);
GtkWidget *logo = gtk_builder_get_object(widgets->builder,"GnomeInfoLogo");
gtk_image_set_from_pixbuf(GTK_IMAGE(logo),gdk_pixbuf_new_from_file_at_scale(LogoPath,512,512,1,NULL));
}
}
}
void on_resized_done (GtkWidget *window, GdkEvent *event, dictionary *widgetsD){
actionWidgets *widgets=(actionWidgets*)widgetsD->data;
if (event->type==GDK_CONFIGURE){
int x,y;
gtk_window_get_size(GTK_WINDOW(window),&x,&y);
if (x<1024&&y<720){
gtk_window_set_resizable(GTK_WINDOW(window),1);
printf("AAAAA\n");
// gtk_widget_hide(widgets->window);
}
}
gtk_window_get_size(GTK_WINDOW(widgets->window),&main_config.windowWidth,&main_config.windowHeight);
}
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);
@ -734,7 +705,6 @@ void sort_apps(apps *applist,int size){
};
apps *find_apps(int *sizef){
int size=0;
struct apps *applist;
{
@ -754,7 +724,6 @@ apps *find_apps(int *sizef){
if (strcmp(extension,".desktop")==0)
{
apps tempapp;
GKeyFile *gfile=g_key_file_new();
g_key_file_load_from_file(gfile,path,G_KEY_FILE_KEEP_TRANSLATIONS,NULL);
char *Type=g_key_file_get_string(gfile,"Desktop Entry", "Type",NULL);
@ -845,7 +814,6 @@ int check_categories(apps app, char *catstocheck){
n_found++;
left_cats=cat+1;
if (strlen(left_cats)==0 ||strcmp(left_cats,'\0')==0) break;
}
if (to_find==n_found) return 1; else return 0;
}
@ -1201,7 +1169,41 @@ 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;
gtk_widget_hide(widgets->window);
*dict=newone;
dct=*dict;
widgets=(actionWidgets*)dct->data;
gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight);
gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY);
if (strcmp(dct->key,"Gnome")==0){
int x,y;
GdkRectangle workarea;
gdk_monitor_get_workarea(gdk_display_get_monitor(gdk_screen_get_display(gtk_window_get_screen(GTK_WINDOW(widgets->window))),0),&workarea);
gtk_window_get_size(GTK_WINDOW(widgets->window),&x, &y);
if (workarea.width<1024&&workarea.height<720||x<1024&&y<720){
dictionary *founddict=yon_dictionary_find(dict,"Main");
dct=yon_dictionary_find(dict,"Gnome");
yon_switch_theme(&dct,founddict);
gtk_window_resize(GTK_WINDOW(widgets->window),main_config.windowWidth,main_config.windowHeight);
gtk_window_move(GTK_WINDOW(widgets->window),main_config.windowPosX,main_config.windowPosY);
main_config.WindowTheme=0;
main_config.curThemeName="Main";
gtk_combo_box_set_active(GTK_COMBO_BOX(widgets->settingsThemeChooser),0);
} else{
main_config.WindowTheme=1;
main_config.curThemeName="Gnome";
gtk_widget_show(widgets->window);
}
} else {
gtk_widget_show(widgets->window);
main_config.WindowTheme=0;
main_config.curThemeName="Main";
}
}
SectionSettingSegment *yon_create_section_setting(char *name, char *categories){
@ -1373,6 +1375,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them
curWidgets->SettingsSections=NULL;
gtk_style_context_add_class(gtk_widget_get_style_context(curWidgets->icvpack),"iconview");
if (curWidgets->GnomeInfoLabel!=NULL&&curWidgets->GnomeInfoDetailsLabel!=NULL){
FILE *fp;
char path[1035];
@ -1404,7 +1407,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them
line=yon_char_get_augumented(pth,line);
} else {
line=path;
pth="<span size=\"14pt\">\n";
pth="<span size=\"12pt\">\n";
line=yon_char_get_augumented(pth,line);
}
prevline=yon_char_get_augumented(prevline,line);
@ -1421,15 +1424,20 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them
gtk_button_set_label(GTK_BUTTON(curWidgets->ButtonBackToMain),_("Back to settings"));
gtk_window_set_title(GTK_WINDOW(curWidgets->window),"UBLinux Settings Manager");
g_signal_connect(G_OBJECT(curWidgets->window), "destroy", G_CALLBACK(gtk_main_quit), NULL);
if (curWidgets->GnomePaned!=NULL){
g_signal_connect(G_OBJECT(curWidgets->GnomePaned), "notify::position", G_CALLBACK(on_paned_move), curWidgets);
}
if (strcmp(theme_id,"Gnome")==0){
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);
}
if (curWidgets->ButtonBackToMain!=NULL)
g_signal_connect(G_OBJECT(curWidgets->ButtonBackToMain), "clicked", G_CALLBACK(on_backToSettingsButton_clicked), curWidgets);
curWidgets->LabelTitle=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"LabelTitle"));
gtk_window_set_title(GTK_WINDOW(curWidgets->window),"UBLinux Settings Manager GNOME");
if (curWidgets->GnomePaned!=NULL){
g_signal_connect(G_OBJECT(curWidgets->GnomePaned), "notify::position", G_CALLBACK(on_paned_move), curWidgets);
}
// Standard for all themes
curWidgets->settingsThemeChooser=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsThemeChooser"));
@ -1504,34 +1512,72 @@ int main(int argc, char *argv[]){
bindtextdomain (LocaleName, LocalePath);
textdomain (LocaleName);
actionWidgets *widget=malloc(sizeof(actionWidgets));
dictionary *widgets=malloc(sizeof(dictionary));
dictionary *widgets=yon_dictionary_create_empty();
widgets->data=widget;
widgets->first=widgets;
widgets->next=NULL;
widgets->prev=NULL;
int *size=malloc(sizeof(int));
apps *applist=find_apps(size);
sort_apps(applist,*size);
GtkBuilder *builder=gtk_builder_new_from_file(GladePath);
actionWidgets *widg=(actionWidgets*)widgets->first->data;
char *theme;
if (main_config.WindowTheme==0) theme="Main";
else if (main_config.WindowTheme==1) theme="Gnome";
else theme="Main";
yon_theme_new(&widgets->first, builder,theme,applist,*size);
widg->applist=applist;
widg->appssize=*size;
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);
if (main_config.WindowTheme==1){ theme="Gnome";
yon_theme_new(&widgets->first, builder,theme,applist,*size);
widg->applist=applist;
widg->appssize=*size;
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);
}
yon_show_icon_views(widg->ICSys,widg);
theme="Main";
main_config.WindowTheme=0;
widgets->next=yon_dictionary_create_empty();
widgets->next->first=widgets;
widgets->next->prev=widgets;
yon_theme_new(&widgets->next, builder,theme,applist,*size);
widg=(actionWidgets*)widgets->next->data;
widg->applist=applist;
widg->appssize=*size;
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);
}
yon_show_icon_views(widg->ICSys,widg);
main_config.WindowTheme=1;
}
yon_show_icon_views(widg->ICSys,widg);
else {theme="Main";
yon_theme_new(&widgets->first, builder,theme,applist,*size);
widg->applist=applist;
widg->appssize=*size;
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);
}
yon_show_icon_views(widg->ICSys,widg);
theme="Gnome";
main_config.WindowTheme=1;
widgets->next=yon_dictionary_create_empty();
widgets->next->first=widgets;
widgets->next->prev=widgets;
yon_theme_new(&widgets->next, builder,theme,applist,*size);
widg=(actionWidgets*)widgets->next->data;
widg->applist=applist;
widg->appssize=*size;
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);
}
yon_show_icon_views(widg->ICSys,widg);
main_config.WindowTheme=0;
}
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);
// hide_if_unfound(GTK_TREE_MODEL(widgets->ModelPersonal),&Personal);
GtkCssProvider *css=gtk_css_provider_new();
gtk_css_provider_load_from_path(css,CssPath,NULL);

@ -14,6 +14,7 @@
#define PictureFormatExtra ".svg"
#define LocalePath "locale/"
#define LocaleName "base"
#define LogoPath "images/ublinux-dark-glow-sc.svg"
typedef struct apps{

@ -249,6 +249,110 @@
</object>
</child>
</object>
<object class="GtkWindow">
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">30</property>
<property name="margin-end">30</property>
<property name="stock">gtk-dialog-warning</property>
<property name="icon_size">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="label" translatable="yes">You are not allowed to change theme on such low resolution!</property>
<property name="wrap">True</property>
<property name="xalign">0.019999999552965164</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Understood</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title" translatable="yes">UBLinux Settings Manager</property>
<child>
<object class="GtkImage">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="stock">gtk-dialog-warning</property>
<property name="icon_size">5</property>
</object>
</child>
</object>
</child>
</object>
<object class="GtkPopover">
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkLabel" id="MainInfoDetailsLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">label</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="lower">1</property>
<property name="upper">5</property>
@ -930,7 +1034,7 @@
<object class="GtkPaned" id="GnomePaned">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="position">152</property>
<property name="position">52</property>
<property name="position-set">True</property>
<property name="wide-handle">True</property>
<child>
@ -963,7 +1067,7 @@
</child>
</object>
<packing>
<property name="resize">True</property>
<property name="resize">False</property>
<property name="shrink">True</property>
</packing>
</child>
@ -981,7 +1085,6 @@
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">3</property>
<property name="margin-right">3</property>
<property name="margin-start">3</property>
<property name="margin-end">3</property>
@ -1001,7 +1104,7 @@
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkImage">
<object class="GtkImage" id="GnomeInfoLogo">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="halign">end</property>
@ -1105,7 +1208,7 @@
</child>
</object>
<packing>
<property name="resize">False</property>
<property name="resize">True</property>
<property name="shrink">True</property>
</packing>
</child>
@ -1113,6 +1216,7 @@
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>

Loading…
Cancel
Save