pull/89/head
Ivan Dmitrievich Yartsev 10 months ago
parent 5b1fa44581
commit 387362ecd1

@ -3,6 +3,7 @@
<gresource prefix="/com/ublinux/ui">
<file>ubl-settings-video.glade</file>
<file>ubl-settings-video-monitor.glade</file>
<file>ubl-settings-video-terminal.glade</file>
<file>ubl-settings-video-configuration.glade</file>
</gresource>
<gresource prefix="/com/ublinux/css">

@ -37,6 +37,7 @@ add_custom_target(GLADE ubl-settings-video.glade)
set(DEPENDFILES
../ubl-settings-video.glade
../ubl-settings-video-terminal.glade
../ubl-settings-video-monitor.glade
../ubl-settings-video-configuration.glade
../gresource.xml

@ -35,11 +35,19 @@ void on_terminal_destroy(GtkWidget *, main_window *widgets){
yon_ubl_status_box_render(PROPRIETARY_OPETAION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
}
static void child_ready(VteTerminal *terminal, GPid pid, GError *, gpointer user_data)
{
if (!terminal) return;
if (pid == -1) printf("Error\n\n\n");
else vte_terminal_feed_child(VTE_TERMINAL(terminal),(char*)user_data,strlen((char*)user_data));
gboolean on_command_execute_success(GtkWidget *,gint status,main_window *){
g_mutex_lock(&main_config.progress_mutex);
main_config.progress_active=0;
g_mutex_unlock(&main_config.progress_mutex);
if (!status){
yon_ubl_status_box_render(yon_char_get_localised_from_lib(SUCCESS_LABEL),BACKGROUND_IMAGE_SUCCESS_TYPE);
} else {
yon_ubl_status_box_render(yon_char_get_localised_from_lib(FAIL_LABEL),BACKGROUND_IMAGE_FAIL_TYPE);
}
return G_SOURCE_REMOVE;
}
gboolean on_terminal_check_progress(main_window *widgets){
@ -72,7 +80,7 @@ gboolean on_terminal_check_progress(main_window *widgets){
g_match_info_unref(match);
g_mutex_lock(&main_config.progress_mutex);
if (!main_config.progress_active){
if (percentage==100){
gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(widgets->TerminalInfoLabel),0);
g_mutex_unlock(&main_config.progress_mutex);
return G_SOURCE_REMOVE;
@ -90,7 +98,7 @@ void yon_terminal_start(main_window *widgets, char *usr_command){
env[0]="";
env[1]=NULL;
GtkBuilder *builder=gtk_builder_new_from_resource(glade_path);
GtkBuilder *builder=gtk_builder_new_from_resource(glade_terminal_path);
widgets->TerminalBox = yon_gtk_builder_get_widget(builder, "TerminalBox");
widgets->TerminalRevealer = yon_gtk_builder_get_widget(builder, "TerminalRevealer");
widgets->TerminalMoreRevieler = yon_gtk_builder_get_widget(builder, "TerminalMoreRevieler");
@ -99,48 +107,28 @@ void yon_terminal_start(main_window *widgets, char *usr_command){
widgets->TerminalInfoLabel = yon_gtk_builder_get_widget(builder, "TerminalInfoLabel");
widgets->terminal = yon_gtk_builder_get_widget(builder, "TerminalTerminal");
g_signal_connect(G_OBJECT(widgets->terminal),"child-exited",G_CALLBACK(on_command_execute_success),widgets);
gtk_button_set_label(GTK_BUTTON(widgets->TerminalMoreButton),MORE_LABEL);
vte_terminal_set_size(VTE_TERMINAL(widgets->terminal),10,15);
gtk_widget_set_app_paintable(widgets->terminal,1);
gtk_style_context_add_class(gtk_widget_get_style_context(widgets->terminal),"opacited");
gtk_style_context_add_class(gtk_widget_get_style_context(widgets->terminal),"workingbg");
gtk_overlay_add_overlay(GTK_OVERLAY(widgets->TerminalOverlay),widgets->TerminalRevealer);
g_signal_connect(G_OBJECT(widgets->terminal), "child-exited", G_CALLBACK(on_terminal_done), widgets);
// g_signal_connect(G_OBJECT(widgets->terminal), "child-exited", G_CALLBACK(on_terminal_done), widgets);
// g_signal_connect(G_OBJECT(widgets->terminal), "contents-changed", G_CALLBACK(on_terminal_check_progress), widgets);
g_signal_connect(G_OBJECT(widgets->TerminalMoreButton), "clicked", G_CALLBACK(on_terminal_more), widgets);
g_signal_connect(G_OBJECT(widgets->terminal), "destroy", G_CALLBACK(on_terminal_destroy), widgets);
gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->TerminalRevealer),1);
VtePty *pty = vte_pty_new_sync(VTE_PTY_DEFAULT,NULL,NULL);
vte_terminal_set_pty(VTE_TERMINAL(widgets->terminal),pty);
char *install_command=yon_char_unite("tput cup 0 0 && tput ed; ",usr_command," ; sleep 5;exit 0","\n",NULL);
vte_terminal_spawn_async(VTE_TERMINAL(widgets->terminal),
VTE_PTY_DEFAULT,
NULL,
command,
NULL,
0,
NULL, NULL,
NULL,
-1,
NULL,
child_ready,
install_command);
vte_pty_spawn_async(pty,
NULL,
command,
NULL,
0,
NULL, NULL,
NULL,
-1,
NULL,
NULL,
NULL);
vte_terminal_reset(VTE_TERMINAL(widgets->terminal),0,1);
yon_terminal_integrated_start_shell(widgets->terminal,usr_command,on_terminal_done,widgets);
vte_terminal_set_scrollback_lines(VTE_TERMINAL(widgets->terminal), 100);
vte_terminal_set_scroll_on_output(VTE_TERMINAL(widgets->terminal), TRUE);
vte_terminal_set_scroll_on_keystroke(VTE_TERMINAL(widgets->terminal), TRUE);
gtk_widget_show_all(widgets->TerminalRevealer);
g_mutex_lock(&main_config.progress_mutex);
main_config.progress_active=1;
g_mutex_unlock(&main_config.progress_mutex);
g_idle_add((GSourceFunc)on_terminal_check_progress,widgets);
}

@ -30,6 +30,7 @@
#define banner_path "/com/ublinux/images/ubl-settings-video-banner.png"
#define glade_path "/com/ublinux/ui/ubl-settings-video.glade"
#define glade_terminal_path "/com/ublinux/ui/ubl-settings-video-terminal.glade"
#define glade_path_monitor "/com/ublinux/ui/ubl-settings-video-monitor.glade"
#define glade_path_configuration "/com/ublinux/ui/ubl-settings-video-configuration.glade"
@ -387,4 +388,5 @@ void *yon_proprietary_local_get(main_window *widgets);
gboolean yon_proprietary_append_kernels(struct proprietary_kernel_append_struct *append);
gboolean yon_proprietary_append(struct proprietary_struct *target);
gboolean yon_proprietary_clear(main_window *widgets);
gboolean on_command_execute_success(GtkWidget *,gint status,main_window *widgets);
#endif

@ -199,6 +199,7 @@
#define KERNELS_SUPPORTED_UNFOUND_LABEL _("Warning: Couldn't find any supported kernel version")
#define ALL_INSTALLED_KERNELS_LABEL _("Default (All installed)")
#define FAIL_LABEL _("Driver installation has failed")
#define INSTALL_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to install driver "),"<b>",target,"</b>?",NULL)
#define REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to remove driver "),"<b>",target,"</b>?",NULL)

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.38.2 -->
<interface domain="ubl-settings-video">
<requires lib="gtk+" version="3.24"/>
<requires lib="vte-2.91" version="0.76"/>
<!-- interface-css-provider-path ubl-settings-video.css -->
<object class="GtkRevealer" id="TerminalRevealer">
<property name="visible">True</property>
<property name="app-paintable">True</property>
<property name="can-focus">False</property>
<property name="valign">end</property>
<property name="reveal-child">True</property>
<child>
<object class="GtkFrame" id="TerminalFrame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="margin-top">5</property>
<property name="margin-bottom">5</property>
<property name="orientation">vertical</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-bottom">5</property>
<property name="spacing">5</property>
<child>
<object class="GtkProgressBar" id="TerminalInfoLabel">
<property name="visible">True</property>
<property name="app-paintable">True</property>
<property name="can-focus">False</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="TerminalMoreButton">
<property name="label" translatable="yes">More</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="can-default">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</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">0</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="TerminalMoreRevieler">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox" id="TerminalBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="VteTerminal" id="TerminalTerminal">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="vadjustment">adjustment1</property>
<property name="encoding">UTF-8</property>
<property name="pointer-autohide">True</property>
<property name="scroll-on-keystroke">True</property>
<property name="scroll-on-output">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrollbar" id="TerminalScroll">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="adjustment">adjustment1</property>
<property name="show-fill-level">True</property>
<property name="restrict-to-fill-level">False</property>
<property name="fill-level">1</property>
<property name="round-digits">2</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
</child>
<style>
<class name="workingbg"/>
</style>
</object>
</child>
<style>
<class name="opacited"/>
<class name="workingbg"/>
<class name="borders"/>
</style>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">300</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
</interface>

@ -2,7 +2,6 @@
<!-- Generated with glade 3.38.2 -->
<interface domain="ubl-settings-video">
<requires lib="gtk+" version="3.24"/>
<requires lib="vte-2.91" version="0.68"/>
<!-- interface-css-provider-path ubl-settings-video.css -->
<object class="GtkImage" id="InformationCompanyLogoImage">
<property name="visible">True</property>
@ -110,166 +109,6 @@
</object>
</child>
</object>
<object class="GtkAdjustment" id="adjustment1">
<property name="upper">300</property>
<property name="value">0.7299999937415127</property>
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
<object class="GtkRevealer" id="TerminalRevealer">
<property name="visible">True</property>
<property name="app-paintable">True</property>
<property name="can-focus">False</property>
<property name="valign">end</property>
<property name="reveal-child">True</property>
<child>
<object class="GtkFrame" id="TerminalFrame">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="label-xalign">0</property>
<property name="shadow-type">in</property>
<child>
<object class="GtkAlignment">
<property name="visible">True</property>
<property name="can-focus">False</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-top">5</property>
<property name="margin-bottom">5</property>
<property name="orientation">vertical</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-bottom">5</property>
<property name="spacing">5</property>
<child>
<object class="GtkProgressBar" id="TerminalInfoLabel">
<property name="visible">True</property>
<property name="app-paintable">True</property>
<property name="can-focus">False</property>
<property name="valign">center</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="TerminalMoreButton">
<property name="label" translatable="yes">More</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="can-default">True</property>
<property name="receives-default">True</property>
</object>
<packing>
<property name="expand">False</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">0</property>
</packing>
</child>
<child>
<object class="GtkRevealer" id="TerminalMoreRevieler">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child>
<object class="GtkBox" id="TerminalBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="VteTerminal" id="TerminalTerminal">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can-focus">True</property>
<property name="hscroll-policy">natural</property>
<property name="vadjustment">adjustment1</property>
<property name="vscroll-policy">natural</property>
<property name="encoding">UTF-8</property>
<property name="scroll-on-keystroke">True</property>
<property name="scroll-on-output">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrollbar" id="TerminalScroll">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<property name="adjustment">adjustment1</property>
<property name="show-fill-level">True</property>
<property name="restrict-to-fill-level">False</property>
<property name="fill-level">1</property>
<property name="round-digits">2</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can-focus">False</property>
</object>
</child>
<style>
<class name="workingbg"/>
</style>
</object>
</child>
<style>
<class name="opacited"/>
<class name="workingbg"/>
<class name="borders"/>
</style>
</object>
<object class="GtkImage" id="image1">
<property name="visible">True</property>
<property name="can-focus">False</property>

Loading…
Cancel
Save