Merge pull request 'master' (#7) from YanTheKaller/libublsettingsui-gtk3:master into master

Reviewed-on: #7
pull/21/head v1.5
Dmitry Razumov 2 years ago
commit 2c318fe43c

@ -119,6 +119,10 @@ install: check
rsvg-convert -w $${SIZE} -h $${SIZE} -f svg --keep-image-data "com.ublinux.${PKGNAME}.svg" -o "${DESTDIR}${PREFIX}/share/icons/hicolor/$${SIZE}x$${SIZE}/apps/com.ublinux.${PKGNAME}.svg"; \
done
@install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/apps/" "com.ublinux.${PKGNAME}.svg"
@install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/actions/" "com.ublinux.${PKGNAME}.accept-symbolic.svg"
@install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/actions/" "com.ublinux.${PKGNAME}.cancel-symbolic.svg"
@install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.checked.svg"
@install -Dm644 -t "${DESTDIR}/usr/share/icons/hicolor/scalable/status/" "com.ublinux.${PKGNAME}.warning.svg"
@if [ -z ${DESTDIR} ]; then \
[ -d "${DESTDIR}/usr/share/icons/hicolor/" ] && gtk-update-icon-cache -fiq "${DESTDIR}${PREFIX}/share/icons/hicolor/" &>/dev/null || true; \
update-desktop-database --quiet &>/dev/null || true; \

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg height="16px" viewBox="0 0 16 16" width="16px" xmlns="http://www.w3.org/2000/svg">
<path d="m 15 3.484375 l -1 -1 l -7.46875 7.515625 l -3.414062 -3.476562 l -2 2 l 5.414062 5.476562 l 9.46875 -9.515625 z m 0 0" fill="#2e3436"/>
</svg>

After

Width:  |  Height:  |  Size: 284 B

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="3.175mm"
height="3.175mm"
viewBox="0 0 3.175 3.175"
version="1.1"
id="svg36"
inkscape:version="1.1.2 (0a00cf5339, 2022-02-04, custom)"
sodipodi:docname="com.ublinux.ubl-settings-usergroups.cancel-symbolic.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview38"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="29.309298"
inkscape:cx="17.74181"
inkscape:cy="7.3867343"
inkscape:window-width="1920"
inkscape:window-height="1056"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
<defs
id="defs33" />
<g
inkscape:label="Слой 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-75.62433,-104.22131)">
<path
style="fill:#d40000;fill-opacity:1;stroke:none;stroke-width:0.264583"
d="m 77.21183,104.22131 c -0.8763,0 -1.5875,0.7112 -1.5875,1.5875 0,0.8763 0.7112,1.5875 1.5875,1.5875 0.8763,0 1.5875,-0.7112 1.5875,-1.5875 0,-0.8763 -0.7112,-1.5875 -1.5875,-1.5875 z m 0,0.56696 c 0.563335,0 1.020535,0.4572 1.020535,1.02054 0,0.15224 -0.03405,0.2963 -0.0939,0.42611 l -1.353627,-1.35275 c 0.129997,-0.0601 0.274468,-0.0939 0.426995,-0.0939 z m -0.91423,0.56874 1.366915,1.36603 c -0.136513,0.0678 -0.290022,0.1063 -0.452685,0.1063 -0.563336,0 -1.020536,-0.4572 -1.020536,-1.02053 0,-0.16238 0.03874,-0.31547 0.106306,-0.4518 z"
id="Symbol"
inkscape:label="#path2424"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -2,6 +2,16 @@
<!-- Generated with glade 3.38.2 -->
<interface domain="libublsettingsui-gtk3">
<requires lib="gtk+" version="3.24"/>
<object class="GtkImage" id="image8">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">process-stop-symbolic</property>
</object>
<object class="GtkImage" id="image9">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">emblem-ok-symbolic</property>
</object>
<object class="GtkApplicationWindow" id="helpConfirmationWindow">
<property name="can-focus">False</property>
<property name="resizable">False</property>
@ -128,60 +138,12 @@ translated and supported by community.</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="spacing">30</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkButton" id="CancelHelpButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image8</property>
<style>
<class name="button"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="ReadHelpButton">
<property name="label" translatable="yes">Open documentation</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image9</property>
<style>
<class name="button"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar" id="SettingsBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-close-button">True</property>
<child type="title">
<object class="GtkLabel" id="webHeaderNameLabel">
<property name="visible">True</property>
@ -192,17 +154,37 @@ translated and supported by community.</property>
</attributes>
</object>
</child>
<child>
<object class="GtkButton" id="CancelHelpButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image8</property>
<style>
<class name="button"/>
<class name="marginright"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="ReadHelpButton">
<property name="label" translatable="yes">Open documentation</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image9</property>
<style>
<class name="button"/>
<class name="marginright"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkImage" id="image8">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">process-stop-symbolic</property>
</object>
<object class="GtkImage" id="image9">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">emblem-ok-symbolic</property>
</object>
</interface>

@ -13,12 +13,18 @@
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">process-stop-symbolic</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.cancel-symbolic</property>
<style>
<class name="marginright"/>
</style>
</object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">emblem-ok-symbolic</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.accept-symbolic</property>
<style>
<class name="marginright"/>
</style>
</object>
<object class="GtkListStore" id="liststore1">
<columns>
@ -47,6 +53,7 @@
<property name="type-hint">dialog</property>
<child internal-child="vbox">
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-bottom">5</property>
<property name="orientation">vertical</property>
@ -56,32 +63,10 @@
<property name="can-focus">False</property>
<property name="layout-style">end</property>
<child>
<object class="GtkButton" id="CancelButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image1</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
<placeholder/>
</child>
<child>
<object class="GtkButton" id="SaveButton">
<property name="label" translatable="yes">Save</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image2</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
<placeholder/>
</child>
</object>
<packing>
@ -154,9 +139,7 @@
<property name="sizing">fixed</property>
<property name="title" translatable="yes">Old value</property>
<child>
<object class="GtkCellRendererText">
<property name="wrap-width">250</property>
</object>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="cell-background">4</attribute>
<attribute name="sensitive">5</attribute>
@ -170,9 +153,7 @@
<property name="sizing">autosize</property>
<property name="title" translatable="yes">New value</property>
<child>
<object class="GtkCellRendererText">
<property name="wrap-width">250</property>
</object>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="cell-background">4</attribute>
<attribute name="sensitive">5</attribute>
@ -196,7 +177,6 @@
<object class="GtkHeaderBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="show-close-button">True</property>
<child type="title">
<object class="GtkLabel" id="HeaderTopic">
<property name="visible">True</property>
@ -215,10 +195,44 @@
<property name="icon-name">com.ublinux.libublsettingsui-gtk3</property>
</object>
</child>
<child>
<object class="GtkButton" id="CancelButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image1</property>
<style>
<class name="marginright"/>
</style>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="SaveButton">
<property name="label" translatable="yes">Save</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="image">image2</property>
<style>
<class name="marginright"/>
</style>
</object>
<packing>
<property name="pack-type">end</property>
<property name="position">2</property>
</packing>
</child>
<style>
<class name="toolbar"/>
</style>
</object>
</child>
</object>
<object class="GtkTreeModelFilter" id="listfilter1">
<property name="child-model">liststore1</property>
</object>
</interface>

@ -111,4 +111,23 @@ background:transparent;
.boxInfoMessOK{
background-color: #f3f0ac;
}
.instant {
transition: 0ms;
}
.errorBox {
border-width: 2px;
border-color: #ea9999;
border-style:solid;
}
.chosenOutline{
transition: 0ms;
border-width: 2px;
border-color: #f3f0ac;
border-style:solid;
}
.marginright image{
margin-right: 2px;
}

@ -159,6 +159,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
<property name="can-focus">False</property>
<property name="take-focus">False</property>
<property name="reserve-toggle-size">False</property>
<style>
<class name="thin"/>
</style>
</object>
<object class="GtkMenu" id="menu3">
<property name="visible">True</property>

@ -64,6 +64,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic -Wall -Wextra -Werror -Wmissin
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
-fstack-clash-protection -fcf-protection")
add_library(${PROJECT_NAME} SHARED
libublsettingsui-gtk3.c
libublsettingsui-gtk3.h

@ -70,12 +70,36 @@ void on_about(GtkWidget *self, char *version_application){
//functions
void on_save_window_parameter_switched(GtkCellRendererToggle *self, gchar *path, template_saving_window *window){
GtkTreeIter iter;
if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->list),&iter,path)){
gboolean is_active;
GtkTreeIter iter,itar;
if (path){
if (gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(window->filteredModel),&itar,path)){
char *seek_name;
gtk_tree_model_get(window->filteredModel,&itar,1,&seek_name,-1);
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
char *name;
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,1,&name,-1);
if (!strcmp(seek_name,name)){
gboolean is_active;
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&is_active,-1);
gtk_list_store_set(window->list,&iter,0,!is_active,-1);
}
}
}
}
int once_active=0;
int valid = gtk_tree_model_get_iter_first(GTK_TREE_MODEL(window->list),&iter);
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
int is_active;
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,0,&is_active,-1);
gtk_list_store_set(window->list,&iter,0,!is_active,-1);
if (is_active){
once_active=1;
break;
}
}
if (!once_active) gtk_widget_set_sensitive(window->SaveButton,0);
else gtk_widget_set_sensitive(window->SaveButton,1);
gtk_tree_model_filter_refilter(GTK_TREE_MODEL_FILTER(window->filteredModel));
}
@ -123,13 +147,30 @@ void on_save_parameters(GtkWidget *self, template_saving_window *window){
free(final_command);
}
}
textdomain(template_ui_LocaleName);
if (window->type == YON_CONFIG_GLOBAL)
yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
else if (window->type == YON_CONFIG_LOCAL)
yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
else if (window->type == YON_CONFIG_BOTH)
yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
textdomain(template_app_information.app_locale);
yon_window_config_custom_window_set(GTK_WINDOW(window->Window),"SaveWindow");
on_subwindow_close(self);
}
template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
if (((type==YON_CONFIG_LOCAL&& template_config->load_mode==1)||(type==YON_CONFIG_GLOBAL&& template_config->load_mode==0))){
yon_config_save_registered(path);
return NULL;
textdomain(template_ui_LocaleName);
if (type == YON_CONFIG_GLOBAL)
yon_ubl_status_box_render(GLOBAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
else if (type == YON_CONFIG_LOCAL)
yon_ubl_status_box_render(LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
else if (type == YON_CONFIG_BOTH)
yon_ubl_status_box_render(GLOBAL_LOCAL_SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
textdomain(template_app_information.app_locale);
} else {
char *config_to_save = NULL;
if (type==YON_CONFIG_GLOBAL) config_to_save="global";
@ -137,10 +178,8 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
else if (type==YON_CONFIG_BOTH) {
if (template_config->load_mode==1){
config_to_save="global";
yon_config_save_registered("system");
} else if (template_config->load_mode==0){
config_to_save="system";
yon_config_save_registered("global");
}
}
yon_config_set_status(0);
@ -162,27 +201,6 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
struct loaded_config loaded;
loaded.dict = yon_dictionary_new();
dictionary *dct;
for_dictionaries(dct,section_commands){
char *command = yon_char_unite(ubconfig_load_command," default get ", dct->key," ", yon_dictionary_get_data(dct,char*),NULL);
FILE *output = popen(command, "r");
char **output_strings = NULL;
output_strings = malloc(sizeof(char*));
int i = 0;
char str[4096];
memset(str, 0, 4096);
while (fgets(str, 4096, output))
{
if (!yon_char_is_empty(str)&& strcmp(str,"(null)\n")!=0)
{
char *final_str = yon_char_new(str);
char *key =yon_char_divide_search(final_str,"=",-1);
if (final_str[strlen(final_str)-1]=='\n')final_str[strlen(final_str)-1]='\0';
yon_dictionary_add_or_create_if_exists_with_data(loaded.dict,NULL,yon_char_new(dct->key));
yon_dictionary_add_or_create_if_exists_with_data(loaded.dict,key,yon_char_new(final_str));
yon_char_parsed_add_or_create_if_exists(config_compare,&compare_size,yon_char_new(str));
}
}
}
for_dictionaries(dct,section_commands){
char *command = yon_char_unite(ubconfig_load_command," ", config_to_save," get ", dct->key," ", yon_dictionary_get_data(dct,char*),NULL);
FILE *output = popen(command, "r");
@ -226,17 +244,19 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
window->ToggleCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"ToggleCell"));
window->list = GTK_LIST_STORE(gtk_builder_get_object(builder,"liststore1"));
window->type=type;
window->filteredModel = GTK_TREE_MODEL(gtk_builder_get_object(builder,"listfilter1"));
gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(window->filteredModel),5);
yon_window_config_custom_window_setup(GTK_WINDOW(window->Window),"SaveWindow");
gtk_window_set_icon_name(GTK_WINDOW(window->Window),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
gtk_window_set_title(GTK_WINDOW(window->Window),template_app_information.app_title);
gtk_label_set_text(GTK_LABEL(window->HeaderTopic),template_app_information.app_title);
gtk_image_set_from_pixbuf(GTK_IMAGE(window->HeaderImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_char_append("com.ublinux.",template_app_information.app_tech_name),32,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(window->ParametersTree));
// yon_gtk_tree_view_minimal_fixed_size_set_full(GTK_TREE_VIEW(window->ParametersTree));
g_signal_connect(G_OBJECT(window->CancelButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
g_signal_connect(G_OBJECT(window->SaveButton),"clicked", G_CALLBACK(on_save_parameters),window);
g_signal_connect(G_OBJECT(window->ToggleCell),"toggled", G_CALLBACK(on_save_window_parameter_switched),window);
int config_size=0;
config_str config_strings = yon_config_get_all_no_ignored(&config_size);
config_str config_strings = yon_config_get_all(&config_size);
if (config_strings){
GtkTreeIter iter;
gtk_tree_view_set_model(GTK_TREE_VIEW(window->ParametersTree),NULL);
@ -245,7 +265,7 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
int compare_keys_size=compare_size;
yon_char_parsed_divide_search_full(compare_keys,compare_keys_size,"=",-1);
int config_keys_size=0;
config_str config_keys = yon_config_get_all_keys_no_ignored(&config_keys_size);
config_str config_keys = yon_config_get_all_keys(&config_keys_size);
int final_size=0;
GdkRGBA rgba;
rgba.alpha=0.8;
@ -254,21 +274,24 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
rgba.green=0.65;
char *rgba_string = gdk_rgba_to_string(&rgba);
for (int i=0;i<compare_keys_size;i++){
if (!yon_config_check_ignore(compare_keys[i])){
gtk_list_store_append(window->list,&iter);
gtk_list_store_set(window->list,&iter,0,0,1,compare_keys[i],5,1,-1);
for (int j=0;j<compare_size;j++){
if(config_compare[j][strlen(config_compare[j])-1]=='\n') config_compare[j][strlen(config_compare[j])-1]='\0';
char *compare_value = yon_char_new(config_compare[j]);
char *compare_name = yon_char_divide_search(compare_value,"=",-1);
if (!strcmp(compare_name,compare_keys[i])){ //&&strcmp((char*)yon_dictionary_get(&loaded.dict,compare_name)->data,compare_value)
char *cur_section = (char*)yon_dictionary_get(&loaded.dict->first,compare_keys[i])->prev->data;
gtk_list_store_set(window->list,&iter,2,compare_value,4,rgba_string,6,cur_section,-1);
for (int j=0;j<compare_size;j++){
if(config_compare[j][strlen(config_compare[j])-1]=='\n') config_compare[j][strlen(config_compare[j])-1]='\0';
char *compare_value = yon_char_new(config_compare[j]);
char *compare_name = yon_char_divide_search(compare_value,"=",-1);
if (!strcmp(compare_name,compare_keys[i])){
char *cur_section = (char*)yon_dictionary_get(&loaded.dict->first,compare_keys[i])->prev->data;
gtk_list_store_set(window->list,&iter,2,compare_value,4,rgba_string,6,cur_section,-1);
}
free(compare_value);
free(compare_name);
}
free(compare_value);
free(compare_name);
if (yon_config_check_ignore(compare_keys[i])){
gtk_list_store_set(window->list,&iter,0,0,1,compare_keys[i],4,NULL,5,0,-1);
}
}
}
char *name,*value;
for (int i=0;i<config_keys_size;i++){
@ -280,9 +303,15 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
for (;valid;valid=gtk_tree_model_iter_next(GTK_TREE_MODEL(window->list),&iter)){
gtk_tree_model_get(GTK_TREE_MODEL(window->list),&iter,1,&name,2,&value,-1);
if (!yon_char_is_empty(name)&&!strcmp(name,config_keys[i])){
gtk_list_store_set(window->list,&iter,3,compare_value,4,NULL,6,section,-1);
if (value&&!strcmp(value,compare_value)){
gtk_list_store_set(window->list,&iter,0,0,5,0,-1);
if (!yon_config_check_ignore(name)){
gtk_list_store_set(window->list,&iter,3,compare_value,4,NULL,6,section,-1);
if ((value&&!strcmp(value,compare_value))||yon_char_is_empty(compare_value)){
gtk_list_store_set(window->list,&iter,0,0,3,value,5,0,-1);
} else {
gtk_list_store_set(window->list,&iter,5,1,-1);
}
} else {
printf ("%s ignored\n",name);
}
found=1;
break;
@ -298,16 +327,62 @@ template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...){
}
free(rgba_string);
gtk_tree_view_set_model(GTK_TREE_VIEW(window->ParametersTree),GTK_TREE_MODEL(window->list));
gtk_tree_view_set_model(GTK_TREE_VIEW(window->ParametersTree),window->filteredModel);
}
gtk_widget_show(window->Window);
on_save_window_parameter_switched(NULL,NULL,window);
return window;
}
}
int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data){
GtkWidget *dialog = gtk_dialog_new_with_buttons(template_app_information.app_title,GTK_WINDOW(gtk_widget_get_toplevel(self)),GTK_DIALOG_USE_HEADER_BAR,CANCEL_LABEL,GTK_RESPONSE_CANCEL,ACCEPT_LABEL,GTK_RESPONSE_ACCEPT,NULL);
gtk_window_set_modal(GTK_WINDOW(dialog),1);
gtk_window_set_icon_name(GTK_WINDOW(dialog),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
gtk_window_set_title(GTK_WINDOW(dialog),template_app_information.app_title);
gtk_widget_set_size_request(dialog,450,-1);
GList *list = gtk_container_get_children(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))));
gtk_widget_set_margin_bottom((GtkWidget*)g_list_nth_data(list,g_list_length(list)-1),5);
gtk_widget_set_margin_end((GtkWidget*)g_list_nth_data(list,g_list_length(list)-1),5);
g_list_free(list);
GtkWidget *header_label = gtk_label_new(template_app_information.app_title);
gtk_widget_show(header_label);
PangoAttrList *attributes = pango_attr_list_new();
PangoAttribute *boldAttr = pango_attr_weight_new(PANGO_WEIGHT_BOLD);
pango_attr_list_insert(attributes, boldAttr);
gtk_label_set_attributes(GTK_LABEL(header_label),attributes);
GtkWidget *header = gtk_dialog_get_header_bar(GTK_DIALOG(dialog));
gtk_header_bar_set_custom_title(GTK_HEADER_BAR(header),header_label);
gtk_widget_show(header);
GtkWidget *image = gtk_image_new_from_icon_name("dialog-question-symbolic",GTK_ICON_SIZE_DIALOG);
gtk_widget_show(image);
gtk_widget_set_margin_start(image,20);
gtk_widget_set_margin_end(image,20);
gtk_widget_set_margin_bottom(image,20);
gtk_widget_set_margin_top(image,20);
GtkWidget *label = gtk_label_new(data->action_text);
gtk_widget_show(label);
GtkWidget *box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5);
gtk_widget_show(box);
gtk_box_pack_start(GTK_BOX(box),image,0,0,5);
gtk_box_pack_start(GTK_BOX(box),label,0,0,5);
gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box,1,1,5);
int resp = gtk_dialog_run(GTK_DIALOG(dialog));
if (resp == GTK_RESPONSE_ACCEPT&&data->function){
data->function(NULL,data->data);
}
gtk_widget_destroy(dialog);
return resp;
}
// standard functions
int yon_ubl_connect_config(_template_config *config){
@ -355,7 +430,6 @@ template_main_window *setup_window(){
widgets->AboutMenuItem = yon_ubl_menu_item_about_new(ABOUT_LABEL);
gtk_window_set_icon_name(GTK_WINDOW(widgets->Window),yon_char_append("com.ublinux.",template_app_information.app_tech_name));
// gtk_image_set_from_icon_name(widgets->HeadImage,)
gtk_image_set_from_pixbuf(GTK_IMAGE(HeadImage),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_char_append("com.ublinux.",template_app_information.app_tech_name),32,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
gtk_image_set_from_pixbuf(GTK_IMAGE(HatIcon),gtk_icon_theme_load_icon_for_scale(gtk_icon_theme_get_default(),yon_char_append("com.ublinux.",template_app_information.app_tech_name),64,1,GTK_ICON_LOOKUP_FORCE_SIZE,NULL));
gtk_window_set_title(GTK_WINDOW(widgets->Window),template_app_information.app_title);
@ -397,20 +471,21 @@ template_main_window *yon_ubl_window_setup(){
template_main_window *widgets = setup_window();
yon_ubl_header_setup_resource(widgets->HeadOverlay,widgets->HeadBox,widgets->HeadImage,ui_banner_path);
textdomain(template_ui_LocaleName);
if (yon_ubl_status_box_setup(widgets->StatusIcon,widgets->StatusBox,widgets->StatusLabel)){
if (getuid()!=0)
yon_ubl_status_box_render(ROOT_WARNING_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
else
yon_ubl_status_box_render(LOCAL_LOAD_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
textdomain(template_app_information.app_locale);
template_config->load_mode=1;
if(template_config)
yon_ubl_setup_sockets(widgets->PlugBox,widgets->LeftBox,widgets->RightBox,template_config->socket_id,template_config->load_socket_id,template_config->save_socket_id);
yon_window_config_setup(GTK_WINDOW(widgets->Window));
yon_window_config_load(ui_config_path);
GtkCssProvider *css=gtk_css_provider_new();
gtk_css_provider_load_from_resource(css,ui_CssPath);
gtk_css_provider_load_from_resource(css,template_app_information.css_path);
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(),
GTK_STYLE_PROVIDER(css),
-1);

@ -150,9 +150,18 @@ typedef struct {
GtkWidget *CancelButton;
GtkWidget *SaveButton;
GtkListStore *list;
GtkTreeModel *filteredModel;
YON_CONFIG_TYPE type;
} template_saving_window;
typedef struct {
void (*function)(void*,void*);
void *data;
char *action_text;
} dialog_confirmation_data;
int yon_confirmation_dialog_call(GtkWidget *self,dialog_confirmation_data *data);
template_saving_window *yon_save_proceed(char *path,YON_CONFIG_TYPE type, ...);
/**yon_open_browser(GtkWidget *self, char *link)

Loading…
Cancel
Save