Commit 83a05b86 authored by Mohammed Sadiq's avatar Mohammed Sadiq
Browse files

panel: Hide power popover on tapping topbar when appropriate

If the user taps the power button or over other buttons,
hide power popover (if open) instead of hiding the panel.
But if the user taps on the top panel area (other than
the power button), hide the panel
parent f2550bf3
Pipeline #67091 passed with stages
in 46 minutes and 2 seconds
......@@ -43,6 +43,7 @@ static guint signals[N_SIGNALS] = { 0 };
typedef struct {
PhoshPanelState state;
GtkWidget *btn_power;
GtkWidget *menu_power;
GtkWidget *stack;
GtkWidget *box; /* main content box */
......@@ -252,10 +253,18 @@ on_key_press_event (PhoshPanel *self, GdkEventKey *event, gpointer data)
static gboolean
on_button_press_event (PhoshPanel *self, GdkEventKey *event, gpointer data)
on_button_press_event (PhoshPanel *self, GdkEventButton *event, gpointer data)
{
PhoshPanelPrivate *priv = phosh_panel_get_instance_private (self);
phosh_trigger_feedback ("button-pressed");
phosh_panel_fold (self);
if (gtk_widget_is_visible (priv->menu_power) &&
event->window != gtk_widget_get_window (priv->btn_power))
gtk_popover_popdown (GTK_POPOVER (priv->menu_power));
else
phosh_panel_fold (self);
return FALSE;
}
......@@ -378,6 +387,7 @@ phosh_panel_class_init (PhoshPanelClass *klass)
gtk_widget_class_set_template_from_resource (widget_class,
"/sm/puri/phosh/ui/top-panel.ui");
gtk_widget_class_bind_template_child_private (widget_class, PhoshPanel, btn_power);
gtk_widget_class_bind_template_child_private (widget_class, PhoshPanel, menu_power);
gtk_widget_class_bind_template_child_private (widget_class, PhoshPanel, btn_top_panel);
gtk_widget_class_bind_template_child_private (widget_class, PhoshPanel, lbl_clock);
......
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