[deskbar-applet] Use accessor functions so it compiles with -DGSEAL_ENABLE
- From: Sebastian Polsterl <sebp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [deskbar-applet] Use accessor functions so it compiles with -DGSEAL_ENABLE
- Date: Fri, 16 Apr 2010 13:19:25 +0000 (UTC)
commit 3976a5f27161be89f2d51d0b6d8c9e62778d4cff
Author: Sebastian Pölsterl <sebp k-d-w org>
Date: Fri Apr 16 15:17:00 2010 +0200
Use accessor functions so it compiles with -DGSEAL_ENABLE
Additionally, no deprecated symbols are used anymore.
Fixes bug #615394 and bug #615555.
deskbar/ui/iconentry/ephy-icon-entry.c | 103 +++++++++++++++++++------------
1 files changed, 63 insertions(+), 40 deletions(-)
---
diff --git a/deskbar/ui/iconentry/ephy-icon-entry.c b/deskbar/ui/iconentry/ephy-icon-entry.c
index 3c804e2..85a79db 100644
--- a/deskbar/ui/iconentry/ephy-icon-entry.c
+++ b/deskbar/ui/iconentry/ephy-icon-entry.c
@@ -64,16 +64,18 @@ ephy_icon_entry_get_borders (GtkWidget *widget,
{
int focus_width;
gboolean interior_focus;
+ GtkStyle *style;
- g_return_if_fail (entry->style != NULL);
+ style = gtk_widget_get_style (entry);
+ g_return_if_fail (style != NULL);
gtk_widget_style_get (entry,
"focus-line-width", &focus_width,
"interior-focus", &interior_focus,
NULL);
- *xborder = entry->style->xthickness;
- *yborder = entry->style->ythickness;
+ *xborder = style->xthickness;
+ *yborder = style->ythickness;
if (!interior_focus)
{
@@ -90,15 +92,19 @@ ephy_icon_entry_paint (GtkWidget *widget,
GtkWidget *entry_widget = entry->entry;
int x = 0, y = 0, width, height, focus_width;
gboolean interior_focus;
+ GdkWindow *window;
+ GtkStyle *style;
gtk_widget_style_get (entry_widget,
"interior-focus", &interior_focus,
"focus-line-width", &focus_width,
NULL);
- gdk_drawable_get_size (widget->window, &width, &height);
+ window = gtk_widget_get_window (widget);
- if (GTK_WIDGET_HAS_FOCUS (entry_widget) && !interior_focus)
+ gdk_drawable_get_size (window, &width, &height);
+
+ if (gtk_widget_has_focus (entry_widget) && !interior_focus)
{
x += focus_width;
y += focus_width;
@@ -106,26 +112,28 @@ ephy_icon_entry_paint (GtkWidget *widget,
height -= 2 * focus_width;
}
- gtk_paint_flat_box (entry_widget->style, widget->window,
- GTK_WIDGET_STATE (entry_widget), GTK_SHADOW_NONE,
+ style = gtk_widget_get_style (entry_widget);
+
+ gtk_paint_flat_box (style, window,
+ gtk_widget_get_state (entry_widget), GTK_SHADOW_NONE,
NULL, entry_widget, "entry_bg",
/* FIXME: was 0, 0 in gtk_entry_expose, but I think this is correct: */
x, y, width, height);
- gtk_paint_shadow (entry_widget->style, widget->window,
+ gtk_paint_shadow (style, window,
GTK_STATE_NORMAL, GTK_SHADOW_IN,
NULL, entry_widget, "entry",
x, y, width, height);
- if (GTK_WIDGET_HAS_FOCUS (entry_widget) && !interior_focus)
+ if (gtk_widget_has_focus (entry_widget) && !interior_focus)
{
x -= focus_width;
y -= focus_width;
width += 2 * focus_width;
height += 2 * focus_width;
- gtk_paint_focus (entry_widget->style, widget->window,
- GTK_WIDGET_STATE (entry_widget),
+ gtk_paint_focus (style, window,
+ gtk_widget_get_state (entry_widget),
NULL, entry_widget, "entry",
/* FIXME: was 0, 0 in gtk_entry_draw_frame, but I think this is correct: */
x, y, width, height);
@@ -142,7 +150,7 @@ ephy_icon_entry_init (EphyIconEntry *entry)
priv = entry->priv = EPHY_ICON_ENTRY_GET_PRIVATE (entry);
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_NO_WINDOW);
+ gtk_widget_set_has_window (widget, TRUE);
gtk_container_set_border_width (GTK_CONTAINER (entry), 0);
@@ -168,15 +176,19 @@ ephy_icon_entry_realize (GtkWidget *widget)
GdkWindowAttr attributes;
gint attributes_mask;
gint border_width;
+ GtkAllocation widget_allocation;
+ GdkWindow *window;
+
+ gtk_widget_set_realized (widget, TRUE);
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- border_width = GTK_CONTAINER (widget)->border_width;
+ gtk_widget_get_allocation (widget, &widget_allocation);
- attributes.x = widget->allocation.x + border_width;
- attributes.y = widget->allocation.y + border_width;
- attributes.width = widget->allocation.width - 2 * border_width;
- attributes.height = widget->allocation.height - 2 * border_width;
+ attributes.x = widget_allocation.x + border_width;
+ attributes.y = widget_allocation.y + border_width;
+ attributes.width = widget_allocation.width - 2 * border_width;
+ attributes.height = widget_allocation.height - 2 * border_width;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget)
| GDK_EXPOSURE_MASK;
@@ -186,13 +198,16 @@ ephy_icon_entry_realize (GtkWidget *widget)
attributes.wclass = GDK_INPUT_OUTPUT;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
+ gtk_widget_set_window (widget, window);
- widget->style = gtk_style_attach (widget->style, widget->window);
+ gdk_window_set_user_data (window, widget);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ gtk_widget_style_attach (widget);
+
+ gtk_style_set_background (gtk_widget_get_style (widget),
+ window, GTK_STATE_NORMAL);
}
static void
@@ -203,17 +218,20 @@ ephy_icon_entry_size_request (GtkWidget *widget,
GtkContainer *container = GTK_CONTAINER (widget);
GtkBin *bin = GTK_BIN (widget);
int xborder, yborder;
+ GtkWidget *child;
- requisition->width = requisition->height = container->border_width * 2;
+ requisition->width = requisition->height = gtk_container_get_border_width (container) * 2;
gtk_widget_ensure_style (entry->entry);
ephy_icon_entry_get_borders (widget, entry->entry, &xborder, &yborder);
- if (GTK_WIDGET_VISIBLE (bin->child))
+ child = gtk_bin_get_child (bin);
+
+ if (gtk_widget_get_visible (child))
{
GtkRequisition child_requisition;
- gtk_widget_size_request (bin->child, &child_requisition);
+ gtk_widget_size_request (child, &child_requisition);
requisition->width += child_requisition.width;
requisition->height += child_requisition.height;
}
@@ -232,19 +250,22 @@ ephy_icon_entry_size_allocate (GtkWidget *widget,
GtkAllocation child_allocation;
GtkRequisition requisition;
int xborder, yborder;
+ guint container_border_width;
+ GtkAllocation widget_allocation;
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
+ container_border_width = gtk_container_get_border_width (container);
ephy_icon_entry_get_borders (widget, entry->entry, &xborder, &yborder);
- if (GTK_WIDGET_REALIZED (widget))
+ if (gtk_widget_get_realized (widget))
{
- child_allocation.x = container->border_width;
- child_allocation.y = container->border_width;
- child_allocation.width = MAX (allocation->width - container->border_width * 2, 0);
- child_allocation.height = MAX (allocation->height - container->border_width * 2, 0);
+ child_allocation.x = container_border_width;
+ child_allocation.y = container_border_width;
+ child_allocation.width = MAX (allocation->width - container_border_width * 2, 0);
+ child_allocation.height = MAX (allocation->height - container_border_width * 2, 0);
- gdk_window_move_resize (widget->window,
+ gdk_window_move_resize (gtk_widget_get_window (widget),
allocation->x + child_allocation.x,
allocation->y + child_allocation.y,
child_allocation.width,
@@ -253,11 +274,13 @@ ephy_icon_entry_size_allocate (GtkWidget *widget,
gtk_widget_get_child_requisition (widget, &requisition);
- child_allocation.x = container->border_width + xborder;
- child_allocation.y = container->border_width + yborder
- + (widget->allocation.height - requisition.height) / 2;
- child_allocation.width = MAX (allocation->width - (container->border_width + xborder) * 2, 0);
- child_allocation.height = MAX (allocation->height - (container->border_width + yborder) * 2, 0);
+ gtk_widget_get_allocation (widget, &widget_allocation);
+
+ child_allocation.x = container_border_width + xborder;
+ child_allocation.y = container_border_width + yborder
+ + (widget_allocation.height - requisition.height) / 2;
+ child_allocation.width = MAX (allocation->width - (container_border_width + xborder) * 2, 0);
+ child_allocation.height = MAX (allocation->height - (container_border_width + yborder) * 2, 0);
/* We have to set the size requisition on the GtkEntry explicitly,
* since otherwise it'll end up too tall if someone uses
@@ -267,15 +290,15 @@ ephy_icon_entry_size_allocate (GtkWidget *widget,
*/
gtk_widget_set_size_request (entry->entry, -1, child_allocation.height);
- gtk_widget_size_allocate (bin->child, &child_allocation);
+ gtk_widget_size_allocate (gtk_bin_get_child (bin), &child_allocation);
}
static gboolean
ephy_icon_entry_expose (GtkWidget *widget,
GdkEventExpose *event)
{
- if (GTK_WIDGET_DRAWABLE (widget) &&
- event->window == widget->window)
+ if (gtk_widget_is_drawable (widget) &&
+ event->window == gtk_widget_get_window (widget))
{
ephy_icon_entry_paint (widget, event);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]