From c64c028f2af9ac9af7ee91c300026532f9154cc4 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Wed, 22 Mar 2023 12:01:25 +0600 Subject: [PATCH] Added option to switch between double and single ckick icon activation; window fixes; missing icon fixes --- source/ubl-settings-manager.c | 49 +++++++++++- source/ubl-settings-manager.h | 8 +- ubl-settings-manager.glade | 143 ++++++++++++++++++++++------------ 3 files changed, 147 insertions(+), 53 deletions(-) diff --git a/source/ubl-settings-manager.c b/source/ubl-settings-manager.c index 8af934b..d9d4fed 100644 --- a/source/ubl-settings-manager.c +++ b/source/ubl-settings-manager.c @@ -257,6 +257,8 @@ int on_settings_accept(GtkWidget *button, dictionary **widgetsDs){ 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); + g_key_file_set_boolean(gfile,"window","GnomeDoubleClick",main_config.GnomeDoubleClick); + g_key_file_set_boolean(gfile,"window","MainDoubleClick",main_config.MainDoubleClick); g_key_file_remove_group(gfile, "sections",NULL); for (dictionary *dict=widgets->ICSys->first;dict!=NULL;dict=dict->next){ @@ -292,6 +294,7 @@ int on_settingsOpen(GtkWidget *button, actionWidgets *widgets){ 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); + gtk_switch_set_state(GTK_SWITCH(widgets->settingsDoubleClickSwitch),*main_config.currentDoubleClick); int sz=1; if (*main_config.currentThemeIconSize==64) sz=4; if (*main_config.currentThemeIconSize==48) sz=3; @@ -515,8 +518,12 @@ void on_sections_close(GtkWidget *button, actionWidgets *widgets){ } void on_sections_save(GtkWidget *button, dictionary *widgetsD){ + int temptheme=main_config.WindowTheme; for (dictionary *dict=widgetsD->first;dict!=NULL;dict=dict->next){ actionWidgets *widgets=(actionWidgets*)dict->data; + if (strcmp(dict->key,"Gnome")==0) main_config.WindowTheme=1; + else main_config.WindowTheme=0; + for (dictionary *ICSys=widgets->ICSys->first;ICSys!=NULL;ICSys=ICSys->next){ gtk_container_remove(GTK_CONTAINER(widgets->icvpack),((IVGraphicals*)ICSys->data)->Box); } @@ -526,7 +533,10 @@ void on_sections_save(GtkWidget *button, dictionary *widgetsD){ } yon_show_icon_views(widgets->ICSys,widgets); hide_if_unfound(widgetsD); + if (main_config.WindowTheme==1) + yon_icv_resize_item(dict,widgets->GnomePaned); } + main_config.WindowTheme=temptheme; } void on_section_delete(GtkWidget *button, actionWidgets *widgets){ @@ -553,6 +563,8 @@ void on_resized (GtkWidget *window, GdkEventConfigure *event, dictionary *widget } else main_config.fullscreen=1; + gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->Revealer),!gtk_revealer_get_child_revealed(GTK_REVEALER(widgets->Revealer))); + gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->Revealer),gtk_revealer_get_child_revealed(GTK_REVEALER(widgets->Revealer))); // if (main_config.WindowTheme==1){ // if (main_config.windowWidth<1240){ // if (stld==0){ @@ -595,13 +607,16 @@ void on_theme_selection_changed(GtkWidget *self, actionWidgets *widgets){ if (curthm==0){ main_config.currentThemeIconSize=&main_config.Mainiconsize; main_config.currentThemeLabelSize=&main_config.MainlabelSize; + main_config.currentDoubleClick=&main_config.MainDoubleClick; icsize=main_config.currentThemeIconSize; } else if (curthm==1){ main_config.currentThemeIconSize=&main_config.Gnomeiconsize; main_config.currentThemeLabelSize=&main_config.GnomelabelSize; + main_config.currentDoubleClick=&main_config.GnomeDoubleClick; icsize=main_config.currentThemeIconSize; } + gtk_switch_set_state(GTK_SWITCH(widgets->settingsDoubleClickSwitch),*main_config.currentDoubleClick); GtkIconTheme *icthm=gtk_icon_theme_get_default(); if (*icsize==24 || *icsize==1){ gtk_label_set_text(GTK_LABEL(widgets->settingsSizeInfoLabel),"24x24"); @@ -640,6 +655,11 @@ void on_reveal_banner(GtkWidget *button, actionWidgets *widgets){ } } +void on_double_click_changed(GtkWidget *Switch, gboolean state, dictionary *widgetsD){ + *main_config.currentDoubleClick=state; + update_double_clicks(widgetsD); +} + void on_about(GtkWidget *button){ GtkBuilder *builder = gtk_builder_new_from_file(GladePath); GtkWidget *AboutButtons = GTK_WIDGET(gtk_builder_get_object(builder,"AboutButtons")); @@ -703,6 +723,19 @@ int reload_list(IVGraphicals *section){ gtk_icon_view_set_model(GTK_ICON_VIEW(section->IV),GTK_TREE_MODEL(section->LV)); } +void update_double_clicks(dictionary *widgetsD){ + for (dictionary *dict=widgetsD->first;dict!=NULL;dict=dict->next){ + actionWidgets *widgets=(actionWidgets*)dict->data; + for (dictionary *ivdct=widgets->ICSys->first;ivdct!=NULL;ivdct=ivdct->next){ + IVGraphicals *IV=(IVGraphicals*)ivdct->data; + if (strcmp(dict->key,"Gnome")==0) + gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(IV->IV),!main_config.GnomeDoubleClick); + else + gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(IV->IV),!main_config.MainDoubleClick); + } + } +} + int load_apps(IVGraphicals *section, apps *applist, int size){ int catstofind=sizeof(section->categories)/sizeof(char*); int i=0,sz=0; @@ -901,6 +934,8 @@ int setup_config(){ } char *foroutput=NULL; char *line=NULL; + main_config.GnomeDoubleClick=g_key_file_get_boolean(configfile,"window", "GnomeDoubleClick",NULL); + main_config.MainDoubleClick=g_key_file_get_boolean(configfile,"window", "MainDoubleClick",NULL); 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); @@ -923,9 +958,11 @@ int setup_config(){ if (main_config.WindowTheme==0){ main_config.currentThemeLabelSize=&main_config.MainlabelSize; main_config.currentThemeIconSize=&main_config.Mainiconsize; + main_config.currentDoubleClick=&main_config.MainDoubleClick; } else if (main_config.WindowTheme==1){ main_config.currentThemeLabelSize=&main_config.GnomelabelSize; main_config.currentThemeIconSize=&main_config.Gnomeiconsize; + main_config.currentDoubleClick=&main_config.GnomeDoubleClick; } yon_icon_size_convert(0); @@ -1073,11 +1110,12 @@ IVGraphicals *yon_create_single_section_IV(char *name,char *cats){ 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_activate_on_single_click(GTK_ICON_VIEW(iv),!main_config.GnomeDoubleClick); gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); } else { gtk_icon_view_set_item_padding(GTK_ICON_VIEW(iv),3); gtk_icon_view_set_item_orientation(GTK_ICON_VIEW(iv),GTK_ORIENTATION_HORIZONTAL); + gtk_icon_view_set_activate_on_single_click(GTK_ICON_VIEW(iv),!main_config.MainDoubleClick); gtk_icon_view_set_row_spacing(GTK_ICON_VIEW(iv),2); } GtkWidget *sep=gtk_separator_new(GTK_ORIENTATION_HORIZONTAL); @@ -1572,6 +1610,10 @@ void yon_main_quit(actionWidgets *widgets){ gtk_main_quit(); } +void confugure_setings_window(actionWidgets *widgets){ + +} + dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *theme_id, apps *applist, int appsize){ dictionary *widgets=*widgetss; @@ -1626,7 +1668,6 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them curWidgets->LabelTitle=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"LabelTitle")); gtk_window_set_title(GTK_WINDOW(curWidgets->window),_("UBLinux Settings Manager")); gtk_window_move(GTK_WINDOW(curWidgets->window),main_config.windowPosX,main_config.windowPosY); - gtk_render_background(gtk_widget_get_style_context(curWidgets->workingwindow),gdk_pixbuf_new_from_file(ublinux_logo,NULL),0,0,100,100); // Standard for all themes curWidgets->settingsThemeChooser=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsThemeChooser")); @@ -1658,6 +1699,8 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them curWidgets->infoWarningWindow=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"windowSettings-infoWarning")); curWidgets->infoWarningButton=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"buttonSettings-infoWarning")); curWidgets->infoWarningLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"labelSettings-infoWarning")); + curWidgets->settingsDoubleClickSwitch=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsDoubleClickSwitch")); + curWidgets->settingsDoubleClickLabel=GTK_WIDGET(gtk_builder_get_object(curWidgets->builder,"settingsDoubleClickLabel")); curWidgets->applist=applist; curWidgets->appssize=appsize; GtkIconTheme *icthm=gtk_icon_theme_get_default(); @@ -1683,6 +1726,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them g_signal_connect(G_OBJECT(curWidgets->SectionSettingsSaveButton), "clicked", G_CALLBACK(on_sections_save), widgets); g_signal_connect(G_OBJECT(curWidgets->CautionUnderstandButton), "clicked", G_CALLBACK(on_caution_understand), curWidgets); g_signal_connect(G_OBJECT(curWidgets->settingsSectionsSettingsButton), "clicked", G_CALLBACK(on_section_settings_open), widgets); + g_signal_connect(G_OBJECT(curWidgets->settingsDoubleClickSwitch), "state-set", G_CALLBACK(on_double_click_changed), widgets); } gtk_widget_hide_on_delete(curWidgets->window); g_signal_connect(G_OBJECT(curWidgets->window), "destroy", G_CALLBACK(yon_main_quit), curWidgets); @@ -1701,6 +1745,7 @@ dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *them gtk_menu_item_set_label(GTK_MENU_ITEM(curWidgets->MenuItemDocumentation),_("About...")); gtk_button_set_label(GTK_BUTTON(curWidgets->CautionUnderstandButton),_("Understood")); gtk_button_set_label(GTK_BUTTON(curWidgets->settingsSectionsSettingsButton),_("Sections management")); + gtk_label_set_text(GTK_LABEL(curWidgets->settingsDoubleClickLabel),_("Double click selection")); return widgets; } diff --git a/source/ubl-settings-manager.h b/source/ubl-settings-manager.h index e85a312..bf11b95 100644 --- a/source/ubl-settings-manager.h +++ b/source/ubl-settings-manager.h @@ -11,7 +11,7 @@ #define CssPath "/usr/share/ubl-settings-manager/css/ubl-settings-manager.css" #define GlobalConfigPath "/etc/xdg/ubl-settings-manager/ubl-settings-manager.conf" #define UserConfigPath "/.config/ubl-settings-manager/ubl-settings-manager.conf" -#define AppIconPath "com.ublinux.ubl-settings-manager" +#define AppIconPath "ru.ublinux.ubl-settings-manager" #define AppBannerPath "/usr/share/ubl-settings-manager/images/ubl-settings-manager-banner.png" #define DesktopPath "/usr/share/applications/" #define IconPicturesPath "/usr/share/icons/hicolor/scalable/apps/" @@ -83,6 +83,9 @@ typedef struct { int changed; int fullscreen; int lock_settings; + int GnomeDoubleClick; + int MainDoubleClick; + int *currentDoubleClick; dictionary *SettingsSections; } config; @@ -167,6 +170,8 @@ typedef struct { GtkWidget *infoWarningLabel; GtkWidget *BannerRevealer; GtkWidget *Revealer; + GtkWidget *settingsDoubleClickSwitch; + GtkWidget *settingsDoubleClickLabel; } actionWidgets; @@ -205,6 +210,7 @@ void sort_apps(apps *applist,int size); apps *find_apps(int *sizef); int check_categories(apps app, char *catstocheck); int setup_config(); +void update_double_clicks(dictionary *widgetsD); void yon_icv_resize_item(dictionary *icdict, GtkWidget *paned); dictionary *yon_theme_new(dictionary **widgetss, GtkBuilder *builder, char *theme_id, apps *applist, int appsize); char *yon_char_get_augumented(char *source, char *append); diff --git a/ubl-settings-manager.glade b/ubl-settings-manager.glade index 6178ab4..20051d7 100644 --- a/ubl-settings-manager.glade +++ b/ubl-settings-manager.glade @@ -364,22 +364,9 @@ - + True - False - 0.20000000298023224 - 0 - in - 0 - False - - - True - False - 98 - action-unavailable-symbolic.symbolic - - + True @@ -393,6 +380,7 @@ False 440 250 + ru.ublinux.ubl-settings-manager True @@ -468,6 +456,7 @@ 64 True False + 32 ru.ublinux.ubl-settings-manager @@ -553,9 +542,52 @@ 1 + + + True + False + 3 + 3 + + + True + False + center + 12 + 12 + Double click selection + 0.019999999552965164 + + + True + True + 0 + + + + + True + True + 10 + 10 + + + False + True + end + 1 + + + + + False + True + 2 + + - button + Section management True True True @@ -567,64 +599,76 @@ False True - 2 + 3 True False + vertical True False - 5 - 5 - 3 - 30 - True - - Close - 200 + True - True - True - 2 + False + 5 + 5 + 3 + 30 + True + + + Close + 200 + True + True + True + 2 + + + False + True + 0 + + + + + Apply + 200 + True + True + True + 2 + + + False + True + 1 + + - False + True True 0 - - - Save and apply - 200 - True - True - True - 2 - - - False - True - 1 - - - True + False True - 0 + 1 False True - 4 + 5 @@ -683,7 +727,6 @@ False start slide-left - True True @@ -1297,7 +1340,6 @@ False start slide-left - True True @@ -1658,6 +1700,7 @@ natural horizontal liststoreTemplate + 135 0 2 5 @@ -1678,7 +1721,7 @@ 0 word - 150 + 130 3