diff options
author | Matthias Clasen <mclasen@redhat.com> | 2006-12-22 07:18:21 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2006-12-22 07:18:21 +0000 |
commit | d9a6a829ce282ab60ef1b13834616eb257782975 (patch) | |
tree | 0863914f15cc94a81de01449ec4137133f32d793 /gtk/gtkstatusicon.c | |
parent | 33153bec3679e9013bbcb819bc8b028cc4190ce0 (diff) | |
download | gtk+-d9a6a829ce282ab60ef1b13834616eb257782975.tar.gz |
Make it possible to track the embeddedness of statusicon (#387215, Martyn
2006-12-22 Matthias Clasen <mclasen@redhat.com>
Make it possible to track the embeddedness of
statusicon (#387215, Martyn Russell, patch by Christian
Persch)
* gtk/gtkstatusicon.c: Add orientation and embedded properties.
* gtk/gtkplug.c:
* gtk/gtkplug-x11.c: Add an embedded property.
* tests/teststatusicon.c: Test the new properties.
Diffstat (limited to 'gtk/gtkstatusicon.c')
-rwxr-xr-x | gtk/gtkstatusicon.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c index b507e3c1f8..f9d5215f70 100755 --- a/gtk/gtkstatusicon.c +++ b/gtk/gtkstatusicon.c @@ -69,6 +69,8 @@ enum PROP_SIZE, PROP_SCREEN, PROP_VISIBLE, + PROP_ORIENTATION, + PROP_EMBEDDED, PROP_BLINKING }; @@ -141,6 +143,9 @@ static void gtk_status_icon_size_allocate (GtkStatusIcon *status_icon, GtkAllocation *allocation); 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); + #endif static gboolean gtk_status_icon_button_press (GtkStatusIcon *status_icon, GdkEventButton *event); @@ -236,6 +241,39 @@ gtk_status_icon_class_init (GtkStatusIconClass *class) /** + * GtkStatusIcon:embedded: + * + * %TRUE if the statusicon is embedded in a notification area. + * + * Since: 2.12 + */ + g_object_class_install_property (gobject_class, + PROP_EMBEDDED, + g_param_spec_boolean ("embedded", + P_("Embedded"), + P_("Whether or not the status icon is embedded"), + FALSE, + GTK_PARAM_READABLE)); + + /** + * GtkStatusIcon:orientation: + * + * The orientation of the tray in which the statusicon + * is embedded. + * + * Since: 2.12 + */ + g_object_class_install_property (gobject_class, + PROP_ORIENTATION, + g_param_spec_enum ("orientation", + P_("Orientation"), + P_("The orientation of the tray"), + GTK_TYPE_ORIENTATION, + GTK_ORIENTATION_HORIZONTAL, + GTK_PARAM_READABLE)); + + + /** * GtkStatusIcon::activate: * @status_icon: the object which received the signal * @@ -427,6 +465,10 @@ gtk_status_icon_init (GtkStatusIcon *status_icon) gtk_widget_add_events (GTK_WIDGET (priv->tray_icon), GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK); + g_signal_connect_swapped (priv->tray_icon, "notify::embedded", + 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, "button-press-event", G_CALLBACK (gtk_status_icon_button_press), status_icon); g_signal_connect_swapped (priv->tray_icon, "screen-changed", @@ -623,6 +665,12 @@ gtk_status_icon_get_property (GObject *object, case PROP_VISIBLE: g_value_set_boolean (value, gtk_status_icon_get_visible (status_icon)); break; + case PROP_EMBEDDED: + g_value_set_boolean (value, gtk_status_icon_is_embedded (status_icon)); + break; + case PROP_ORIENTATION: + g_value_set_enum (value, _gtk_tray_icon_get_orientation (status_icon->priv->tray_icon)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1076,6 +1124,18 @@ gtk_status_icon_screen_changed (GtkStatusIcon *status_icon, #endif +static void +gtk_status_icon_embedded_changed (GtkStatusIcon *status_icon) +{ + g_object_notify (G_OBJECT (status_icon), "embedded"); +} + +static void +gtk_status_icon_orientation_changed (GtkStatusIcon *status_icon) +{ + g_object_notify (G_OBJECT (status_icon), "orientation"); +} + static gboolean gtk_status_icon_button_press (GtkStatusIcon *status_icon, GdkEventButton *event) |