Commit 67f152a4 authored by Christian Hergert's avatar Christian Hergert
Browse files

omnibar: add support for omnibar:active state flag

parent 370ca961
......@@ -151,7 +151,8 @@ omnibar entry {
background-color: @theme_bg_color;
color: alpha(@theme_fg_color, 0.8);
}
omnibar:hover entry {
omnibar:hover entry,
omnibar:active entry {
background-color: mix(@theme_bg_color, @content_view_bg, 0.9);
color: @theme_fg_color;
}
......
......@@ -476,12 +476,35 @@ multipress_pressed_cb (GtkGestureMultiPress *gesture,
gdouble y,
IdeOmniBar *self)
{
GtkStyleContext *style_context;
GtkStateFlags state_flags;
g_assert (IDE_IS_OMNI_BAR (self));
gtk_widget_show (GTK_WIDGET (self->popover));
style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
state_flags = gtk_style_context_get_state (style_context);
gtk_style_context_set_state (style_context, state_flags | GTK_STATE_FLAG_ACTIVE);
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
}
static void
ide_omni_bar_popover_closed (IdeOmniBar *self,
GtkPopover *popover)
{
GtkStyleContext *style_context;
GtkStateFlags state_flags;
g_assert (IDE_IS_OMNI_BAR (self));
g_assert (GTK_IS_POPOVER (popover));
style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
state_flags = gtk_style_context_get_state (style_context);
gtk_style_context_set_state (style_context, state_flags & ~GTK_STATE_FLAG_ACTIVE);
}
static void
ide_omni_bar_finalize (GObject *object)
{
......@@ -556,6 +579,12 @@ ide_omni_bar_init (IdeOmniBar *self)
self,
G_CONNECT_SWAPPED);
g_signal_connect_object (self->popover,
"closed",
G_CALLBACK (ide_omni_bar_popover_closed),
self,
G_CONNECT_SWAPPED);
self->gesture = gtk_gesture_multi_press_new (GTK_WIDGET (self->event_box));
g_signal_connect (self->gesture, "pressed", G_CALLBACK (multipress_pressed_cb), self);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment