mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-17 14:30:15 +00:00
popover: Use element name
Pick "popover" and add .menu for popover menus
This commit is contained in:
parent
50c6a11b05
commit
33ac663b13
@ -71,6 +71,10 @@
|
||||
* </section>
|
||||
* ]|
|
||||
*
|
||||
* A popover has a single css node called "popover" and gets the
|
||||
* .menu style class in case it has been created using
|
||||
* gtk_popover_new_from_model.
|
||||
*
|
||||
* Since: 3.12
|
||||
*/
|
||||
|
||||
@ -180,7 +184,6 @@ static void
|
||||
gtk_popover_init (GtkPopover *popover)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
GtkStyleContext *context;
|
||||
|
||||
widget = GTK_WIDGET (popover);
|
||||
gtk_widget_set_has_window (widget, TRUE);
|
||||
@ -188,10 +191,6 @@ gtk_popover_init (GtkPopover *popover)
|
||||
popover->priv->modal = TRUE;
|
||||
popover->priv->tick_id = 0;
|
||||
popover->priv->transitions_enabled = TRUE;
|
||||
|
||||
context = gtk_widget_get_style_context (widget);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_BACKGROUND);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_POPOVER);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1694,6 +1693,7 @@ gtk_popover_class_init (GtkPopoverClass *klass)
|
||||
|
||||
quark_widget_popovers = g_quark_from_static_string ("gtk-quark-widget-popovers");
|
||||
gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_POPOVER_ACCESSIBLE);
|
||||
gtk_widget_class_set_css_name (widget_class, "popover");
|
||||
}
|
||||
|
||||
static void
|
||||
@ -2397,6 +2397,7 @@ gtk_popover_new_from_model (GtkWidget *relative_to,
|
||||
GMenuModel *model)
|
||||
{
|
||||
GtkWidget *popover;
|
||||
GtkStyleContext *style_context;
|
||||
|
||||
g_return_val_if_fail (relative_to == NULL || GTK_IS_WIDGET (relative_to), NULL);
|
||||
g_return_val_if_fail (G_IS_MENU_MODEL (model), NULL);
|
||||
@ -2404,6 +2405,9 @@ gtk_popover_new_from_model (GtkWidget *relative_to,
|
||||
popover = gtk_popover_new (relative_to);
|
||||
gtk_popover_bind_model (GTK_POPOVER (popover), model, NULL);
|
||||
|
||||
style_context = gtk_widget_get_style_context (GTK_WIDGET (popover));
|
||||
gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_MENU);
|
||||
|
||||
return popover;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "config.h"
|
||||
#include "gtkpopovermenu.h"
|
||||
#include "gtkstack.h"
|
||||
#include "gtkstylecontext.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
|
||||
@ -94,7 +95,10 @@
|
||||
* </child>
|
||||
* </object>
|
||||
* ]|
|
||||
*
|
||||
*
|
||||
* Just like normal popovers created using gtk_popover_new_from_model,
|
||||
* #GtkPopoverMenu instances have a single css node called "popover"
|
||||
* and get the .menu style class.
|
||||
*/
|
||||
|
||||
struct _GtkPopoverMenu
|
||||
@ -125,6 +129,7 @@ static void
|
||||
gtk_popover_menu_init (GtkPopoverMenu *popover)
|
||||
{
|
||||
GtkWidget *stack;
|
||||
GtkStyleContext *style_context;
|
||||
|
||||
stack = gtk_stack_new ();
|
||||
gtk_stack_set_vhomogeneous (GTK_STACK (stack), FALSE);
|
||||
@ -134,6 +139,9 @@ gtk_popover_menu_init (GtkPopoverMenu *popover)
|
||||
gtk_container_add (GTK_CONTAINER (popover), stack);
|
||||
g_signal_connect (stack, "notify::visible-child-name",
|
||||
G_CALLBACK (visible_submenu_changed), popover);
|
||||
|
||||
style_context = gtk_widget_get_style_context (GTK_WIDGET (popover));
|
||||
gtk_style_context_add_class (style_context, GTK_STYLE_CLASS_MENU);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1512,7 +1512,7 @@ column-header.button.dnd { // for treeview-like derive widgets
|
||||
* Popovers *
|
||||
***************/
|
||||
|
||||
.popover {
|
||||
popover {
|
||||
padding: 2px;
|
||||
border: 1px solid $borders_color;
|
||||
border-radius: 5px;
|
||||
|
@ -1175,7 +1175,7 @@ GtkTreeView.view.progressbar { //Progressbar in treeview cells
|
||||
* Popovers *
|
||||
***************/
|
||||
|
||||
.popover {
|
||||
popover {
|
||||
margin: 10px;
|
||||
padding: 2px;
|
||||
border-color: $borders-color;
|
||||
|
Loading…
Reference in New Issue
Block a user