From f9bfacdec1ad50c7fcde65f17f88a58ebc502d18 Mon Sep 17 00:00:00 2001 From: Ivan Yarcev Date: Fri, 5 Jul 2024 18:17:46 +0600 Subject: [PATCH] Added about and documentation windows --- gresource.xml | 2 + source/CMakeLists.txt | 2 + source/ubinstall-gtk.c | 61 ++++++++++ source/ubinstall-gtk.h | 10 +- source/ubl-strings.h | 12 +- ubinstall-gtk-about.glade | 64 ++++++++++ ubinstall-gtk-documentation.glade | 187 ++++++++++++++++++++++++++++++ ubinstall-gtk.css | 4 +- ubinstall-gtk.glade | 156 +++++++++++++++++++++---- ubinstall-gtk.pot | 25 +++- ubinstall-gtk_ru.po | 26 ++++- 11 files changed, 520 insertions(+), 29 deletions(-) create mode 100644 ubinstall-gtk-about.glade create mode 100644 ubinstall-gtk-documentation.glade diff --git a/gresource.xml b/gresource.xml index cfd08bd..359f308 100644 --- a/gresource.xml +++ b/gresource.xml @@ -4,6 +4,8 @@ ubinstall-gtk.glade ubinstall-gtk-language.glade ubinstall-gtk-keyboard.glade + ubinstall-gtk-about.glade + ubinstall-gtk-documentation.glade ubinstall-gtk.css diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 4773d88..96f05bf 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -60,6 +60,8 @@ set(DEPENDFILES ../ubinstall-gtk.glade ../ubinstall-gtk-language.glade ../ubinstall-gtk-keyboard.glade + ../ubinstall-gtk-about.glade + ../ubinstall-gtk-documentation.glade ../gresource.xml ../ubinstall-gtk.css ../modules.csv diff --git a/source/ubinstall-gtk.c b/source/ubinstall-gtk.c index be89091..dbfa964 100644 --- a/source/ubinstall-gtk.c +++ b/source/ubinstall-gtk.c @@ -10,6 +10,59 @@ config main_config; // } // } +void yon_open_browser(GtkWidget *, char *link); +void yon_open_browser(GtkWidget *, char *link){ + GtkWidget *window = yon_ubl_browser_window_open(link,TITLE_LABEL); + if (window) + gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); +} + +void on_open_documentation_confirmation(GtkWidget *self, char *link); +void on_open_documentation_confirmation(GtkWidget *self, char *link){ + if (main_config.always_open_documentation==0){ + GtkBuilder *builder = gtk_builder_new_from_resource(ui_glade_path_documentation); + documentation_confirmation_window *window = malloc(sizeof(documentation_confirmation_window)); + window->Window = yon_gtk_builder_get_widget(builder,"helpConfirmationWindow"); + window->AcceptButton = yon_gtk_builder_get_widget(builder,"ReadHelpButton"); + window->CloseButton = yon_gtk_builder_get_widget(builder,"CancelHelpButton"); + window->HeaderLabel = yon_gtk_builder_get_widget(builder,"webHeaderNameLabel"); + window->AlwaysOpenCheck = yon_gtk_builder_get_widget(builder,"AlwaysOpenDocumentationCheckbox"); + gtk_label_set_text(GTK_LABEL(window->HeaderLabel),TITLE_LABEL); + gtk_widget_show_all(window->Window); + g_signal_connect(G_OBJECT(window->CloseButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(yon_open_browser),yon_char_new(link)); + g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL); + + + } else { + yon_open_browser(self,link); + } +} + +void on_link(GtkWidget *self, char* uri); +void on_link(GtkWidget *self, char* uri){ + gtk_widget_destroy(self); + on_open_documentation_confirmation(self,uri); +} + +void on_about(GtkWidget *); +void on_about(GtkWidget *){ + GtkBuilder *builder=gtk_builder_new_from_resource(ui_glade_path_about); + GtkWidget *window=yon_gtk_builder_get_widget(builder,"AboutWindow"); + GtkWidget *title=yon_gtk_builder_get_widget(builder,"headerAboutTopic"); + GtkWidget *hideButtonBox=yon_gtk_builder_get_widget(builder,"buttonBoxHide"); + gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(window),version_application); + gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(window),TITLE_LABEL); + gtk_about_dialog_set_logo_icon_name(GTK_ABOUT_DIALOG(window),yon_char_append("com.ublinux.",LocaleName)); + gtk_window_set_icon_name(GTK_WINDOW(window),yon_char_append("com.ublinux.",LocaleName)); + gtk_about_dialog_set_program_name(GTK_ABOUT_DIALOG(window),LocaleName); + gtk_label_set_text(GTK_LABEL(title),TITLE_LABEL); + g_signal_connect(G_OBJECT(window),"activate-link",G_CALLBACK(on_link),WIKI_LINK); + gtk_widget_set_visible(hideButtonBox,0); + gtk_widget_destroy(hideButtonBox); + gtk_widget_show(window); +} + double yon_size_long_convert_automatic(unsigned long bytes, char *size); double yon_size_long_convert_automatic(unsigned long bytes, char *size){ int repeats; @@ -1036,9 +1089,13 @@ main_window *yon_main_window_complete(){ widgets->CommonInstallationFilesystemTypeCombo = yon_gtk_builder_get_widget(builder,"CommonInstallationFilesystemTypeCombo"); widgets->CommonInstallationSectionNameEntry = yon_gtk_builder_get_widget(builder,"CommonInstallationSectionNameEntry"); + widgets->GpartedCommonButton = yon_gtk_builder_get_widget(builder,"GpartedCommonButton"); widgets->GpartedNearButton = yon_gtk_builder_get_widget(builder,"GpartedNearButton"); widgets->GpartedSameButton = yon_gtk_builder_get_widget(builder,"GpartedSameButton"); + widgets->DocumentationMenuItem = yon_gtk_builder_get_widget(builder,"DocumentationMenuItem"); + widgets->AboutMenuItem = yon_gtk_builder_get_widget(builder,"AboutMenuItem"); + widgets->StatusBox = yon_gtk_builder_get_widget(builder,"StatusBox"); widgets->AdditionalSoftwareCell = GTK_CELL_RENDERER(gtk_builder_get_object(builder,"AdditionalSoftwareCell")); @@ -1049,6 +1106,7 @@ main_window *yon_main_window_complete(){ widgets->AdditionalSoftwareList = GTK_LIST_STORE(gtk_builder_get_object(builder,"AdditionalSoftwareList")); widgets->PartitionsList = GTK_LIST_STORE(gtk_builder_get_object(builder,"PartitionsList")); + g_signal_connect(G_OBJECT(widgets->GpartedCommonButton),"clicked",G_CALLBACK(on_gparted_open),NULL); g_signal_connect(G_OBJECT(widgets->GpartedSameButton),"clicked",G_CALLBACK(on_gparted_open),NULL); g_signal_connect(G_OBJECT(widgets->GpartedNearButton),"clicked",G_CALLBACK(on_gparted_open),NULL); @@ -1072,6 +1130,9 @@ main_window *yon_main_window_complete(){ g_signal_connect(G_OBJECT(widgets->InstallationNearSysDevicesTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); g_signal_connect(G_OBJECT(widgets->SamePlaceDeviceTree),"cursor-changed",G_CALLBACK(on_near_installation_device_changed),widgets); + g_signal_connect(G_OBJECT(widgets->DocumentationMenuItem),"activate",G_CALLBACK(on_open_documentation_confirmation),widgets); + g_signal_connect(G_OBJECT(widgets->AboutMenuItem),"activate",G_CALLBACK(on_about),widgets); + g_signal_connect(G_OBJECT(widgets->SamePlacePartTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); g_signal_connect(G_OBJECT(widgets->InstallationNearSysSectionTree),"cursor-changed",G_CALLBACK(on_partition_changed),widgets); gtk_tree_model_filter_set_visible_column(GTK_TREE_MODEL_FILTER(widgets->LayoutsFilter),3); diff --git a/source/ubinstall-gtk.h b/source/ubinstall-gtk.h index a567ad2..70c61ee 100755 --- a/source/ubinstall-gtk.h +++ b/source/ubinstall-gtk.h @@ -16,13 +16,15 @@ #endif #include "ubl-strings.h" -#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubinstall-gtk-output" +#define WIKI_LINK "https://wiki.ublinux.ru/ru/Программное_обеспечение/Программы_и_утилиты/Все/ubinstall-gtk" #define _(String) gettext(String) #define glade_path "/com/ublinux/ui/ubinstall-gtk.glade" #define glade_path_ubinstall_keyboard "/com/ublinux/ui/ubinstall-gtk-keyboard.glade" #define glade_path_ubinstall_language "/com/ublinux/ui/ubinstall-gtk-language.glade" +#define ui_glade_path_about "/com/ublinux/ui/ubinstall-gtk-about.glade" +#define ui_glade_path_documentation "/com/ublinux/ui/ubinstall-gtk-documentation.glade" #define CssPath "/com/ublinux/css/ubinstall-gtk.css" #define config_path yon_char_unite(yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",LocaleName,".conf",NULL) @@ -260,9 +262,13 @@ typedef struct { GtkWidget *PackageInstallationProgress; GtkWidget *PackageInstallationLabel; + GtkWidget *GpartedCommonButton; GtkWidget *GpartedNearButton; GtkWidget *GpartedSameButton; + GtkWidget *AboutMenuItem; + GtkWidget *DocumentationMenuItem; + GtkCellRenderer *AdditionalSoftwareCell; GtkWidget *CommonInstallationDevicesTree; @@ -281,7 +287,7 @@ typedef struct { typedef struct { GtkWidget *Window; - + GtkWidget *HeaderLabel; GtkWidget *AlwaysOpenCheck; GtkWidget *CloseButton; diff --git a/source/ubl-strings.h b/source/ubl-strings.h index 58f18e5..ae86631 100644 --- a/source/ubl-strings.h +++ b/source/ubl-strings.h @@ -1,7 +1,7 @@ #define VERSION_LABEL yon_char_unite(_("Version:")," ",!yon_char_is_empty(version_application)?version_application:"","\n",NULL) #define HELP_LABEL(rest) yon_char_unite(LocaleName,_(" version:")," ", !yon_char_is_empty(version_application)?version_application:"","\n",TITLE_LABEL,"\n",_("Usage:"), " ",LocaleName," ",_("[OPTIONS]"),"\n",_("Options:"),"\n\t--help, -h\t\t\t",_("Show this help"),"\n\t--version, -V\t\t\t",_("Show package version"),"\n\t--lock-help\t\t\t",_("Lock this help menu"),"\n\t--lock-save\t\t\t",_("Lock configuration saving"),"\n\t--lock-save-local\t\t",_("Lock local configration saving"),"\n\t--lock-save-global\t\t",_("Lock global configration saving"),"\n\t--lock-load-global\t\t",_("Lock global configration loading"),"\n\t--clear-config\t\t\t",_("Reset application settings"),"\n",!yon_char_is_empty(rest)?rest:NULL,NULL) -#define TITLE_LABEL _("ubinstall") +#define TITLE_LABEL _("UBLinux installation") #define WELCOME_LABEL _("Welcome to UBLinux installation") #define WELCOME_BOTTOM_LABEL _("This program will ask you few questions\nand help you install UBLinux on your computer") @@ -105,4 +105,12 @@ #define DEFAULT_MODEL_LABEL _("Default (Regular 105-key)") #define INSTALL_BEGIN_HEADER_LABEL _("Installation configuration has ended") -#define INSTALL_BEGIN_LABEL _("UBLinux OS installation is about to begin") \ No newline at end of file +#define INSTALL_BEGIN_LABEL _("UBLinux OS installation is about to begin") + +#define DOCUMENTATION_LABEL _("Documentation") +#define ABOUT_LABEL _("About") + +#define DOCUMENTATION_QUESTION_LABEL _("Would you like to read documentation in the Web?") +#define DOCUMENTATION_HEAD_LABEL _("You will be redirected to documentation website where documentation is\ntranslated and supported by community.") +#define DOCUMENTATION_CHECK_LABEL _("Always redirect to online documentation") +#define OPEN_DOCUMENTATION_LABEL _("Open documentation") \ No newline at end of file diff --git a/ubinstall-gtk-about.glade b/ubinstall-gtk-about.glade new file mode 100644 index 0000000..b2e2765 --- /dev/null +++ b/ubinstall-gtk-about.glade @@ -0,0 +1,64 @@ + + + + + + False + False + True + center + com.ublinux.libublsettingsui-gtk3 + dialog + True + libublsettingsui-gtk3 + 1.1 + Copyright © 2022 - 2023, UBSoft LLC + TEMPLATE Manager + https://ublinux.ru/ + Project Home Page + Это приложение распространяется без каких-либо гарантий. +Подробнее в <a href="https://www.gnu.org/licenses/old-licenses/gpl-2.0.html">GNU General Public License, версии 2 или позднее</a>. + UBGroup + UBGroup + com.ublinux.libublsettingsui-gtk3 + True + gpl-2-0 + + + False + + + False + + + False + False + 0 + + + + + + + True + False + True + + + True + False + 5 + 5 + 5 + 5 + 2 + TEMPLATE Manager + + + + + + + + + diff --git a/ubinstall-gtk-documentation.glade b/ubinstall-gtk-documentation.glade new file mode 100644 index 0000000..30a6c77 --- /dev/null +++ b/ubinstall-gtk-documentation.glade @@ -0,0 +1,187 @@ + + + + + + True + False + com.ublinux.libublsettingsui-gtk3.cancel-symbolic + + + True + False + com.ublinux.libublsettingsui-gtk3.accept-symbolic + + + False + False + 450 + dialog-question-symbolic + + + True + False + 5 + 5 + 5 + 5 + 5 + 5 + vertical + 10 + + + True + False + + + True + False + start + 20 + 20 + dialog-question-symbolic + 6 + + + False + True + 0 + + + + + True + False + 10 + vertical + 5 + + + True + False + start + Would you like to read documentation in the Web? + True + 0 + + + + + + + False + True + 0 + + + + + True + False + start + start + You will be redirected to documentation website where documentation is +translated and supported by community. + 0 + + + + False + True + 1 + + + + + Always redirect to online documentation + True + True + False + end + True + + + + False + True + end + 2 + + + + + + True + True + 1 + + + + + + True + True + 0 + + + + + + + True + False + + + True + False + TEMPLATE Manager + + + + + + + + Cancel + True + True + True + image8 + + + + + + Open documentation + True + True + True + image9 + + + + end + 1 + + + + + + diff --git a/ubinstall-gtk.css b/ubinstall-gtk.css index 501ddbf..da5614d 100644 --- a/ubinstall-gtk.css +++ b/ubinstall-gtk.css @@ -169,7 +169,7 @@ treeview row:nth-child(even) { background-color: #ffffff; } color:inherit; } -.toggletabs:checked:disabled { +.toggletabs:checked:active { background:@theme_base_color; border-radius:0px; color:inherit; @@ -177,7 +177,7 @@ treeview row:nth-child(even) { background-color: #ffffff; } padding-bottom:7px; } -.toggletabs:checked>*:disabled { +.toggletabs:checked>*:active { background:@theme_base_color; border-color:inherit; border-style:solid; diff --git a/ubinstall-gtk.glade b/ubinstall-gtk.glade index 5a839da..730f0f5 100644 --- a/ubinstall-gtk.glade +++ b/ubinstall-gtk.glade @@ -111,6 +111,11 @@ False com.ublinux.libublsettingsui-gtk3.properties-symbolic + + True + False + com.ublinux.libublsettingsui-gtk3.properties-symbolic + True False @@ -138,6 +143,29 @@ True False + False + + + True + False + Documentation + True + + + + + + True + False + About + True + + + 800 @@ -185,7 +213,7 @@ 1 - True + False True 0 @@ -198,11 +226,18 @@ True - Welcome True - True + False True True + + + True + False + Welcome + 0 + + @@ -215,11 +250,18 @@ - Licence -agreement True - True + False True + + + True + False + Licence +agreement + 0 + + @@ -232,10 +274,17 @@ agreement - Sections True - True + False True + + + True + False + Sections + 0 + + @@ -248,10 +297,17 @@ agreement - Installation True - True + False True + + + True + False + Installation + 0 + + @@ -264,10 +320,17 @@ agreement - Location True - True + False True + + + True + False + Location + 0 + + @@ -280,10 +343,17 @@ agreement - Keyboard True - True + False True + + + True + False + Keyboard + 0 + + @@ -296,10 +366,17 @@ agreement - Users True - True + False True + + + True + False + Users + 0 + + @@ -312,10 +389,17 @@ agreement - Completion True - True + False True + + + True + False + Completion + 0 + + @@ -2469,11 +2553,40 @@ or continue working in the UBLinux Live environment. - + True False - Select device: - 0 + 5 + + + True + False + Select device: + 0 + + + False + True + 0 + + + + + True + True + True + image5 + + + + False + True + end + 1 + + False @@ -3350,6 +3463,7 @@ installed. + True True True image1 diff --git a/ubinstall-gtk.pot b/ubinstall-gtk.pot index 3cd3fc8..bdbfe9d 100644 --- a/ubinstall-gtk.pot +++ b/ubinstall-gtk.pot @@ -70,7 +70,7 @@ msgid "Reset application settings" msgstr "" #: source/ubl-strings.h:4 -msgid "ubinstall" +msgid "UBLinux installation" msgstr "" #: source/ubl-strings.h:6 @@ -438,6 +438,29 @@ msgstr "" msgid "UBLinux OS installation is about to begin" msgstr "" +#: source/ubl-strings.h:102 +msgid "Documentation" +msgstr "" + +#: source/ubl-strings.h:102 +msgid "About" +msgstr "" + +#: source/ubl-strings.h:102 +msgid "Would you like to read documentation in the Web?" +msgstr "" + +#: source/ubl-strings.h:102 +msgid "You will be redirected to documentation website where documentation is\ntranslated and supported by community." +msgstr "" + +#: source/ubl-strings.h:102 +msgid "Always redirect to online documentation" +msgstr "" + +#: source/ubl-strings.h:102 +msgid "Open documentation" +msgstr "" msgid "Afrikaans" msgstr "" diff --git a/ubinstall-gtk_ru.po b/ubinstall-gtk_ru.po index 67906fb..bf87102 100644 --- a/ubinstall-gtk_ru.po +++ b/ubinstall-gtk_ru.po @@ -71,7 +71,7 @@ msgstr "Удалить конфигурацию прилодения" #: source/ubl-strings.h:4 #, fuzzy -msgid "ubinstall" +msgid "UBLinux installation" msgstr "Программа установки UBLinux" #: source/ubl-strings.h:6 @@ -455,6 +455,30 @@ msgstr "Настройка установщика завершена" msgid "UBLinux OS installation is about to begin" msgstr "Начало установки ОС UBLinux" +#: source/ubl-strings.h:102 +msgid "Documentation" +msgstr "Документация" + +#: source/ubl-strings.h:102 +msgid "About" +msgstr "О программе" + +#: source/ubl-strings.h:102 +msgid "Would you like to read documentation in the Web?" +msgstr "Вы хотите прочитать документацию в Сети?" + +#: source/ubl-strings.h:102 +msgid "You will be redirected to documentation website where documentation is\ntranslated and supported by community." +msgstr "Вы будете перенаправлены на сайт с документацией, где документация переводится\nи поддерживается сообществом" + +#: source/ubl-strings.h:102 +msgid "Always redirect to online documentation" +msgstr "Всегда перенаправлять" + +#: source/ubl-strings.h:102 +msgid "Open documentation" +msgstr "Открыть документацию" + msgid "Afrikaans" msgstr "Африканский"