| 163 UiObject *obj, |
163 UiObject *obj, |
| 164 enum UiToolbarPos pos) |
164 enum UiToolbarPos pos) |
| 165 { |
165 { |
| 166 GtkWidget *button = ui_create_button(obj, item->args.label, item->args.icon, item->args.tooltip, item->args.onclick, item->args.onclickdata, 0, FALSE); |
166 GtkWidget *button = ui_create_button(obj, item->args.label, item->args.icon, item->args.tooltip, item->args.onclick, item->args.onclickdata, 0, FALSE); |
| 167 ui_set_widget_groups(obj->ctx, button, item->args.groups); |
167 ui_set_widget_groups(obj->ctx, button, item->args.groups); |
| |
168 ui_set_widget_visibility_states(obj->ctx, button, item->args.visibility_states); |
| 168 WIDGET_ADD_CSS_CLASS(button, "flat"); |
169 WIDGET_ADD_CSS_CLASS(button, "flat"); |
| 169 headerbar_add(headerbar, box, button, pos); |
170 headerbar_add(headerbar, box, button, pos); |
| 170 } |
171 } |
| 171 |
172 |
| 172 void ui_add_headerbar_toggleitem( |
173 void ui_add_headerbar_toggleitem( |
| 176 UiObject *obj, |
177 UiObject *obj, |
| 177 enum UiToolbarPos pos) |
178 enum UiToolbarPos pos) |
| 178 { |
179 { |
| 179 GtkWidget *button = gtk_toggle_button_new(); |
180 GtkWidget *button = gtk_toggle_button_new(); |
| 180 ui_set_widget_groups(obj->ctx, button, item->args.groups); |
181 ui_set_widget_groups(obj->ctx, button, item->args.groups); |
| |
182 ui_set_widget_visibility_states(obj->ctx, button, item->args.visibility_states); |
| 181 WIDGET_ADD_CSS_CLASS(button, "flat"); |
183 WIDGET_ADD_CSS_CLASS(button, "flat"); |
| 182 ui_setup_togglebutton(obj, button, item->args.label, item->args.icon, item->args.tooltip, item->args.varname, NULL, item->args.onchange, item->args.onchangedata, 0); |
184 ui_setup_togglebutton(obj, button, item->args.label, item->args.icon, item->args.tooltip, item->args.varname, NULL, item->args.onchange, item->args.onchangedata, 0); |
| 183 headerbar_add(headerbar, box, button, pos); |
185 headerbar_add(headerbar, box, button, pos); |
| 184 } |
186 } |
| 185 |
187 |
| 192 { |
194 { |
| 193 |
195 |
| 194 |
196 |
| 195 #if GTK_MAJOR_VERSION >= 4 |
197 #if GTK_MAJOR_VERSION >= 4 |
| 196 GtkWidget *menubutton = gtk_menu_button_new(); |
198 GtkWidget *menubutton = gtk_menu_button_new(); |
| |
199 ui_set_widget_visibility_states(obj->ctx, menubutton, item->args.visibility_states); |
| 197 if(item->args.label) { |
200 if(item->args.label) { |
| 198 gtk_menu_button_set_label(GTK_MENU_BUTTON(menubutton), item->args.label); |
201 gtk_menu_button_set_label(GTK_MENU_BUTTON(menubutton), item->args.label); |
| 199 } |
202 } |
| 200 if(item->args.icon) { |
203 if(item->args.icon) { |
| 201 gtk_menu_button_set_icon_name(GTK_MENU_BUTTON(menubutton), item->args.icon); |
204 gtk_menu_button_set_icon_name(GTK_MENU_BUTTON(menubutton), item->args.icon); |