ui/gtk/headerbar.c

changeset 46
31bc86844659
parent 45
ab71409644b0
child 51
e324291ca9f8
equal deleted inserted replaced
45:ab71409644b0 46:31bc86844659
56 CxList *center_defaults = uic_get_toolbar_defaults(UI_TOOLBAR_CENTER); 56 CxList *center_defaults = uic_get_toolbar_defaults(UI_TOOLBAR_CENTER);
57 CxList *right_defaults = uic_get_toolbar_defaults(UI_TOOLBAR_RIGHT); 57 CxList *right_defaults = uic_get_toolbar_defaults(UI_TOOLBAR_RIGHT);
58 58
59 ui_headerbar_add_items(obj, headerbar, left_defaults, UI_TOOLBAR_LEFT); 59 ui_headerbar_add_items(obj, headerbar, left_defaults, UI_TOOLBAR_LEFT);
60 ui_headerbar_add_items(obj, headerbar, center_defaults, UI_TOOLBAR_CENTER); 60 ui_headerbar_add_items(obj, headerbar, center_defaults, UI_TOOLBAR_CENTER);
61
62 UiToolbarMenuItem *appmenu = uic_get_appmenu();
63 if(appmenu) {
64 ui_add_headerbar_menu(headerbar, NULL, appmenu, obj, UI_TOOLBAR_RIGHT);
65 }
61 ui_headerbar_add_items(obj, headerbar, right_defaults, UI_TOOLBAR_RIGHT); 66 ui_headerbar_add_items(obj, headerbar, right_defaults, UI_TOOLBAR_RIGHT);
62 } 67 }
63 68
64 static void create_item(UiObject *obj, GtkWidget *headerbar, GtkWidget *box, UiToolbarItemI *i, enum UiToolbarPos pos) { 69 static void create_item(UiObject *obj, GtkWidget *headerbar, GtkWidget *box, UiToolbarItemI *i, enum UiToolbarPos pos) {
65 switch(i->type) { 70 switch(i->type) {
161 } 166 }
162 if(item->args.icon) { 167 if(item->args.icon) {
163 gtk_menu_button_set_icon_name(GTK_MENU_BUTTON(menubutton), item->args.icon); 168 gtk_menu_button_set_icon_name(GTK_MENU_BUTTON(menubutton), item->args.icon);
164 } 169 }
165 170
171 if(!item->args.label && !item->args.icon) {
172 gtk_menu_button_set_icon_name(GTK_MENU_BUTTON(menubutton), "open-menu-symbolic");
173 }
174
166 GMenu *menu = g_menu_new(); 175 GMenu *menu = g_menu_new();
167 ui_gmenu_add_menu_items(menu, 0, &item->menu, obj); 176 ui_gmenu_add_menu_items(menu, 0, &item->menu, obj);
168 177
169 gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(menubutton), G_MENU_MODEL(menu)); 178 gtk_menu_button_set_menu_model(GTK_MENU_BUTTON(menubutton), G_MENU_MODEL(menu));
170 #else 179 #else

mercurial