diff --git a/gresource.xml b/gresource.xml index a0718a8..db00251 100644 --- a/gresource.xml +++ b/gresource.xml @@ -2,6 +2,7 @@ libublsettingsui-gtk3.glade + libublsettingsui-gtk3-window.glade libublsettingsui-gtk3-about.glade libublsettingsui-gtk3-documentation.glade libublsettingsui-gtk3-saving.glade diff --git a/libublsettingsui-gtk3-window.glade b/libublsettingsui-gtk3-window.glade new file mode 100644 index 0000000..8e24bc6 --- /dev/null +++ b/libublsettingsui-gtk3-window.glade @@ -0,0 +1,81 @@ + + + + + + 450 + 350 + False + com.ublinux.libublsettingsui-gtk3 + dialog + + + True + False + vertical + + + True + False + vertical + + + + + + False + True + 0 + + + + + True + False + 5 + 5 + 5 + vertical + + + + + + True + True + 1 + + + + + + + True + False + 5 + True + + + True + False + TEMPLATE Manager + + + + + + + + True + False + 32 + com.ublinux.libublsettingsui-gtk3 + + + + + + + diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 8578725..190acd1 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -38,6 +38,7 @@ add_custom_target(GLADE libublsettingsui-gtk3.glade) set(DEPENDFILES ../libublsettingsui-gtk3.glade + ../libublsettingsui-gtk3-window.glade ../libublsettingsui-gtk3-about.glade ../libublsettingsui-gtk3-documentation.glade ../libublsettingsui-gtk3-saving.glade @@ -83,6 +84,7 @@ add_library(${PROJECT_NAME} SHARED libublsettingsui-gtk3-save.c libublsettingsui-gtk3-config-window.c libublsettingsui-gtk3-filechooser.c + libublsettingsui-gtk3-config-chooser.c libublsettingsui-gtk3-service.c libublsettingsui-gtk3-app-chooser.c libublsettingsui-gtk3-standard-callbacks.c diff --git a/source/libublsettingsui-gtk3-config-chooser.c b/source/libublsettingsui-gtk3-config-chooser.c index ab670f0..6b97dbe 100644 --- a/source/libublsettingsui-gtk3-config-chooser.c +++ b/source/libublsettingsui-gtk3-config-chooser.c @@ -32,7 +32,7 @@ void on_config_file_chooser_accept(GtkWidget *, config_file_chooser_window *wind const char *filter_name = gtk_file_filter_get_name(gtk_file_chooser_get_filter(GTK_FILE_CHOOSER(window->file_chooser_window->MainFileChooser))); if (window->file_chooser_window->last_success_selection){ int ext_pos = yon_char_find_last(window->file_chooser_window->last_success_selection,'.'); - if (ext_pos==-1||strcmp(window->file_chooser_window->last_success_selection+ext_pos+1,filter_name)){ + if (ext_pos==-1||strcmp(window->file_chooser_window->last_success_selection+ext_pos,filter_name)){ path = yon_char_unite(window->file_chooser_window->last_success_selection,filter_name,NULL); free(window->file_chooser_window->last_success_selection); window->file_chooser_window->last_success_selection = path; @@ -44,9 +44,9 @@ void on_config_file_chooser_accept(GtkWidget *, config_file_chooser_window *wind gtk_main_quit(); } -filechooser_window *yon_config_file_chooser_window_new(){ +filechooser_window *yon_config_file_chooser_window_new(GtkFileChooserAction action){ config_file_chooser_window *window = malloc(sizeof(config_file_chooser_window)); - window->file_chooser_window = yon_file_chooser_window_new(GTK_FILE_CHOOSER_ACTION_SAVE); + window->file_chooser_window = yon_file_chooser_window_new(action); window->ini_filter = gtk_file_filter_new(); gtk_file_filter_add_pattern(window->ini_filter,"*.ini"); gtk_file_filter_set_name(window->ini_filter,".ini"); diff --git a/source/libublsettingsui-gtk3.c b/source/libublsettingsui-gtk3.c index 12548e6..55285b9 100644 --- a/source/libublsettingsui-gtk3.c +++ b/source/libublsettingsui-gtk3.c @@ -713,4 +713,16 @@ void yon_entry_set_entry_type(GtkEntry *target,GtkBox *status){ break; default: break; } +} + +yon_window *yon_window_new(){ + yon_window *window = new(yon_window); + memset(window,0,sizeof(yon_window)); + GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_window); + + window->Window = yon_gtk_builder_get_widget(builder,"Window"); + window->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); + window->MainBox = yon_gtk_builder_get_widget(builder,"MainBox"); + + return window; } \ No newline at end of file diff --git a/source/libublsettingsui-gtk3.h b/source/libublsettingsui-gtk3.h index 2d1cd3d..c243acf 100644 --- a/source/libublsettingsui-gtk3.h +++ b/source/libublsettingsui-gtk3.h @@ -24,6 +24,9 @@ /**Путь до файла основного окна утилит ubl-settings-**/ #define ui_glade_path "/com/ublinux/ui/libublsettingsui-gtk3.glade" +#define ui_glade_path_window "/com/ublinux/ui/libublsettingsui-gtk3-window.glade" + + /**Путь до файла подтверждения открытия документации утилит ubl-settings-**/ #define ui_glade_path_documentation "/com/ublinux/ui/libublsettingsui-gtk3-documentation.glade" @@ -272,7 +275,7 @@ void yon_file_chooser_remove_root(filechooser_window *window); /// @brief Create file chooser window, configured to select supported configuration files. /// @return A newly allocated file chooser window; -filechooser_window *yon_config_file_chooser_window_new(); +filechooser_window *yon_config_file_chooser_window_new(GtkFileChooserAction action); void yon_file_chooser_remove_accept_function(filechooser_window *window); @@ -559,6 +562,16 @@ void yon_password_hash_list_set(yon_password_window *window, config_str hashes, yon_password_window *yon_password_open(GtkEntry *target); +typedef struct { + GtkWidget *Window; + GtkWidget *StatusBox; + GtkWidget *MainBox; +} yon_window; + +/// @brief Create empty window +/// @return A newly allocated empty window; +yon_window *yon_window_new(); + #define VERSION_LABEL yon_char_unite(_("Version:")," ",!yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",NULL) #define HELP_LABEL(rest) yon_char_unite(template_app_information.app_tech_name,_(" version:")," ", !yon_char_is_empty(template_app_information.app_version)?template_app_information.app_version:"","\n",\ template_app_information.app_title,"\n",_("Usage:"), " ",template_app_information.app_tech_name," ",_("[OPTIONS]"),"\n",\