diff --git a/ChangeLog b/ChangeLog index cc8143eee3..40537fcceb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2006-05-25 Matthias Clasen + + * gtk/gtk.symbols: + * gtk/gtkstatusicon.h: + * gtk/gtkstatusicon.c (gtk_status_icon_get_geometry): + New function that can be used to e.g. position + notification bubbles wrt to the status icon. + (#341450, Christian Persch, Havoc Pennington) + 2006-05-25 Matthias Clasen Make GTK+ work as an untrusted X client. (#136571, diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index cc8143eee3..40537fcceb 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2006-05-25 Matthias Clasen + + * gtk/gtk.symbols: + * gtk/gtkstatusicon.h: + * gtk/gtkstatusicon.c (gtk_status_icon_get_geometry): + New function that can be used to e.g. position + notification bubbles wrt to the status icon. + (#341450, Christian Persch, Havoc Pennington) + 2006-05-25 Matthias Clasen Make GTK+ work as an untrusted X client. (#136571, diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 1f22ce49fc..0ca7c73c81 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,7 @@ +2006-05-25 Matthias Clasen + + * gtk/gtk-sections.txt: Updates + 2006-05-23 Matthias Clasen * gtk/gtk-sections.txt: Additions diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index fc1a843a10..cfdb2f497f 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -3242,6 +3242,8 @@ gtk_status_icon_set_blinking gtk_status_icon_get_blinking gtk_status_icon_is_embedded gtk_status_icon_position_menu +gtk_status_icon_get_geometry + GTK_TYPE_STATUS_ICON GTK_STATUS_ICON diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols index 088069a8bf..2f20fe5238 100644 --- a/gtk/gtk.symbols +++ b/gtk/gtk.symbols @@ -1065,6 +1065,7 @@ gtk_status_icon_set_blinking gtk_status_icon_get_blinking gtk_status_icon_is_embedded gtk_status_icon_position_menu +gtk_status_icon_get_geometry #endif #endif diff --git a/gtk/gtkstatusicon.c b/gtk/gtkstatusicon.c index 22a9395df4..61a62fc000 100755 --- a/gtk/gtkstatusicon.c +++ b/gtk/gtkstatusicon.c @@ -1631,5 +1631,60 @@ gtk_status_icon_position_menu (GtkMenu *menu, #endif /* GDK_WINDOWING_X11 */ } +/** + * gtk_status_icon_get_geometry: + * @status_icon: a #GtkStatusIcon + * @screen: return location for the screen + * @area: return location for the area occupied by the status icon + * @orientation: return location for the orientation of the panel + * in which the status icon is embedded. A panel at the top or + * bottom of the screen is horizontal, a panel at the left or + * right is vertical. + * + * Obtains information about the location of the status icon + * on screen. This information can be used to e.g. position + * popups like notification bubbles. + * See gtk_status_icon_position_menu() for a more convenient + * alternative for positioning menus. + * + * Note that some platforms do not allow GTK+ to provide + * this information. + * + * Return value: %TRUE if the location information has + * been filled in + * + * Since: 2.10 + */ +gboolean +gtk_status_icon_get_geometry (GtkStatusIcon *status_icon, + GdkScreen **screen, + GdkRectangle *area, + GtkOrientation *orientation) +{ +#ifdef GDK_WINDOWING_X11 + GtkWidget *widget; + GtkStatusIconPrivate *priv; + gint x, y; + + g_return_if_fail (GTK_IS_STATUS_ICON (status_icon)); + + priv = status_icon->priv; + widget = priv->tray_icon; + + *screen = gtk_widget_get_screen (widget); + gdk_window_get_origin (widget->window, &x, &y); + area->x = x; + area->y = y; + area->width = widget->allocation.width; + area->height = widget->allocation.height; + *orientation = _gtk_tray_icon_get_orientation (GTK_TRAY_ICON (widget)); + + return TRUE; +#else + return FALSE; +#endif /* GDK_WINDOWING_X11 */ +} + + #define __GTK_STATUS_ICON_C__ #include "gtkaliasdef.c" diff --git a/gtk/gtkstatusicon.h b/gtk/gtkstatusicon.h index 265b006e53..47b7d5be80 100755 --- a/gtk/gtkstatusicon.h +++ b/gtk/gtkstatusicon.h @@ -109,6 +109,10 @@ void gtk_status_icon_position_menu (GtkMenu *me gint *y, gboolean *push_in, gpointer user_data); +gboolean gtk_status_icon_get_geometry (GtkStatusIcon *status_icon, + GdkScreen **screen, + GdkRectangle *area, + GtkOrientation *orientation); G_END_DECLS