|
|
|
|
@ -553,14 +553,16 @@ void on_sessions_selection_changed(GtkWidget *, main_window *widgets){
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SessionStopButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SessionBlockButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SessionStartButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SessionSwitchButton,1);
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SessionStopButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SessionBlockButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SessionStartButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->SessionSwitchButton,0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void yon_sessions_update(main_window *widgets){
|
|
|
|
|
gboolean yon_sessions_update(main_window *widgets){
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->SessionMainTree),NULL);
|
|
|
|
|
gtk_list_store_clear(widgets->SessionsList);
|
|
|
|
|
int sessions_size;
|
|
|
|
|
@ -574,10 +576,11 @@ void yon_sessions_update(main_window *widgets){
|
|
|
|
|
else parsed[1]=INACTIVE_LABEL;
|
|
|
|
|
if (parsed&&size>4){
|
|
|
|
|
gtk_list_store_append(widgets->SessionsList,&iter);
|
|
|
|
|
gtk_list_store_set(widgets->SessionsList,&iter,0,atoi(parsed[0]),1,parsed[1],2,atoi(parsed[2]),3,parsed[3],4,parsed[4],-1);
|
|
|
|
|
gtk_list_store_set(widgets->SessionsList,&iter,0,atoi(parsed[0]),1,parsed[1],2,atoi(parsed[2]),3,parsed[3],4,yon_char_unite(parsed[4]," | ",parsed[5],NULL),5,parsed[4],6,parsed[5],-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
gtk_tree_view_set_model(GTK_TREE_VIEW(widgets->SessionMainTree),GTK_TREE_MODEL(widgets->SessionsList));
|
|
|
|
|
return G_SOURCE_REMOVE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_session_activate(GtkWidget *self, main_window *widgets){
|
|
|
|
|
@ -619,6 +622,25 @@ void on_session_end(GtkWidget *self, main_window *widgets){
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_session_unlock(GtkWidget *self, main_window *widgets){
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->SessionsList);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->SessionMainTree)),&model,&iter)){
|
|
|
|
|
int id;
|
|
|
|
|
gtk_tree_model_get(model,&iter,0,&id,-1);
|
|
|
|
|
dialog_confirmation_data *data = malloc(sizeof(dialog_confirmation_data));
|
|
|
|
|
char *convert = yon_char_from_int(id);
|
|
|
|
|
data->action_text = SESSION_ACTIVATE_TOOLTIP_LABEL(convert);
|
|
|
|
|
data->data = NULL;
|
|
|
|
|
data->function = NULL;
|
|
|
|
|
if (yon_confirmation_dialog_call(self,data) == GTK_RESPONSE_ACCEPT){
|
|
|
|
|
yon_launch(session_activate_session(convert));
|
|
|
|
|
free(convert);
|
|
|
|
|
yon_sessions_update(widgets);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_session_block(GtkWidget *self, main_window *widgets){
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(widgets->SessionsList);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
@ -1349,7 +1371,7 @@ void* yon_interface_update(main_window *widgets){
|
|
|
|
|
g_idle_add((GSourceFunc)yon_system_config_set,data);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_sessions_update(widgets);
|
|
|
|
|
g_idle_add((GSourceFunc)yon_sessions_update,widgets);
|
|
|
|
|
|
|
|
|
|
for (size_t i=0;i<json_object_array_length(jsobject);i++){
|
|
|
|
|
struct json_object *item_obj = json_object_array_get_idx(jsobject, i);
|
|
|
|
|
@ -1756,6 +1778,7 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
|
|
|
|
|
widgets->SessionRestartButton=yon_gtk_builder_get_widget(builder,"SessionRestartButton");
|
|
|
|
|
widgets->SessionMainTree=yon_gtk_builder_get_widget(builder,"SessionMainTree");
|
|
|
|
|
widgets->SessionSwitchButton=yon_gtk_builder_get_widget(builder,"SessionSwitchButton");
|
|
|
|
|
widgets->SessionStartButton=yon_gtk_builder_get_widget(builder,"SessionStartButton");
|
|
|
|
|
widgets->SessionStopButton=yon_gtk_builder_get_widget(builder,"SessionStopButton");
|
|
|
|
|
widgets->SessionBlockButton=yon_gtk_builder_get_widget(builder,"SessionBlockButton");
|
|
|
|
|
@ -1817,7 +1840,8 @@ void yon_main_window_complete(main_window *widgets){
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->ConfigUpdateButton),"clicked",G_CALLBACK(on_interface_update),widgets);
|
|
|
|
|
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SessionRestartButton),"clicked",G_CALLBACK(on_interface_update),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SessionStartButton),"clicked",G_CALLBACK(on_session_activate),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SessionSwitchButton),"clicked",G_CALLBACK(on_session_activate),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SessionStartButton),"clicked",G_CALLBACK(on_session_unlock),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SessionStopButton),"clicked",G_CALLBACK(on_session_end),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SessionBlockButton),"clicked",G_CALLBACK(on_session_block),widgets);
|
|
|
|
|
g_signal_connect(G_OBJECT(widgets->SessionMainTree),"cursor-changed",G_CALLBACK(on_sessions_selection_changed),widgets);
|
|
|
|
|
|