Added confirmation windows for installing and deleting drivers

pull/89/head
parent a308e6d23e
commit c814a20c74

@ -17,7 +17,22 @@ gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->TerminalMoreRevieler),active
void on_terminal_destroy(GtkWidget *self, main_window *widgets){ void on_terminal_destroy(GtkWidget *self, main_window *widgets){
gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->TerminalRevealer),0); gtk_revealer_set_reveal_child(GTK_REVEALER(widgets->TerminalRevealer),0);
gtk_widget_destroy(widgets->TerminalRevealer); gtk_widget_destroy(widgets->TerminalRevealer);
yon_proprietary_local_get(); GtkTreeModel *model;
GtkTreeIter iter;
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->DriversTree)),&model,&iter)){
char *module, *package;
gtk_tree_model_get(model, &iter, 7,&module, 8,&package,-1);
if (!yon_char_is_empty(module)){
if (!system(yon_get_is_installed_command(module))){
gtk_list_store_set(main_config.list,&iter,9,1,-1);
}
} else {
if (!system(yon_get_is_installed_command(package))){
gtk_list_store_set(main_config.list,&iter,10,1,-1);
}
}
}
yon_proprietary_get_thread(NULL,widgets);
yon_ubl_status_box_render(PROPRIETARY_OPETAION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE); yon_ubl_status_box_render(PROPRIETARY_OPETAION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
} }
@ -94,32 +109,6 @@ void yon_terminal_start(main_window *widgets, char *usr_command){
gtk_widget_show_all(widgets->TerminalRevealer); gtk_widget_show_all(widgets->TerminalRevealer);
} }
void on_driver_pack_install(GtkWidget *self,main_window *widgets){
GtkTreeIter iter;
char *name;
GtkTreeModel *list_s=GTK_TREE_MODEL(main_config.list);
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->DriversTree));
if(gtk_tree_selection_get_selected(selection,&list_s,&iter)){
gtk_tree_model_get(list_s,&iter,1,&name,-1);
yon_terminal_start(widgets,install_proprietary_command(name));
} else {
yon_ubl_status_box_render(PROPRIETARY_NOTHING_SELECTED_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
}
}
void on_driver_pack_delete(GtkWidget *self,main_window *widgets){
GtkTreeIter iter;
char *name;
GtkTreeModel *list_s=GTK_TREE_MODEL(main_config.list);
GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->DriversTree));
if(gtk_tree_selection_get_selected(selection,&list_s,&iter)){
gtk_tree_model_get(list_s,&iter,1,&name,-1);
yon_terminal_start(widgets,delete_proprietary_command(name));
} else {
yon_ubl_status_box_render(PROPRIETARY_NOTHING_SELECTED_LABEL,BACKGROUND_IMAGE_FAIL_TYPE);
}
}
void on_driver_pack_selection_change(GtkWidget *self, main_window *widgets){ void on_driver_pack_selection_change(GtkWidget *self, main_window *widgets){
GtkTreeIter iter; GtkTreeIter iter;
char *name; char *name;
@ -162,16 +151,30 @@ void on_pack_install_activate(GtkCellRendererToggle* self,gchar* path,main_windo
int installed; int installed;
gtk_tree_model_get(GTK_TREE_MODEL(main_config.list),&iter,1,&installed,8,&package,-1); gtk_tree_model_get(GTK_TREE_MODEL(main_config.list),&iter,1,&installed,8,&package,-1);
if (!installed){ if (!installed){
dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data));
data->action_text=INSTALL_CONFIRMATION_LABEL(package);
data->function=NULL;
data->data=NULL;
if (yon_confirmation_dialog_call(widgets->Window,data)==GTK_RESPONSE_ACCEPT){
if (!yon_char_is_empty(package)){ if (!yon_char_is_empty(package)){
char *command = install_proprietary_command(package); char *command = install_proprietary_command(package);
yon_terminal_start(widgets,command); yon_terminal_start(widgets,command);
} }
}
free(data);
} else { } else {
dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data));
data->action_text=REMOVE_CONFIRMATION_LABEL(package);
data->function=NULL;
data->data=NULL;
if (yon_confirmation_dialog_call(widgets->Window,data)==GTK_RESPONSE_ACCEPT){
if (!yon_char_is_empty(package)){ if (!yon_char_is_empty(package)){
char *command = delete_proprietary_command(package); char *command = delete_proprietary_command(package);
yon_terminal_start(widgets,command); yon_terminal_start(widgets,command);
} }
} }
free(data);
}
} }
void on_module_install_activate(GtkCellRendererToggle* self,gchar* path,main_window *widgets){ void on_module_install_activate(GtkCellRendererToggle* self,gchar* path,main_window *widgets){
@ -180,18 +183,32 @@ void on_module_install_activate(GtkCellRendererToggle* self,gchar* path,main_win
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(main_config.list),&iter,path); gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(main_config.list),&iter,path);
char *package; char *package;
int installed; int installed;
gtk_tree_model_get(GTK_TREE_MODEL(main_config.list),&iter,0,&installed,7,&package,-1); gtk_tree_model_get(GTK_TREE_MODEL(main_config.list),&iter,1,&installed,7,&package,-1);
if (!installed){ if (!installed){
dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data));
data->action_text=INSTALL_CONFIRMATION_LABEL(package);
data->function=NULL;
data->data=NULL;
if (yon_confirmation_dialog_call(widgets->Window,data)==GTK_RESPONSE_ACCEPT){
if (!yon_char_is_empty(package)){ if (!yon_char_is_empty(package)){
char *command = install_proprietary_command(package); char *command = install_proprietary_command(package);
yon_terminal_start(widgets,command); yon_terminal_start(widgets,command);
} }
}
free(data);
} else { } else {
dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data));
data->action_text=REMOVE_CONFIRMATION_LABEL(package);
data->function=NULL;
data->data=NULL;
if (yon_confirmation_dialog_call(widgets->Window,data)==GTK_RESPONSE_ACCEPT){
if (!yon_char_is_empty(package)){ if (!yon_char_is_empty(package)){
char *command = delete_proprietary_command(package); char *command = delete_proprietary_command(package);
yon_terminal_start(widgets,command); yon_terminal_start(widgets,command);
} }
} }
free(data);
}
} }
void on_port_chosen_changed(GtkWidget *self, monitor_edit_window *window){ void on_port_chosen_changed(GtkWidget *self, monitor_edit_window *window){
@ -952,7 +969,7 @@ void yon_proprietary_local_get(main_window *widgets){
int module_status = !yon_char_is_empty(current[1])?!system(yon_get_is_installed_command(current[1])):0; int module_status = !yon_char_is_empty(current[1])?!system(yon_get_is_installed_command(current[1])):0;
int package_status = !yon_char_is_empty(current[2])?!system(yon_get_is_installed_command(current[2])):0; int package_status = !yon_char_is_empty(current[2])?!system(yon_get_is_installed_command(current[2])):0;
gtk_list_store_append(main_config.list,&iter); gtk_list_store_append(main_config.list,&iter);
gtk_list_store_set(main_config.list,&iter,0,module_status,1,package_status,2,current[0],3,current[3],4,current[4],5,_(current[5]),7,current[1],8,current[2],-1); gtk_list_store_set(main_config.list,&iter,0,module_status,1,package_status,2,current[0],3,current[3],4,current[4],5,_(current[5]),7,current[1],8,current[2],9,!yon_char_is_empty(current[1]),10,!yon_char_is_empty(current[2]),-1);
} }
} }
} }
@ -967,8 +984,6 @@ void yon_proprietary_get_thread(GtkWidget *self,main_window *widgets){
yon_ubl_status_box_render(PROPRIETARY_LOADING_LABEL,BACKGROUND_IMAGE_INFO_TYPE); yon_ubl_status_box_render(PROPRIETARY_LOADING_LABEL,BACKGROUND_IMAGE_INFO_TYPE);
gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->DriversTree),NULL); gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->DriversTree),NULL);
GThread *thread = g_thread_new("drivers_loading",(GThreadFunc)(yon_proprietary_local_get),widgets); GThread *thread = g_thread_new("drivers_loading",(GThreadFunc)(yon_proprietary_local_get),widgets);
// yon_proprietary_local_get(widgets);
} }
void yon_monitor_view_dictionary_destroy(void *window){ void yon_monitor_view_dictionary_destroy(void *window){

@ -327,4 +327,6 @@ monitor_data *yon_monitor_new(main_window *widgets,int dull);
void yon_launch_with_output(char *command); void yon_launch_with_output(char *command);
void yon_proprietary_local_get(); void yon_proprietary_local_get();
void yon_monitor_view_update(); void yon_monitor_view_update();
void yon_proprietary_get_thread(GtkWidget *self,main_window *widgets);
#endif #endif

@ -189,3 +189,6 @@
#define KERNELS_SUPPORTED_UNFOUND_LABEL _("Warning: Couldn't find any supported kernel version") #define KERNELS_SUPPORTED_UNFOUND_LABEL _("Warning: Couldn't find any supported kernel version")
#define ALL_INSTALLED_KERNELS_LABEL _("Default (All installed)") #define ALL_INSTALLED_KERNELS_LABEL _("Default (All installed)")
#define INSTALL_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to install driver "),target,"?",NULL)
#define REMOVE_CONFIRMATION_LABEL(target) yon_char_unite(_("Are you sure want to remove driver "),target,"?",NULL)

@ -326,6 +326,10 @@
<column type="gchararray"/> <column type="gchararray"/>
<!-- column-name Package --> <!-- column-name Package -->
<column type="gchararray"/> <column type="gchararray"/>
<!-- column-name ModuleSensitive -->
<column type="gboolean"/>
<!-- column-name PackageSensitive -->
<column type="gboolean"/>
</columns> </columns>
</object> </object>
<object class="GtkBox" id="BoxMain"> <object class="GtkBox" id="BoxMain">
@ -1049,8 +1053,6 @@
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">False</property> <property name="can-focus">False</property>
<property name="margin-left">5</property>
<property name="margin-right">5</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">5</property> <property name="spacing">5</property>
<child> <child>
@ -1185,7 +1187,6 @@
<property name="visible">True</property> <property name="visible">True</property>
<property name="can-focus">True</property> <property name="can-focus">True</property>
<property name="hscrollbar-policy">external</property> <property name="hscrollbar-policy">external</property>
<property name="shadow-type">in</property>
<child> <child>
<object class="GtkTreeView" id="DriversTree"> <object class="GtkTreeView" id="DriversTree">
<property name="visible">True</property> <property name="visible">True</property>
@ -1204,6 +1205,7 @@
<child> <child>
<object class="GtkCellRendererToggle" id="ModuleRenderer"/> <object class="GtkCellRendererToggle" id="ModuleRenderer"/>
<attributes> <attributes>
<attribute name="sensitive">9</attribute>
<attribute name="active">0</attribute> <attribute name="active">0</attribute>
</attributes> </attributes>
</child> </child>
@ -1217,6 +1219,7 @@
<child> <child>
<object class="GtkCellRendererToggle" id="PackageRenderer"/> <object class="GtkCellRendererToggle" id="PackageRenderer"/>
<attributes> <attributes>
<attribute name="sensitive">10</attribute>
<attribute name="active">1</attribute> <attribute name="active">1</attribute>
</attributes> </attributes>
</child> </child>

Loading…
Cancel
Save