static void exit_cb(GtkWidget *widget, gpointer data) { radioSaveState(); GtkWidget *dialog=gtk_dialog_new_with_buttons("Exit",GTK_WINDOW(parent_window),GTK_DIALOG_DESTROY_WITH_PARENT,NULL,NULL); GtkWidget *content=gtk_dialog_get_content_area(GTK_DIALOG(dialog)); GtkWidget *grid=gtk_grid_new(); gtk_grid_set_column_homogeneous(GTK_GRID(grid),TRUE); gtk_grid_set_row_homogeneous(GTK_GRID(grid),TRUE); GtkWidget *label=gtk_label_new("Exit?"); //gtk_widget_override_font(label, pango_font_description_from_string("Arial 18")); gtk_widget_show(label); gtk_grid_attach(GTK_GRID(grid),label,1,0,1,1); GtkWidget *b_yes=gtk_button_new_with_label("Yes"); //gtk_widget_override_font(b_yes, pango_font_description_from_string("Arial 18")); gtk_widget_show(b_yes); gtk_grid_attach(GTK_GRID(grid),b_yes,0,1,1,1); g_signal_connect(b_yes,"pressed",G_CALLBACK(yes_cb),NULL); GtkWidget *b_halt=gtk_button_new_with_label("Halt System"); //gtk_widget_override_font(b_halt, pango_font_description_from_string("Arial 18")); gtk_widget_show(b_halt); gtk_grid_attach(GTK_GRID(grid),b_halt,2,1,1,1); g_signal_connect(b_halt,"pressed",G_CALLBACK(halt_cb),NULL); gtk_container_add(GTK_CONTAINER(content),grid); GtkWidget *close_button=gtk_dialog_add_button(GTK_DIALOG(dialog),"Cancel",GTK_RESPONSE_OK); //gtk_widget_override_font(close_button, pango_font_description_from_string("Arial 18")); gtk_widget_show_all(dialog); g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); int result=gtk_dialog_run(GTK_DIALOG(dialog)); }
gboolean main_delete (GtkWidget *widget) { #ifdef GPIO gpio_close(); #endif switch(protocol) { case ORIGINAL_PROTOCOL: old_protocol_stop(); break; case NEW_PROTOCOL: new_protocol_stop(); break; #ifdef LIMESDR case LIMESDR_PROTOCOL: lime_protocol_stop(); break; #endif } radioSaveState(); _exit(0); }
static gboolean exit_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) { #ifdef GPIO gpio_close(); #endif switch(protocol) { case ORIGINAL_PROTOCOL: old_protocol_stop(); break; case NEW_PROTOCOL: new_protocol_stop(); break; #ifdef LIMESDR case LIMESDR_PROTOCOL: lime_protocol_stop(); break; #endif } radioSaveState(); _exit(0); }
static gint save_cb(gpointer data) { radioSaveState(); return TRUE; }