diff options
-rw-r--r-- | src/toolbars/navigation/main-menu.c | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/src/toolbars/navigation/main-menu.c b/src/toolbars/navigation/main-menu.c index 48a0e15..cf6e3d7 100644 --- a/src/toolbars/navigation/main-menu.c +++ b/src/toolbars/navigation/main-menu.c @@ -249,26 +249,6 @@ create_zoom_buttons(MqMainMenu *main_menu) return box; } -static GtkWidget * -create_application_buttons(MqMainMenu *main_menu) -{ - GtkWidget *box; - GtkWidget *preferences_button; - GtkWidget *about_button; - GtkWidget *quit_button; - - box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); - gtk_box_set_homogeneous(GTK_BOX(box), TRUE); - gtk_style_context_add_class(gtk_widget_get_style_context(box), - "linked"); - - NEW_BUTTON(preferences, "preferences-desktop", "Preferences"); - NEW_BUTTON(about, "help-about", "About Marquee"); - NEW_BUTTON(quit, "application-exit", "Quit"); - - return box; -} - #undef NEW_BUTTON #define BUTTON_ROWS 3 @@ -340,6 +320,20 @@ create_main_grid(MqMainMenu *main_menu) #undef NEW_BUTTON #undef CLICKED_CB +#define NEW_BUTTON(ID, ICON, LABEL, TOOLTIP) \ + G_STMT_START { \ + ID##_button = gtk_button_new_from_icon_name(ICON, \ + GTK_ICON_SIZE_BUTTON); \ + gtk_button_set_label(GTK_BUTTON(ID##_button), LABEL); \ + gtk_button_set_image_position(GTK_BUTTON(ID##_button), \ + GTK_POS_LEFT); \ + gtk_button_set_always_show_image(GTK_BUTTON(ID##_button), \ + TRUE); \ + gtk_widget_set_tooltip_text(ID##_button, TOOLTIP); \ + g_signal_connect(ID##_button, "clicked", \ + G_CALLBACK(ID##_clicked_cb), main_menu); \ + } G_STMT_END + static GtkWidget * create_profile_buttons(MqMainMenu *main_menu) { @@ -373,6 +367,29 @@ create_profile_buttons(MqMainMenu *main_menu) return grid; } +static GtkWidget * +create_application_buttons(MqMainMenu *main_menu) +{ + GtkWidget *about_button; + GtkWidget *quit_button; + GtkWidget *grid; + + NEW_BUTTON(about, "help-about", "About Marquee", "About Marquee"); + NEW_BUTTON(quit, "application-exit", NULL, "Quit"); + + /* Set up the grid. */ + grid = gtk_grid_new(); + gtk_grid_set_column_homogeneous(GTK_GRID(grid), TRUE); + gtk_style_context_add_class(gtk_widget_get_style_context(grid), + "linked"); + gtk_grid_attach(GTK_GRID(grid), about_button, 0, 0, 2, 1); + gtk_grid_attach(GTK_GRID(grid), quit_button, 2, 0, 1, 1); + + return grid; +} + +#undef NEW_BUTTON + static void menu_clicked_cb(MqMainMenu *main_menu) { |