forked from AuroraMiddleware/gtk
headerbar: Fix fallback appmenu
We were using menubuttons here in a way that does not work anymore. Make it work again.
This commit is contained in:
parent
0740445d19
commit
f1fe54f337
@ -37,6 +37,7 @@
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkwindowprivate.h"
|
||||
#include "gtknative.h"
|
||||
#include "gtkmenubuttonprivate.h"
|
||||
|
||||
#include "a11y/gtkcontaineraccessible.h"
|
||||
|
||||
@ -388,7 +389,7 @@ _gtk_header_bar_update_window_buttons (GtkHeaderBar *bar)
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "titlebutton");
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (button), "appmenu");
|
||||
image = gtk_image_new ();
|
||||
gtk_container_add (GTK_CONTAINER (button), image);
|
||||
gtk_menu_button_add_child (GTK_MENU_BUTTON (button), image);
|
||||
gtk_widget_set_can_focus (button, FALSE);
|
||||
|
||||
accessible = gtk_widget_get_accessible (button);
|
||||
|
@ -1434,3 +1434,17 @@ gtk_menu_button_popdown (GtkMenuButton *menu_button)
|
||||
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_menu_button_add_child (GtkMenuButton *menu_button,
|
||||
GtkWidget *new_child)
|
||||
{
|
||||
GtkMenuButtonPrivate *priv = gtk_menu_button_get_instance_private (menu_button);
|
||||
GtkWidget *child;
|
||||
|
||||
child = gtk_bin_get_child (GTK_BIN (priv->button));
|
||||
if (child)
|
||||
gtk_container_remove (GTK_CONTAINER (priv->button), child);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (priv->button), new_child);
|
||||
}
|
||||
|
@ -32,6 +32,9 @@ void _gtk_menu_button_set_popup_with_func (GtkMenuButton *
|
||||
GtkMenuButtonShowMenuCallback func,
|
||||
gpointer user_data);
|
||||
|
||||
void gtk_menu_button_add_child (GtkMenuButton *button,
|
||||
GtkWidget *child);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_MENU_BUTTON_PRIVATE_H__ */
|
||||
|
@ -1657,12 +1657,20 @@ headerbar {
|
||||
min-height: 28px;
|
||||
padding: 4px;
|
||||
|
||||
button.titlebutton {
|
||||
button.titlebutton,
|
||||
menubutton.titlebutton {
|
||||
min-height: 26px;
|
||||
min-width: 26px;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
menubutton.titlebutton button {
|
||||
min-height: 20px;
|
||||
min-width: 20px;
|
||||
margin: 0;
|
||||
padding: 4px;
|
||||
}
|
||||
}
|
||||
|
||||
separator.titlebutton { opacity: 0; } /* hide the close button separator */
|
||||
|
Loading…
Reference in New Issue
Block a user