From 4d5813c5bc36db88e26afdac6fcaed794c8f8662 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 28 Sep 2017 16:42:37 -0400 Subject: MqTabChrome: Make quit button functional --- (limited to 'src/tab-chrome.c') diff --git a/src/tab-chrome.c b/src/tab-chrome.c index ec4bb77..97dd210 100644 --- a/src/tab-chrome.c +++ b/src/tab-chrome.c @@ -301,6 +301,15 @@ uri_activate_cb(GtkEntry *entry, MqTabChrome *chrome) gtk_entry_get_text(GTK_ENTRY(entry))); } +static void +quit_clicked_cb(GtkButton __attribute__((unused)) *button, + MqTabChrome __attribute__((unused)) *chrome) +{ + /* TODO: Make a function mq_application_quit() that shows a confirmation + * dialog. */ + gtk_main_quit(); +} + #define BUTTON_ROWS 6 #define BUTTON_COLS 3 #define NEW_BUTTON(Y, X, ICON, TOOLTIP) \ @@ -312,6 +321,9 @@ uri_activate_cb(GtkEntry *entry, MqTabChrome *chrome) gtk_grid_attach(GTK_GRID(grid), buttons[Y * BUTTON_COLS + X], \ X, Y, 1, 1); \ } while (0) +#define CLICKED_CB(Y, X, CB) \ + g_signal_connect(buttons[Y * BUTTON_COLS + X], "clicked", \ + G_CALLBACK(CB), chrome) static void menu_button_clicked_cb(GtkToolButton *tool_button, @@ -342,6 +354,8 @@ menu_button_clicked_cb(GtkToolButton *tool_button, NEW_BUTTON(5, 0, "help-about", "About Marquee"); NEW_BUTTON(5, 2, "application-exit", "Quit"); + CLICKED_CB(5, 2, quit_clicked_cb); + /* Set up the popover. */ popover = gtk_popover_new(GTK_WIDGET(tool_button)); gtk_container_add(GTK_CONTAINER(popover), grid); -- cgit v0.9.1