diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-07 18:16:27 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-07 18:16:27 (EDT) |
commit | 64b75559cb4017a84849cf85cadf55c01ede1e83 (patch) | |
tree | db565c9be9f1c581ca42b4c7b75d3a6f5b4e6d87 | |
parent | 7c722da00394561ddede4c85ae5ec3c37d698ec5 (diff) | |
download | marquee-64b75559cb4017a84849cf85cadf55c01ede1e83.zip marquee-64b75559cb4017a84849cf85cadf55c01ede1e83.tar.gz marquee-64b75559cb4017a84849cf85cadf55c01ede1e83.tar.bz2 |
MqWindow: Add icon to close confirmation dialog
-rw-r--r-- | src/window.c | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/src/window.c b/src/window.c index ad5b9a5..6a3b7ce 100644 --- a/src/window.c +++ b/src/window.c @@ -59,9 +59,11 @@ delete_event_cb(GtkWindow *widget, GdkEvent G_GNUC_UNUSED *event, MqWindow *window) { guint num_tabs; + gchar *message; + GtkWidget *message_label; + GtkWidget *vbox; + GtkWidget *hbox; GtkWidget *dialog; - GtkWidget *box; - gchar *msg; num_tabs = mq_tab_get_tree_size(window->root_tab) - 1; @@ -73,16 +75,32 @@ delete_event_cb(GtkWindow *widget, GdkEvent G_GNUC_UNUSED *event, return FALSE; } + /* Message */ + message = g_strdup_printf("You are about to close %d tabs. " + "Are you sure you want to continue?", num_tabs); + message_label = gtk_label_new(message); + g_free(message); + + /* Right vertical box (message and check button) */ + vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_box_pack_start(GTK_BOX(vbox), message_label, FALSE, FALSE, 0); + + /* Horizontal box (icon and right vertical box) */ + hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_box_pack_start(GTK_BOX(hbox), gtk_image_new_from_icon_name( + "dialog-question", GTK_ICON_SIZE_DIALOG), FALSE, FALSE, + 0); + gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0); + + /* Dialog */ dialog = gtk_dialog_new_with_buttons("Confirm Close", widget, GTK_DIALOG_DESTROY_WITH_PARENT, "_Cancel", GTK_RESPONSE_CANCEL, "Cl_ose Tabs", GTK_RESPONSE_OK, NULL); - box = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); - msg = g_strdup_printf("You are about to close %d tabs. " - "Are you sure you want to continue?", num_tabs); - gtk_container_add(GTK_CONTAINER(box), gtk_label_new(msg)); - g_free(msg); + gtk_container_add( + GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), + hbox); g_signal_connect(dialog, "response", G_CALLBACK(close_confirm_response_cb), window); gtk_widget_show_all(dialog); |