WIP added warning window

pull/50/head
parent 7882220903
commit fa41c3c1b7

@ -7,6 +7,7 @@
<file>ubinstall-gtk-about.glade</file>
<file>ubinstall-gtk-documentation.glade</file>
<file>ubinstall-gtk-log-view.glade</file>
<file>ubinstall-gtk-warning.glade</file>
</gresource>
<gresource prefix="/com/ublinux/css">
<file>ubinstall-gtk.css</file>

@ -64,6 +64,7 @@ set(DEPENDFILES
../ubinstall-gtk-about.glade
../ubinstall-gtk-documentation.glade
../ubinstall-gtk-log-view.glade
../ubinstall-gtk-warning.glade
../gresource.xml
../ubinstall-gtk.css
../modules.csv

@ -812,7 +812,7 @@ void config_init(){
main_config.debug_mode=0;
main_config.slider_thread=0;
main_config.config_save_thread=NULL;
main_config.install_thread=NULL;
main_config.install_thread=0;
main_config.progress_thread=0;
main_config.install_complete=0;
main_config.save_done=0;
@ -820,6 +820,7 @@ void config_init(){
main_config.load_mode=-1;
main_config.log_progress_buzy=0;
main_config.log_end=0;
main_config.exit_accepted=0;
}
void on_configuration_mode_switch(GtkWidget *self);
@ -912,7 +913,7 @@ char* yon_debug_output(char *pattern,char*text){
void *on_config_save(void *data);
void *on_config_save(void *data){
main_window *widgets = (main_window*)data;
if (!main_config.install_complete){
int size=0;
config_str parameters = yon_config_get_all(&size);
// main_config.install_thread=(GThread*)0x1;
@ -925,7 +926,7 @@ void *on_config_save(void *data){
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALL_ERROR);
};
free(command);
main_config.install_thread=NULL;
main_config.install_thread=0;
main_config.install_complete=1;
yon_debug_output("Install set to: %s\n",yon_char_from_int(main_config.install_complete));
yon_debug_output("Save state: %s\n",yon_char_from_int(main_config.save_done));
@ -933,7 +934,6 @@ void *on_config_save(void *data){
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_COMPLETION);
}
main_config.config_save_thread=NULL;
}
pthread_exit(NULL);
}
@ -1694,7 +1694,14 @@ void on_page_navigation_clicked(GtkWidget *self, main_window *widgets){
}break;
case YON_PAGE_INSTALLATION_BEGIN:{
pthread_create(main_config.install_thread,NULL,on_config_save,widgets);
if (!main_config.install_thread){
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_t tid;
pthread_create(&tid,&attr,on_config_save,widgets);
memcpy(&main_config.install_thread,&tid,sizeof(pthread_t));
}
gtk_notebook_set_current_page(GTK_NOTEBOOK(widgets->Notebook),YON_PAGE_INSTALLATION);
} break;
@ -2086,26 +2093,36 @@ void on_gparted_open(){
yon_launch_app_with_arguments(open_gparted_command,NULL);
}
gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets);
gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets){
GtkWidget *dialog = gtk_dialog_new_with_buttons(TITLE_LABEL,GTK_WINDOW(widgets->MainWindow),0,CANCEL_LABEL,GTK_RESPONSE_CANCEL,ACCEPT_LABEL,GTK_RESPONSE_ACCEPT,NULL);
GtkWidget *box = gtk_dialog_get_content_area(GTK_DIALOG(dialog));
GtkWidget *HeadLabel = gtk_label_new(EXIT_WARNING_LABEL);
gtk_widget_show(HeadLabel);
gtk_box_pack_start(GTK_BOX(box),HeadLabel,0,0,5);
int resp = gtk_dialog_run(GTK_DIALOG(dialog));
if (resp == GTK_RESPONSE_ACCEPT){
if (main_config.install_thread)
pthread_cancel(*main_config.install_thread);
return 0;
} else {
gtk_widget_destroy(dialog);
}
return 1;
}
// gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets);
// void on_exit_accepted(GtkWidget *,main_window *widgets);
// void on_exit_accepted(GtkWidget *,main_window *widgets){
// if (main_config.install_thread){
// pthread_cancel((pthread_t)main_config.install_thread);
// }
// main_config.exit_accepted=1;
// g_signal_emit_by_name(G_OBJECT(widgets->MainWindow),"destroy",widgets->MainWindow,NULL);
// }
// gboolean on_yon_exit(GtkWidget *,GdkEvent*, main_window *widgets){
// if (!main_config.exit_accepted){
// if (widgets){};
// confirmation_window *window = malloc(sizeof(confirmation_window));
// GtkBuilder *builder = gtk_builder_new_from_resource(glade_path_confirmation);
// window->Window = yon_gtk_builder_get_widget(builder,"MainWindow");
// window->AcceptButton = yon_gtk_builder_get_widget(builder,"AcceptButton");
// window->CancelButton = yon_gtk_builder_get_widget(builder,"CancelButton");
// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_exit_accepted),widgets);
// g_signal_connect(G_OBJECT(window->AcceptButton),"clicked",G_CALLBACK(on_subwindow_close),NULL);
// gtk_window_set_transient_for(GTK_WINDOW(window->Window),GTK_WINDOW(widgets->MainWindow));
// gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL);
// gtk_window_set_icon_name(GTK_WINDOW(window->Window),icon_path);
// gtk_widget_show(window->Window);
// return 1;
// }
// return 0;
// }
/**yon_main_window_complete(main_window *widgets)
* [EN]
@ -2280,7 +2297,7 @@ main_window *yon_main_window_complete(){
widgets->SameFSTypeSensitiveCheck = yon_gtk_builder_get_widget(builder,"SameFSTypeSensitiveCheck");
widgets->SameLabelSensitiveCheck = yon_gtk_builder_get_widget(builder,"SameLabelSensitiveCheck");
g_signal_connect(G_OBJECT(widgets->MainWindow),"delete-event",G_CALLBACK(on_yon_exit),widgets);
// g_signal_connect(G_OBJECT(widgets->MainWindow),"delete-event",G_CALLBACK(on_yon_exit),widgets);
GtkWidget *menu = yon_gtk_builder_get_widget(builder,"menu2");
gtk_style_context_add_class(gtk_widget_get_style_context(widgets->DocumentationMenuItem),"menuitemmiddle");
gtk_style_context_remove_class(gtk_widget_get_style_context(widgets->DocumentationMenuItem),"menuitemtop");

@ -26,6 +26,7 @@
#define glade_path_log_view "/com/ublinux/ui/ubinstall-gtk-log-view.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 glade_path_confirmation "/com/ublinux/ui/ubinstall-gtk-warning.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)
@ -200,13 +201,14 @@ typedef struct {
guint slider_thread;
int install_mode;
GThread *config_save_thread;
pthread_t *install_thread;
unsigned long install_thread;
guint progress_thread;
int configure_mode;
int log_progress_buzy;
int autologin_default;
int format_default;
int log_end;
int exit_accepted;
} config;
typedef struct {

@ -0,0 +1,146 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface>
<requires lib="gtk+" version="3.24"/>
<object class="GtkApplicationWindow" id="MainWindow">
<property name="width-request">450</property>
<property name="height-request">250</property>
<property name="can-focus">False</property>
<property name="resizable">False</property>
<property name="default-width">450</property>
<property name="icon-name">dialog-question-symbolic</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="margin-start">5</property>
<property name="margin-end">5</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="orientation">vertical</property>
<property name="spacing">10</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="valign">center</property>
<property name="xpad">20</property>
<property name="ypad">20</property>
<property name="icon-name">dialog-question-symbolic</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="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="valign">center</property>
<property name="label" translatable="yes">Are you sure want to exit and
interrupt installation process?</property>
<style>
<class name="fgnb"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="fgnb"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="fgnb"/>
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
</child>
<child type="titlebar">
<object class="GtkHeaderBar" id="SettingsBar">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child type="title">
<object class="GtkLabel" id="webHeaderNameLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label" translatable="yes">Warning</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</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">image8</property>
<style>
<class name="button"/>
<class name="marginright"/>
</style>
</object>
</child>
<child>
<object class="GtkButton" id="AcceptButton">
<property name="label" translatable="yes">Accept</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">com.ublinux.libublsettingsui-gtk3.cancel-symbolic</property>
</object>
<object class="GtkImage" id="image9">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="icon-name">com.ublinux.libublsettingsui-gtk3.accept-symbolic</property>
</object>
</interface>
Loading…
Cancel
Save