void delete_selected(gint button_number) { struct site *tmp, *tmp2; extern GtkCTree *the_tree; extern GtkCTreeNode *current_site_node; extern gboolean rcfile_saved; if (button_number != GNOME_YES) return; if ((selected_site != NULL) && (all_sites != NULL)) { if (strcmp(all_sites->name, selected_site->name) == 0) { all_sites = all_sites->next; } else { tmp = find_prev_site(selected_site); if (tmp->next != NULL) { tmp2 = tmp->next; tmp->next = tmp2->next; } } gtk_ctree_remove_node(GTK_CTREE(the_tree), GTK_CTREE_NODE(current_site_node)); selected_site = NULL; current_site_node = NULL; } else { gnome_error_dialog("I've detected no site is selected, but one should be selected in order to get here. Oh dear."); } clear_main_area(); rcfile_saved = false; }
void delete_a_site(GtkWidget * button_or_menu, gpointer data) { gchar *tmp; if (selected_site == NULL) { gnome_error_dialog("Cannot perform deletion - no site appears to be selected"); } else { tmp = g_strdup_printf("Are you sure you wish to permanently delete the record of '%s'?", selected_site->name); fe_gtk_question(tmp, (GnomeReplyCallback) (delete_selected)); } }
void save_default(void) { extern char *rcfile; extern gboolean rcfile_saved; extern GtkWidget *sitecopy; if (rcfile == NULL) { gnome_app_error(GNOME_APP(sitecopy), "The current rcfile is set to NULL. Sites will not be saved. Contact the maintainer."); return; } if (rcfile_write(rcfile, all_sites) == 0) { gchar *tmp; tmp = g_strdup_printf("Site definitions saved to %s.", rcfile); gfe_status(tmp); g_free(tmp); } else { gnome_error_dialog("There was an error writing the site definitions.\n They may not have saved correctly."); } rcfile_saved = true; }
static void instrument_editor_file_selected (GtkWidget *w, GtkFileSelection *fs) { gchar *fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION(fs)); gtk_widget_hide(GTK_WIDGET(fs)); if(!file_selection_is_valid(fn)) { /* No file was actually selected. */ gnome_error_dialog(_("No file selected.")); return; } if(fs == GTK_FILE_SELECTION(fileops_dialogs[DIALOG_LOAD_INSTRUMENT])) { file_selection_save_path(fn, gui_settings.loadinstr_path); instrument_editor_load_instrument(fn); } else { file_selection_save_path(fn, gui_settings.saveinstr_path); instrument_editor_save_instrument(fn); } }
int main_update_please(GtkWidget * update_button, gpointer data) { extern GtkWidget *connection_label; GtkWidget *dialog_vbox1; GtkWidget *vbox1; GtkWidget *hseparator3; GtkWidget *table1; GtkWidget *label3; GtkWidget *label6; GtkWidget *hseparator1; GtkWidget *label2; GtkWidget *label1; GtkWidget *dialog_action_area1; uploaded_bytes = 0.0; if (selected_site == NULL) { gnome_error_dialog("You must select a site if you want to upload the changes!"); return 0; } if (!selected_site->remote_is_different) { gfe_status("Remote and local sites are already synchronised."); return 1; } upload_total = selected_site->totalnew + selected_site->totalchanged; make_error_window(); upload_window = gnome_dialog_new("Update Progress", NULL); gtk_widget_set_usize(upload_window, 480, -2); dialog_vbox1 = GNOME_DIALOG(upload_window)->vbox; gtk_widget_show(dialog_vbox1); vbox1 = gtk_vbox_new(FALSE, 1); gtk_widget_ref(vbox1); gtk_widget_show(vbox1); gtk_box_pack_start(GTK_BOX(dialog_vbox1), vbox1, TRUE, TRUE, 0); hseparator3 = gtk_hseparator_new(); gtk_widget_ref(hseparator3); gtk_widget_show(hseparator3); gtk_box_pack_start(GTK_BOX(vbox1), hseparator3, TRUE, TRUE, 3); table1 = gtk_table_new(4, 2, FALSE); gtk_widget_show(table1); gtk_box_pack_start(GTK_BOX(vbox1), table1, TRUE, TRUE, 0); gtk_table_set_row_spacings(GTK_TABLE(table1), 1); gtk_table_set_col_spacings(GTK_TABLE(table1), 2); status_label = gtk_label_new("Click Upload to begin."); gtk_widget_show(status_label); connection_label = status_label; gtk_table_attach(GTK_TABLE(table1), status_label, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify(GTK_LABEL(status_label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(status_label), 7.45058e-09, 0.5); op_label = gtk_label_new(" "); gtk_widget_show(op_label); gtk_table_attach(GTK_TABLE(table1), op_label, 0, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify(GTK_LABEL(op_label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(op_label), 7.45058e-09, 0.5); file_label = gtk_label_new(""); gtk_widget_show(file_label); gtk_table_attach(GTK_TABLE(table1), file_label, 0, 2, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify(GTK_LABEL(file_label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(file_label), 7.45058e-09, 0.5); label3 = gtk_label_new("Status: "); gtk_widget_show(label3); gtk_table_attach(GTK_TABLE(table1), label3, 0, 1, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify(GTK_LABEL(label3), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(label3), 7.45058e-09, 0.5); label6 = gtk_label_new("To: "); gtk_widget_show(label6); gtk_table_attach(GTK_TABLE(table1), label6, 0, 1, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify(GTK_LABEL(label6), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(label6), 7.45058e-09, 0.5); dir_label = gtk_label_new(" "); gtk_widget_show(dir_label); gtk_table_attach(GTK_TABLE(table1), dir_label, 1, 2, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_label_set_justify(GTK_LABEL(dir_label), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(dir_label), 7.45058e-09, 0.5); hseparator1 = gtk_hseparator_new(); gtk_widget_show(hseparator1); gtk_box_pack_start(GTK_BOX(vbox1), hseparator1, TRUE, TRUE, 5); label2 = gtk_label_new("Current Progress"); gtk_widget_show(label2); gtk_box_pack_start(GTK_BOX(vbox1), label2, TRUE, FALSE, 2); gtk_misc_set_alignment(GTK_MISC(label2), 0.5, 1); main_progressbar = gtk_progress_bar_new(); gtk_widget_show(main_progressbar); gtk_box_pack_start(GTK_BOX(vbox1), main_progressbar, TRUE, FALSE, 0); gtk_progress_set_show_text(GTK_PROGRESS(main_progressbar), TRUE); label1 = gtk_label_new("Total Progress"); gtk_widget_show(label1); gtk_box_pack_start(GTK_BOX(vbox1), label1, TRUE, FALSE, 2); gtk_misc_set_alignment(GTK_MISC(label1), 0.5, 1); job_progressbar = gtk_progress_bar_new(); gtk_widget_show(job_progressbar); gtk_box_pack_start(GTK_BOX(vbox1), job_progressbar, TRUE, FALSE, 0); gtk_progress_set_show_text(GTK_PROGRESS(job_progressbar), TRUE); keep_going_button = gtk_check_button_new_with_label("Ignore any errors and always keep going."); gtk_widget_show(keep_going_button); gtk_box_pack_start(GTK_BOX(vbox1), keep_going_button, TRUE, TRUE, 0); dialog_action_area1 = GNOME_DIALOG(upload_window)->action_area; gtk_widget_show(dialog_action_area1); gtk_button_box_set_layout(GTK_BUTTON_BOX(dialog_action_area1), GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(dialog_action_area1), 8); gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(upload_window), "Upload", GNOME_STOCK_PIXMAP_CONVERT); begin_button = g_list_last(GNOME_DIALOG(upload_window)->buttons)->data; gtk_widget_show(begin_button); GTK_WIDGET_SET_FLAGS(begin_button, GTK_CAN_DEFAULT); gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(upload_window), "View Errors", GNOME_STOCK_PIXMAP_SEARCH); error_button = g_list_last(GNOME_DIALOG(upload_window)->buttons)->data; gtk_signal_connect_object(GTK_OBJECT(error_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_show), GTK_OBJECT(error_log_window)); gtk_widget_show(error_button); gtk_widget_set_sensitive(error_button, FALSE); GTK_WIDGET_SET_FLAGS(error_button, GTK_CAN_DEFAULT); gnome_dialog_append_button(GNOME_DIALOG(upload_window), GNOME_STOCK_BUTTON_CLOSE); close_button = g_list_last(GNOME_DIALOG(upload_window)->buttons)->data; gtk_signal_connect(GTK_OBJECT(close_button), "clicked", GTK_SIGNAL_FUNC(close_main_update_window), NULL); /* gtk_signal_connect_object(GTK_OBJECT(close_button), "clicked", GTK_SIGNAL_FUNC(gnome_dialog_close), (gpointer) upload_window); */ gtk_widget_show(close_button); GTK_WIDGET_SET_FLAGS(close_button, GTK_CAN_DEFAULT); if (strcmp((gchar *)data, "single") == 0) { gtk_signal_connect(GTK_OBJECT(begin_button), "clicked", GTK_SIGNAL_FUNC(start_main_update), "single"); } else if (strcmp((gchar *)data, "all") == 0) { gtk_signal_connect(GTK_OBJECT(begin_button), "clicked", GTK_SIGNAL_FUNC(start_main_update), "all"); } else { g_assert_not_reached(); } gtk_widget_show(upload_window); return 2; }