diff options
Diffstat (limited to 'src/toolbars')
-rw-r--r-- | src/toolbars/navigation/main-menu.c | 98 |
1 files changed, 62 insertions, 36 deletions
diff --git a/src/toolbars/navigation/main-menu.c b/src/toolbars/navigation/main-menu.c index 7ff3935..602f5a0 100644 --- a/src/toolbars/navigation/main-menu.c +++ b/src/toolbars/navigation/main-menu.c @@ -148,7 +148,39 @@ quit_clicked_cb(GtkButton G_GNUC_UNUSED *button, MqMainMenu *main_menu) mq_tab_page_quit(main_menu->tab_page); } -#define BUTTON_ROWS 5 +#define NEW_BUTTON(ID, ICON, TOOLTIP) \ + G_STMT_START { \ + ID##_button = gtk_button_new_from_icon_name(ICON, \ + GTK_ICON_SIZE_BUTTON); \ + gtk_widget_set_tooltip_text(ID##_button, TOOLTIP); \ + gtk_box_pack_start(GTK_BOX(box), ID##_button, \ + FALSE, FALSE, 0); \ + g_signal_connect(ID##_button, "clicked", \ + G_CALLBACK(ID##_clicked_cb), main_menu); \ + } G_STMT_END + +static GtkWidget * +create_zoom_buttons(MqMainMenu *main_menu) +{ + GtkWidget *box; + GtkWidget *zoom_out_button; + GtkWidget *zoom_reset_button; + GtkWidget *zoom_in_button; + + box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0); + gtk_style_context_add_class(gtk_widget_get_style_context(box), + "linked"); + + NEW_BUTTON(zoom_out, "zoom-out", "Zoom out"); + NEW_BUTTON(zoom_reset, "zoom-original", "Reset zoom"); + NEW_BUTTON(zoom_in, "zoom-in", "Zoom in"); + + return box; +} + +#undef NEW_BUTTON + +#define BUTTON_ROWS 4 #define BUTTON_COLS 3 #define NEW_BUTTON(Y, X, ICON, TOOLTIP) \ G_STMT_START { \ @@ -172,48 +204,40 @@ create_main_grid(MqMainMenu *main_menu) /* Set up the grid. */ grid = gtk_grid_new(); - NEW_BUTTON(0, 0, "zoom-out", "Zoom out"); - NEW_BUTTON(0, 1, "zoom-original", "Reset zoom"); - NEW_BUTTON(0, 2, "zoom-in", "Zoom in"); - - NEW_BUTTON(1, 0, "window-new", "New window"); - NEW_BUTTON(1, 1, "edit-find", "Find"); - NEW_BUTTON(1, 2, "view-fullscreen", "Full screen"); + NEW_BUTTON(0, 0, "window-new", "New window"); + NEW_BUTTON(0, 1, "edit-find", "Find"); + NEW_BUTTON(0, 2, "view-fullscreen", "Full screen"); - NEW_BUTTON(2, 0, "document-open", "Open file"); - NEW_BUTTON(2, 1, "document-save-as", "Save page"); - NEW_BUTTON(2, 2, "mail-message-new", "E-mail link"); + NEW_BUTTON(1, 0, "document-open", "Open file"); + NEW_BUTTON(1, 1, "document-save-as", "Save page"); + NEW_BUTTON(1, 2, "mail-message-new", "E-mail link"); - NEW_BUTTON(3, 0, "document-print-preview", "Print preview"); - NEW_BUTTON(3, 1, "document-print", "Print"); - NEW_BUTTON(3, 2, "preferences-system", "Inspector"); + NEW_BUTTON(2, 0, "document-print-preview", "Print preview"); + NEW_BUTTON(2, 1, "document-print", "Print"); + NEW_BUTTON(2, 2, "preferences-system", "Inspector"); - NEW_BUTTON(4, 0, "preferences-desktop", "Preferences"); - NEW_BUTTON(4, 1, "help-about", "About Marquee"); - NEW_BUTTON(4, 2, "application-exit", "Quit"); + NEW_BUTTON(3, 0, "preferences-desktop", "Preferences"); + NEW_BUTTON(3, 1, "help-about", "About Marquee"); + NEW_BUTTON(3, 2, "application-exit", "Quit"); - CLICKED_CB(0, 0, zoom_out_clicked_cb); - CLICKED_CB(0, 1, zoom_reset_clicked_cb); - CLICKED_CB(0, 2, zoom_in_clicked_cb); + CLICKED_CB(0, 0, new_window_clicked_cb); + CLICKED_CB(0, 1, find_clicked_cb); + CLICKED_CB(0, 2, fullscreen_clicked_cb); - CLICKED_CB(1, 0, new_window_clicked_cb); - CLICKED_CB(1, 1, find_clicked_cb); - CLICKED_CB(1, 2, fullscreen_clicked_cb); + CLICKED_CB(1, 0, open_clicked_cb); + CLICKED_CB(1, 1, save_clicked_cb); + /* TODO: 1, 2: E-mail link */ + gtk_widget_set_sensitive(buttons[1 * BUTTON_COLS + 2], FALSE); - CLICKED_CB(2, 0, open_clicked_cb); - CLICKED_CB(2, 1, save_clicked_cb); - /* TODO: 2, 2: E-mail link */ - gtk_widget_set_sensitive(buttons[2 * BUTTON_COLS + 2], FALSE); + /* TODO: 2, 0: Print preview */ + gtk_widget_set_sensitive(buttons[2 * BUTTON_COLS + 0], FALSE); + /* TODO: 2, 1: Print */ + gtk_widget_set_sensitive(buttons[2 * BUTTON_COLS + 1], FALSE); + CLICKED_CB(2, 2, inspector_clicked_cb); - /* TODO: 3, 0: Print preview */ - gtk_widget_set_sensitive(buttons[3 * BUTTON_COLS + 0], FALSE); - /* TODO: 3, 1: Print */ - gtk_widget_set_sensitive(buttons[3 * BUTTON_COLS + 1], FALSE); - CLICKED_CB(3, 2, inspector_clicked_cb); - - CLICKED_CB(4, 0, preferences_clicked_cb); - CLICKED_CB(4, 1, about_clicked_cb); - CLICKED_CB(4, 2, quit_clicked_cb); + CLICKED_CB(3, 0, preferences_clicked_cb); + CLICKED_CB(3, 1, about_clicked_cb); + CLICKED_CB(3, 2, quit_clicked_cb); return grid; } @@ -230,6 +254,8 @@ menu_clicked_cb(MqMainMenu *main_menu) box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); + gtk_box_pack_start(GTK_BOX(box), create_zoom_buttons(main_menu), + FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(box), create_main_grid(main_menu), FALSE, FALSE, 0); |