Commit 2b6064b9 authored by Guido Gunther's avatar Guido Gunther

panel: allow to query height

so we can use it for usable area calculations
parent f14416f2
...@@ -27,6 +27,7 @@ static guint signals[N_SIGNALS] = { 0 }; ...@@ -27,6 +27,7 @@ static guint signals[N_SIGNALS] = { 0 };
struct PhoshPanelPrivate { struct PhoshPanelPrivate {
GtkWidget *btn_favorites; GtkWidget *btn_favorites;
GtkWidget *btn_settings; GtkWidget *btn_settings;
gint height;
GnomeWallClock *wall_clock; GnomeWallClock *wall_clock;
}; };
...@@ -70,6 +71,15 @@ wall_clock_notify_cb (GnomeWallClock *wall_clock, ...@@ -70,6 +71,15 @@ wall_clock_notify_cb (GnomeWallClock *wall_clock,
} }
static void
size_allocated_cb (PhoshPanel *self, gpointer unused)
{
gint width;
PhoshPanelPrivate *priv = phosh_panel_get_instance_private (self);
gtk_window_get_size (GTK_WINDOW (self), &width, &priv->height);
}
static void static void
phosh_panel_constructed (GObject *object) phosh_panel_constructed (GObject *object)
{ {
...@@ -96,6 +106,10 @@ phosh_panel_constructed (GObject *object) ...@@ -96,6 +106,10 @@ phosh_panel_constructed (GObject *object)
G_CALLBACK (settings_clicked_cb), G_CALLBACK (settings_clicked_cb),
self, self,
G_CONNECT_SWAPPED); G_CONNECT_SWAPPED);
g_signal_connect (self,
"size-allocate",
G_CALLBACK (size_allocated_cb),
NULL);
/* window properties */ /* window properties */
gtk_window_set_title (GTK_WINDOW (self), "phosh panel"); gtk_window_set_title (GTK_WINDOW (self), "phosh panel");
...@@ -169,3 +183,11 @@ phosh_panel_new (void) ...@@ -169,3 +183,11 @@ phosh_panel_new (void)
return g_object_new (PHOSH_PANEL_TYPE, return g_object_new (PHOSH_PANEL_TYPE,
NULL); NULL);
} }
gint
phosh_panel_get_height (PhoshPanel *self)
{
PhoshPanelPrivate *priv = phosh_panel_get_instance_private (self);
return priv->height;
}
...@@ -35,5 +35,6 @@ struct PhoshPanelClass ...@@ -35,5 +35,6 @@ struct PhoshPanelClass
GType phosh_panel_get_type (void) G_GNUC_CONST; GType phosh_panel_get_type (void) G_GNUC_CONST;
GtkWidget * phosh_panel_new (void); GtkWidget * phosh_panel_new (void);
gint phosh_panel_get_height (PhoshPanel *self);
#endif /* PHOSH_PANEL_H */ #endif /* PHOSH_PANEL_H */
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