From ed2e24de47d5ccd32c258426ccf010aeb98768b8 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 28 Sep 2017 14:36:58 -0400 Subject: MqTab: Move macro (un)definitions --- (limited to 'src/tab.c') diff --git a/src/tab.c b/src/tab.c index 0452106..23480c9 100644 --- a/src/tab.c +++ b/src/tab.c @@ -142,33 +142,6 @@ tab_list_button_toggled_cb(GtkToggleButton *toggle_button, GtkWidget *tab_list) } } -#define BUTTON_ROWS 2 -#define BUTTON_COLS 4 -#define NEW_BUTTON(Y, X, ICON, TOOLTIP) \ - do { \ - buttons[Y * BUTTON_COLS + X] = gtk_button_new_from_icon_name(\ - ICON, GTK_ICON_SIZE_BUTTON); \ - gtk_widget_set_tooltip_text(buttons[Y * BUTTON_COLS + X], \ - TOOLTIP); \ - gtk_widget_set_can_focus(buttons[Y * BUTTON_COLS + X], FALSE); \ - gtk_grid_attach(GTK_GRID(button_grid), \ - buttons[Y * BUTTON_COLS + X], X, Y, 1, 1); \ - } while (0) -#define NEW_TOGGLE(Y, X, ICON, TOOLTIP) \ - do { \ - buttons[Y * BUTTON_COLS + X] = gtk_toggle_button_new(); \ - gtk_button_set_image(GTK_BUTTON(buttons[Y * BUTTON_COLS + X]), \ - gtk_image_new_from_icon_name(ICON, \ - GTK_ICON_SIZE_BUTTON)); \ - gtk_widget_set_tooltip_text(buttons[Y * BUTTON_COLS + X], \ - TOOLTIP); \ - gtk_widget_set_can_focus(buttons[Y * BUTTON_COLS + X], FALSE); \ - gtk_grid_attach(GTK_GRID(button_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", CB, tab) - static void create_tree_model_recurse(MqTab *node, GtkTreeStore *tree_store, GtkTreeIter *parent_tree_iter) @@ -226,6 +199,33 @@ create_tab_list(MqTab *tab) return scrolled_window; } +#define BUTTON_ROWS 2 +#define BUTTON_COLS 4 +#define NEW_BUTTON(Y, X, ICON, TOOLTIP) \ + do { \ + buttons[Y * BUTTON_COLS + X] = gtk_button_new_from_icon_name(\ + ICON, GTK_ICON_SIZE_BUTTON); \ + gtk_widget_set_tooltip_text(buttons[Y * BUTTON_COLS + X], \ + TOOLTIP); \ + gtk_widget_set_can_focus(buttons[Y * BUTTON_COLS + X], FALSE); \ + gtk_grid_attach(GTK_GRID(button_grid), \ + buttons[Y * BUTTON_COLS + X], X, Y, 1, 1); \ + } while (0) +#define NEW_TOGGLE(Y, X, ICON, TOOLTIP) \ + do { \ + buttons[Y * BUTTON_COLS + X] = gtk_toggle_button_new(); \ + gtk_button_set_image(GTK_BUTTON(buttons[Y * BUTTON_COLS + X]), \ + gtk_image_new_from_icon_name(ICON, \ + GTK_ICON_SIZE_BUTTON)); \ + gtk_widget_set_tooltip_text(buttons[Y * BUTTON_COLS + X], \ + TOOLTIP); \ + gtk_widget_set_can_focus(buttons[Y * BUTTON_COLS + X], FALSE); \ + gtk_grid_attach(GTK_GRID(button_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", CB, tab) + static void create_tab_popover(GtkWidget *widget, MqTab *tab) { @@ -291,6 +291,12 @@ create_tab_popover(GtkWidget *widget, MqTab *tab) gtk_widget_hide(tab_list_scrolled_window); } +#undef BUTTON_ROWS +#undef BUTTON_COLS +#undef NEW_BUTTON +#undef NEW_TOGGLE +#undef CLICKED_CB + static gboolean tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab) { @@ -307,12 +313,6 @@ tab_label_button_press_cb(GtkWidget *widget, GdkEvent *event, MqTab *tab) return FALSE; } -#undef BUTTON_ROWS -#undef BUTTON_COLS -#undef NEW_BUTTON -#undef NEW_TOGGLE -#undef CLICKED_CB - static void mq_tab_populate_tab(MqTab *tab) { -- cgit v0.9.1