diff options
author | Thomas White <taw@physics.org> | 2020-03-27 17:24:12 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:42:57 +0200 |
commit | ba77d15bc3b743dd506a943189c13c4e95f33760 (patch) | |
tree | c50c604ad5ddb4722a5a985413721ad477bf0521 /src/crystfel_gui.c | |
parent | d80dec2c52ce8c7734506440f275467a1ee133cc (diff) |
Add info bar / progress bar
Diffstat (limited to 'src/crystfel_gui.c')
-rw-r--r-- | src/crystfel_gui.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c index 2990c488..c086b0cf 100644 --- a/src/crystfel_gui.c +++ b/src/crystfel_gui.c @@ -541,6 +541,19 @@ static void add_gui_message(enum log_msg_type type, const char *msg, } +static void infobar_response_sig(GtkInfoBar *infobar, gint resp, + gpointer data) +{ + struct crystfelproject *proj = data; + + if ( resp == GTK_RESPONSE_CANCEL ) { + proj->backend->cancel(proj); + } + + gtk_info_bar_set_revealed(GTK_INFO_BAR(proj->info_bar), FALSE); +} + + int main(int argc, char *argv[]) { int c; @@ -553,6 +566,7 @@ int main(int argc, char *argv[]) GtkWidget *main_vbox; GtkWidget *toolbar; GtkWidget *button; + GtkWidget *bar_area; /* Long options */ const struct option longopts[] = { @@ -682,6 +696,23 @@ int main(int argc, char *argv[]) gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(main_vbox)); gtk_paned_pack2(GTK_PANED(hpaned), GTK_WIDGET(frame), TRUE, TRUE); + /* Progress info bar */ + proj.info_bar = gtk_info_bar_new_with_buttons(GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + NULL); + gtk_box_pack_end(GTK_BOX(main_vbox), GTK_WIDGET(proj.info_bar), + FALSE, FALSE, 0.0); + bar_area = gtk_info_bar_get_content_area(GTK_INFO_BAR(proj.info_bar)); + proj.progressbar = gtk_progress_bar_new(); + gtk_box_pack_start(GTK_BOX(bar_area), + GTK_WIDGET(proj.progressbar), + TRUE, TRUE, 0.0); + gtk_progress_bar_set_show_text(GTK_PROGRESS_BAR(proj.progressbar), + TRUE); + gtk_info_bar_set_revealed(GTK_INFO_BAR(proj.info_bar), FALSE); + g_signal_connect(G_OBJECT(proj.info_bar), "response", + G_CALLBACK(infobar_response_sig), &proj); + /* Icon region at left */ proj.icons = gtk_vbox_new(FALSE, 0.0); scroll = gtk_scrolled_window_new(NULL, NULL); |