diff options
author | Matthias Clasen <mclasen@redhat.com> | 2010-05-10 15:26:44 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2010-05-10 15:26:44 +0100 |
commit | a4d4b54a7dab25b7ca894a90f89064400137718b (patch) | |
tree | 75211aa6c04752cb48a914f4011105e00a19dcb5 /gtk/gtkstatusicon.c | |
parent | 88f41f10ad29271f52854688be117ef3e6e52a3b (diff) | |
download | gtk+-a4d4b54a7dab25b7ca894a90f89064400137718b.tar.gz |
Add padding around the status icons
The amount of padding is determined by reading a _NET_SYSTEM_TRAY_PADDING
property off the manager window, in the same way that orientation and visual
are obtained.
Signed-off-by: Richard Hughes <richard@hughsie.com>
Diffstat (limited to 'gtk/gtkstatusicon.c')
-rw-r--r-- | gtk/gtkstatusicon.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c index e6ec4057b8..8e4ebe633c 100644 --- a/gtk/gtkstatusicon.c +++ b/gtk/gtkstatusicon.c @@ -170,6 +170,7 @@ static void gtk_status_icon_screen_changed (GtkStatusIcon *status_icon, GdkScreen *old_screen); static void gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon); static void gtk_status_icon_orientation_changed (GtkStatusIcon *status_icon); +static void gtk_status_icon_padding_changed (GtkStatusIcon *status_icon); static void gtk_status_icon_fg_changed (GtkStatusIcon *status_icon); static void gtk_status_icon_color_changed (GtkTrayIcon *tray, GParamSpec *pspec, @@ -854,6 +855,8 @@ gtk_status_icon_init (GtkStatusIcon *status_icon) G_CALLBACK (gtk_status_icon_embedded_changed), status_icon); g_signal_connect_swapped (priv->tray_icon, "notify::orientation", G_CALLBACK (gtk_status_icon_orientation_changed), status_icon); + g_signal_connect_swapped (priv->tray_icon, "notify::padding", + G_CALLBACK (gtk_status_icon_padding_changed), status_icon); g_signal_connect_swapped (priv->tray_icon, "notify::fg-color", G_CALLBACK (gtk_status_icon_fg_changed), status_icon); g_signal_connect (priv->tray_icon, "notify::error-color", @@ -987,6 +990,8 @@ gtk_status_icon_finalize (GObject *object) g_signal_handlers_disconnect_by_func (priv->tray_icon, gtk_status_icon_orientation_changed, status_icon); g_signal_handlers_disconnect_by_func (priv->tray_icon, + gtk_status_icon_padding_changed, status_icon); + g_signal_handlers_disconnect_by_func (priv->tray_icon, gtk_status_icon_fg_changed, status_icon); g_signal_handlers_disconnect_by_func (priv->tray_icon, gtk_status_icon_color_changed, status_icon); @@ -1695,14 +1700,32 @@ gtk_status_icon_screen_changed (GtkStatusIcon *status_icon, #ifdef GDK_WINDOWING_X11 static void +gtk_status_icon_padding_changed (GtkStatusIcon *status_icon) +{ + GtkStatusIconPrivate *priv = status_icon->priv; + GtkOrientation orientation; + gint padding; + + orientation = _gtk_tray_icon_get_orientation (GTK_TRAY_ICON (priv->tray_icon)); + padding = _gtk_tray_icon_get_padding (GTK_TRAY_ICON (priv->tray_icon)); + + if (orientation == GTK_ORIENTATION_HORIZONTAL) + gtk_misc_set_padding (GTK_MISC (priv->image), padding, 0); + else + gtk_misc_set_padding (GTK_MISC (priv->image), 0, padding); +} + +static void gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon) { + gtk_status_icon_padding_changed (status_icon); g_object_notify (G_OBJECT (status_icon), "embedded"); } static void gtk_status_icon_orientation_changed (GtkStatusIcon *status_icon) { + gtk_status_icon_padding_changed (status_icon); g_object_notify (G_OBJECT (status_icon), "orientation"); } |