[Xfce4-commits] <xfce4-panel:nick/gtk3> Some porting to gtk3.

Nick Schermer noreply at xfce.org
Sun Mar 17 13:38:07 CET 2013


Updating branch refs/heads/nick/gtk3
         to 12c8c133f9a08d350987f01ef3ada7824708a254 (commit)
       from 5fbae9e7610c038015d0bbb2bed50b5493c700a2 (commit)

commit 12c8c133f9a08d350987f01ef3ada7824708a254
Author: Nick Schermer <nick at xfce.org>
Date:   Tue Feb 5 19:06:10 2013 +0100

    Some porting to gtk3.

 common/panel-utils.c                   |    5 +
 libxfce4panel/xfce-arrow-button.c      |   61 ++++++++------
 libxfce4panel/xfce-panel-convenience.c |    6 +-
 libxfce4panel/xfce-panel-image.c       |  144 +++++++++++++++++--------------
 libxfce4panel/xfce-panel-macros-46.h   |    6 +-
 libxfce4panel/xfce-panel-plugin.c      |   23 +++--
 panel/panel-dialogs.c                  |    4 +
 panel/panel-itembar.c                  |    2 +-
 plugins/systray/systray-box.c          |    2 +-
 plugins/tasklist/tasklist-widget.c     |    2 +-
 10 files changed, 146 insertions(+), 109 deletions(-)

diff --git a/common/panel-utils.c b/common/panel-utils.c
index be76c9b..3f596cc 100644
--- a/common/panel-utils.c
+++ b/common/panel-utils.c
@@ -121,6 +121,10 @@ panel_utils_show_help (GtkWindow   *parent,
 gboolean
 panel_utils_grab_available (void)
 {
+#if GTK_CHECK_VERSION (3, 0, 0)
+  /* TODO fix for gtk3 */
+  return TRUE;
+#else
   GdkScreen     *screen;
   GdkWindow     *root;
   GdkGrabStatus  grab_pointer = GDK_GRAB_FROZEN;
@@ -165,6 +169,7 @@ panel_utils_grab_available (void)
     }
 
   return grab_succeed;
+#endif
 }
 
 
diff --git a/libxfce4panel/xfce-arrow-button.c b/libxfce4panel/xfce-arrow-button.c
index a85fb17..c4162ca 100644
--- a/libxfce4panel/xfce-arrow-button.c
+++ b/libxfce4panel/xfce-arrow-button.c
@@ -181,8 +181,9 @@ xfce_arrow_button_init (XfceArrowButton *button)
   button->priv->last_relief = GTK_RELIEF_NORMAL;
 
   /* set some widget properties */
-  GTK_WIDGET_SET_FLAGS (GTK_WIDGET (button), GTK_NO_WINDOW);
-  GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
+  gtk_widget_set_has_window (GTK_WIDGET (button), FALSE);
+  gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
+  gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
 }
 
@@ -252,45 +253,56 @@ xfce_arrow_button_draw (GtkWidget *widget,
   XfceArrowButton *button = XFCE_ARROW_BUTTON (widget);
   GtkWidget       *child;
   gint             x, y, width;
+  GtkAllocation    alloc;
+  gdouble          angle;
+  GtkStyleContext *context;
 
   /* draw the button */
   (*GTK_WIDGET_CLASS (xfce_arrow_button_parent_class)->draw) (widget, cr);
 
   if (button->priv->arrow_type != GTK_ARROW_NONE
-      && GTK_WIDGET_DRAWABLE (widget))
+      && gtk_widget_is_drawable (widget))
     {
       child = gtk_bin_get_child (GTK_BIN (widget));
-      if (child != NULL && GTK_WIDGET_VISIBLE (child))
+      if (child != NULL
+          && gtk_widget_get_visible (child))
         {
+          gtk_widget_get_allocation (widget, &alloc);
+          
           if (button->priv->arrow_type == GTK_ARROW_UP
               || button->priv->arrow_type == GTK_ARROW_DOWN)
             {
               width = ARROW_WIDTH;
-              x = widget->allocation.x + widget->style->xthickness;
-              y = widget->allocation.y + (widget->allocation.height - width) / 2;
+              x = alloc.x + 1 /* widget->style->xthickness */;
+              y = alloc.y + (alloc.height - width) / 2;
             }
           else
             {
               width = ARROW_WIDTH;
-              x = widget->allocation.x + (widget->allocation.width - width) / 2;
-              y = widget->allocation.y + widget->style->ythickness;
+              x = alloc.x + (alloc.width - width) / 2;
+              y = alloc.y + 1 /* widget->style->ythickness */;
             }
         }
       else
         {
-          width = MIN (widget->allocation.height - 2 * widget->style->ythickness,
-                       widget->allocation.width  - 2 * widget->style->xthickness);
+          width = MIN (alloc.height - 2 * 1 /* widget->style->ythickness */,
+                       alloc.width  - 2 * 1 /* widget->style->xthickness */);
           width = CLAMP (width, 1, ARROW_WIDTH);
 
-          x = widget->allocation.x + (widget->allocation.width - width) / 2;
-          y = widget->allocation.y + (widget->allocation.height - width) / 2;
+          x = alloc.x + (alloc.width - width) / 2;
+          y = alloc.y + (alloc.height - width) / 2;
         }
 
-      gtk_paint_arrow (widget->style, widget->window,
-                       GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE,
-                       &(event->area), widget, "xfce_arrow_button",
-                       button->priv->arrow_type, FALSE,
-                       x, y, width, width);
+      switch (button->priv->arrow_type)
+        {
+        case GTK_ARROW_DOWN:  angle = G_PI;
+        case GTK_ARROW_LEFT:  angle = G_PI / 2.0 + G_PI;
+        case GTK_ARROW_RIGHT: angle = G_PI / 2.0;
+        default:              angle = 0;
+        }
+
+      context = gtk_widget_get_style_context (widget);
+      gtk_render_arrow (context, cr, angle, x, y, ARROW_WIDTH);
     }
 
   return TRUE;
@@ -386,10 +398,11 @@ xfce_arrow_button_size_allocate (GtkWidget     *widget,
   if (button->priv->arrow_type != GTK_ARROW_NONE)
     {
       child = gtk_bin_get_child (GTK_BIN (widget));
-      if (child != NULL && GTK_WIDGET_VISIBLE (child))
+      if (child != NULL
+          && gtk_widget_get_visible (child))
         {
           /* copy the child allocation */
-          child_allocation = child->allocation;
+          gtk_widget_get_allocation (child, &child_allocation);
 
           /* update the allocation to make space for the arrow */
           switch (button->priv->arrow_type)
@@ -421,8 +434,6 @@ xfce_arrow_button_blinking_timeout (gpointer user_data)
   GtkStyle        *style;
   GtkRcStyle      *rc;
 
-  GDK_THREADS_ENTER ();
-
   rc = gtk_widget_get_modifier_style (GTK_WIDGET (button));
   if(PANEL_HAS_FLAG (rc->color_flags[GTK_STATE_NORMAL], GTK_RC_BG)
      || button->priv->blinking_timeout_id == 0)
@@ -440,8 +451,6 @@ xfce_arrow_button_blinking_timeout (gpointer user_data)
       gtk_widget_modify_style(GTK_WIDGET (button), rc);
     }
 
-  GDK_THREADS_LEAVE ();
-
   return (button->priv->blinking_counter++ < MAX_BLINKING_COUNT);
 }
 
@@ -571,9 +580,9 @@ xfce_arrow_button_set_blinking (XfceArrowButton *button,
         {
           /* start blinking timeout */
           button->priv->blinking_timeout_id =
-              g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 500,
-                                  xfce_arrow_button_blinking_timeout, button,
-                                  xfce_arrow_button_blinking_timeout_destroyed);
+              gdk_threads_add_timeout_full (G_PRIORITY_DEFAULT_IDLE, 500,
+                                            xfce_arrow_button_blinking_timeout, button,
+                                            xfce_arrow_button_blinking_timeout_destroyed);
         }
     }
   else if (button->priv->blinking_timeout_id != 0)
diff --git a/libxfce4panel/xfce-panel-convenience.c b/libxfce4panel/xfce-panel-convenience.c
index a3f3be1..b316916 100644
--- a/libxfce4panel/xfce-panel-convenience.c
+++ b/libxfce4panel/xfce-panel-convenience.c
@@ -57,7 +57,8 @@ xfce_panel_create_button (void)
 {
   GtkWidget *button = gtk_button_new ();
 
-  GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
+  gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
+  gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
   gtk_widget_set_name (button, "xfce-panel-button");
@@ -80,7 +81,8 @@ xfce_panel_create_toggle_button (void)
 {
   GtkWidget *button = gtk_toggle_button_new ();
 
-  GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
+  gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
+  gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
   gtk_widget_set_name (button, "xfce-panel-toggle-button");
diff --git a/libxfce4panel/xfce-panel-image.c b/libxfce4panel/xfce-panel-image.c
index f8dfab3..1945836 100644
--- a/libxfce4panel/xfce-panel-image.c
+++ b/libxfce4panel/xfce-panel-image.c
@@ -105,28 +105,32 @@ enum
 
 
 
-static void       xfce_panel_image_get_property  (GObject         *object,
-                                                  guint            prop_id,
-                                                  GValue          *value,
-                                                  GParamSpec      *pspec);
-static void       xfce_panel_image_set_property  (GObject         *object,
-                                                  guint            prop_id,
-                                                  const GValue    *value,
-                                                  GParamSpec      *pspec);
-static void       xfce_panel_image_finalize      (GObject         *object);
-static void       xfce_panel_image_size_request  (GtkWidget       *widget,
-                                                  GtkRequisition  *requisition);
-static void       xfce_panel_image_size_allocate (GtkWidget       *widget,
-                                                  GtkAllocation   *allocation);
-static gboolean   xfce_panel_image_expose_event  (GtkWidget       *widget,
-                                                  GdkEventExpose  *event);
-static void       xfce_panel_image_style_set     (GtkWidget       *widget,
-                                                  GtkStyle        *previous_style);
-static gboolean   xfce_panel_image_load          (gpointer         data);
-static void       xfce_panel_image_load_destroy  (gpointer         data);
-static GdkPixbuf *xfce_panel_image_scale_pixbuf  (GdkPixbuf       *source,
-                                                  gint             dest_width,
-                                                  gint             dest_height);
+static void       xfce_panel_image_get_property         (GObject         *object,
+                                                         guint            prop_id,
+                                                         GValue          *value,
+                                                         GParamSpec      *pspec);
+static void       xfce_panel_image_set_property         (GObject         *object,
+                                                         guint            prop_id,
+                                                         const GValue    *value,
+                                                         GParamSpec      *pspec);
+static void       xfce_panel_image_finalize             (GObject         *object);
+static void       xfce_panel_image_get_preferred_width  (GtkWidget       *widget,
+                                                         gint            *minimal_width,
+                                                         gint            *natural_width);
+static void       xfce_panel_image_get_preferred_height (GtkWidget       *widget,
+                                                         gint            *minimal_height,
+                                                         gint            *natural_height);
+static void       xfce_panel_image_size_allocate        (GtkWidget       *widget,
+                                                         GtkAllocation   *allocation);
+static gboolean   xfce_panel_image_draw                 (GtkWidget       *widget,
+                                                         cairo_t         *cr);
+static void       xfce_panel_image_style_set            (GtkWidget       *widget,
+                                                         GtkStyle        *previous_style);
+static gboolean   xfce_panel_image_load                 (gpointer         data);
+static void       xfce_panel_image_load_destroy         (gpointer         data);
+static GdkPixbuf *xfce_panel_image_scale_pixbuf         (GdkPixbuf       *source,
+                                                         gint             dest_width,
+                                                         gint             dest_height);
 
 
 
@@ -143,14 +147,15 @@ xfce_panel_image_class_init (XfcePanelImageClass *klass)
   g_type_class_add_private (klass, sizeof (XfcePanelImagePrivate));
 
   gobject_class = G_OBJECT_CLASS (klass);
-  gobject_class->get_property = xfce_panel_image_get_property;
   gobject_class->set_property = xfce_panel_image_set_property;
+  gobject_class->get_property = xfce_panel_image_get_property;
   gobject_class->finalize = xfce_panel_image_finalize;
 
   gtkwidget_class = GTK_WIDGET_CLASS (klass);
-  gtkwidget_class->size_request = xfce_panel_image_size_request;
+  gtkwidget_class->get_preferred_width = xfce_panel_image_get_preferred_width;
+  gtkwidget_class->get_preferred_height = xfce_panel_image_get_preferred_height;
   gtkwidget_class->size_allocate = xfce_panel_image_size_allocate;
-  gtkwidget_class->expose_event = xfce_panel_image_expose_event;
+  gtkwidget_class->draw = xfce_panel_image_draw;
   gtkwidget_class->style_set = xfce_panel_image_style_set;
 
   g_object_class_install_property (gobject_class,
@@ -194,7 +199,7 @@ xfce_panel_image_class_init (XfcePanelImageClass *klass)
 static void
 xfce_panel_image_init (XfcePanelImage *image)
 {
-  GTK_WIDGET_SET_FLAGS (image, GTK_NO_WINDOW);
+  gtk_widget_set_has_window (GTK_WIDGET (image), FALSE);
 
   image->priv = G_TYPE_INSTANCE_GET_PRIVATE (image, XFCE_TYPE_PANEL_IMAGE, XfcePanelImagePrivate);
 
@@ -280,27 +285,48 @@ xfce_panel_image_finalize (GObject *object)
 
 
 
-static void
-xfce_panel_image_size_request (GtkWidget      *widget,
-                               GtkRequisition *requisition)
+static void       
+xfce_panel_image_get_preferred_width (GtkWidget *widget,
+                                      gint      *minimal_width,
+                                      gint      *natural_width)
 {
   XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv;
+  GtkAllocation          alloc;
 
   if (priv->size > 0)
-    {
-      requisition->width = priv->size;
-      requisition->height = priv->size;
-    }
+    *minimal_width = priv->size;
   else if (priv->pixbuf != NULL)
+    *minimal_width = gdk_pixbuf_get_width (priv->pixbuf);
+  else
     {
-      requisition->width = gdk_pixbuf_get_width (priv->pixbuf);
-      requisition->height = gdk_pixbuf_get_height (priv->pixbuf);
+      gtk_widget_get_allocation (widget, &alloc);
+      *minimal_width = alloc.width;
     }
+
+  *natural_width = *minimal_width;
+}
+
+
+
+static void       
+xfce_panel_image_get_preferred_height (GtkWidget *widget,
+                                       gint      *minimal_height,
+                                       gint      *natural_height)
+{
+  XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv;
+  GtkAllocation          alloc;
+
+  if (priv->size > 0)
+    *minimal_height = priv->size;
+  else if (priv->pixbuf != NULL)
+    *minimal_height = gdk_pixbuf_get_height (priv->pixbuf);
   else
     {
-      requisition->width = widget->allocation.width;
-      requisition->height = widget->allocation.height;
+      gtk_widget_get_allocation (widget, &alloc);
+      *minimal_height = alloc.height;
     }
+
+  *natural_height = *minimal_height;
 }
 
 
@@ -311,8 +337,7 @@ xfce_panel_image_size_allocate (GtkWidget     *widget,
 {
   XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv;
 
-
-  widget->allocation = *allocation;
+  gtk_widget_set_allocation (widget, allocation);
 
   /* check if the available size changed */
   if ((priv->pixbuf != NULL || priv->source != NULL)
@@ -331,8 +356,8 @@ xfce_panel_image_size_allocate (GtkWidget     *widget,
       if (priv->pixbuf == NULL)
         {
           /* delay icon loading */
-          priv->idle_load_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, xfce_panel_image_load,
-                                                widget, xfce_panel_image_load_destroy);
+          priv->idle_load_id = gdk_threads_add_idle_full (G_PRIORITY_DEFAULT_IDLE, xfce_panel_image_load,
+                                                          widget, xfce_panel_image_load_destroy);
         }
       else
         {
@@ -345,8 +370,8 @@ xfce_panel_image_size_allocate (GtkWidget     *widget,
 
 
 static gboolean
-xfce_panel_image_expose_event (GtkWidget      *widget,
-                               GdkEventExpose *event)
+xfce_panel_image_draw (GtkWidget *widget,
+                       cairo_t   *cr)
 {
   XfcePanelImagePrivate *priv = XFCE_PANEL_IMAGE (widget)->priv;
   gint                   source_width, source_height;
@@ -354,7 +379,8 @@ xfce_panel_image_expose_event (GtkWidget      *widget,
   GtkIconSource         *source;
   GdkPixbuf             *rendered = NULL;
   GdkPixbuf             *pixbuf = priv->cache;
-  cairo_t               *cr;
+  GtkStyleContext       *context;
+  GtkAllocation          alloc;
 
   if (G_LIKELY (pixbuf != NULL))
     {
@@ -363,33 +389,25 @@ xfce_panel_image_expose_event (GtkWidget      *widget,
       source_height = gdk_pixbuf_get_height (pixbuf);
 
       /* position */
-      dest_x = widget->allocation.x + (priv->width - source_width) / 2;
-      dest_y = widget->allocation.y + (priv->height - source_height) / 2;
+      gtk_widget_get_allocation (widget, &alloc);
+      dest_x = alloc.x + (priv->width - source_width) / 2;
+      dest_y = alloc.y + (priv->height - source_height) / 2;
 
-      if (GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
+      context = gtk_widget_get_style_context (widget);
+
+      if (!gtk_widget_is_sensitive (widget))
         {
           source = gtk_icon_source_new ();
           gtk_icon_source_set_pixbuf (source, pixbuf);
-
-          rendered = gtk_style_render_icon (widget->style,
-                                            source,
-                                            gtk_widget_get_direction (widget),
-                                            GTK_WIDGET_STATE (widget),
-                                            -1, widget, "xfce-panel-image");
+          rendered = gtk_render_icon_pixbuf (context, source, -1);
           gtk_icon_source_free (source);
 
           if (G_LIKELY (rendered != NULL))
             pixbuf = rendered;
         }
 
-      /* draw the pixbuf */
-      cr = gdk_cairo_create (gtk_widget_get_window (widget));
-      if (G_LIKELY (cr != NULL))
-        {
-          gdk_cairo_set_source_pixbuf (cr, pixbuf, dest_x, dest_y);
-          cairo_paint (cr);
-          cairo_destroy (cr);
-        }
+      /* draw the icon */
+      gtk_render_icon (context, cr, pixbuf, dest_x, dest_y);
 
       if (rendered != NULL)
         g_object_unref (G_OBJECT (rendered));
@@ -442,8 +460,6 @@ xfce_panel_image_load (gpointer data)
   GtkIconTheme          *icon_theme = NULL;
   gint                   dest_w, dest_h;
 
-  GDK_THREADS_ENTER ();
-
   dest_w = priv->width;
   dest_h = priv->height;
 
@@ -487,8 +503,6 @@ xfce_panel_image_load (gpointer data)
   if (G_LIKELY (priv->cache != NULL))
     gtk_widget_queue_draw (GTK_WIDGET (data));
 
-  GDK_THREADS_LEAVE ();
-
   return FALSE;
 }
 
diff --git a/libxfce4panel/xfce-panel-macros-46.h b/libxfce4panel/xfce-panel-macros-46.h
index 19f2153..6b472e3 100644
--- a/libxfce4panel/xfce-panel-macros-46.h
+++ b/libxfce4panel/xfce-panel-macros-46.h
@@ -393,9 +393,9 @@ G_BEGIN_DECLS
     \
     g_return_if_fail (GTK_IS_PLUG (plug)); \
     g_return_if_fail (XFCE_IS_PANEL_PLUGIN (xpp)); \
-    g_return_if_fail (GTK_WIDGET_REALIZED (plug)); \
+    g_return_if_fail (gtk_widget_get_realized (plug)); \
     g_return_if_fail (_xpp_atom != GDK_NONE); \
-    g_return_if_fail (GTK_WIDGET_REALIZED (xpp)); \
+    g_return_if_fail (gtk_widget_get_realized (xpp)); \
     \
     if (_xpp_debug) \
       g_printerr ("xfce4-panel(%s): send provider signal %d\n", \
@@ -428,7 +428,7 @@ G_BEGIN_DECLS
     \
     g_return_if_fail (XFCE_IS_PANEL_PLUGIN (xpp)); \
     g_return_if_fail (GTK_IS_PLUG (plug)); \
-    g_return_if_fail (GTK_WIDGET_REALIZED (plug)); \
+    g_return_if_fail (gtk_widget_get_realized (plug)); \
     \
     if (_xpp_debug) \
       g_printerr ("xfce4-panel(%s): calling plugin construct function\n", \
diff --git a/libxfce4panel/xfce-panel-plugin.c b/libxfce4panel/xfce-panel-plugin.c
index c91039f..50607a5 100644
--- a/libxfce4panel/xfce-panel-plugin.c
+++ b/libxfce4panel/xfce-panel-plugin.c
@@ -28,6 +28,7 @@
 #endif
 
 #include <gtk/gtk.h>
+#include <gtk/gtkx.h>
 #include <glib.h>
 #include <libxfce4util/libxfce4util.h>
 
@@ -2413,6 +2414,7 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
   GTimeVal        now_t, end_t;
   GtkWidget      *toplevel, *plug;
   gint            px, py;
+  GtkAllocation   alloc;
 
   g_return_if_fail (XFCE_IS_PANEL_PLUGIN (plugin));
   g_return_if_fail (GTK_IS_WIDGET (menu_widget));
@@ -2424,15 +2426,15 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
     attach_widget = GTK_WIDGET (plugin);
 
   /* make sure the menu is realized to get valid rectangle sizes */
-  if (!GTK_WIDGET_REALIZED (menu_widget))
+  if (!gtk_widget_get_realized (menu_widget))
     gtk_widget_realize (menu_widget);
 
   /* make sure the attach widget is realized for the gdkwindow */
-  if (!GTK_WIDGET_REALIZED (attach_widget))
+  if (!gtk_widget_get_realized (attach_widget))
     gtk_widget_realize (attach_widget);
 
   /* get the menu/widget size request */
-  gtk_widget_size_request (menu_widget, &requisition);
+  gtk_widget_get_preferred_size (menu_widget, &requisition, NULL);
 
   /* get the root position of the attach widget */
   toplevel = gtk_widget_get_toplevel (attach_widget);
@@ -2443,7 +2445,7 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
   if (plug != NULL)
     {
        gdk_window_get_geometry (gtk_plug_get_socket_window (GTK_PLUG (plug)),
-                                &px, &py, NULL, NULL, NULL);
+                                &px, &py, NULL, NULL);
 
        *x += px;
        *y += py;
@@ -2462,7 +2464,7 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
           while (gtk_events_pending ())
             gtk_main_iteration ();
 
-          gdk_window_get_position (GDK_WINDOW (attach_widget->window), x, y);
+          gdk_window_get_position (gtk_widget_get_window (attach_widget), x, y);
 
           /* don't try longer then 1/2 a second */
           g_get_current_time (&now_t);
@@ -2474,8 +2476,9 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
     }
 
   /* add the widgets allocation */
-  *x += attach_widget->allocation.x;
-  *y += attach_widget->allocation.y;
+  gtk_widget_get_allocation (attach_widget, &alloc);
+  *x += alloc.x;
+  *y += alloc.y;
 
   switch (xfce_panel_plugin_arrow_type (plugin))
     {
@@ -2484,7 +2487,7 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
       break;
 
     case GTK_ARROW_DOWN:
-      *y += attach_widget->allocation.height;
+      *y += alloc.height;
       break;
 
     case GTK_ARROW_LEFT:
@@ -2492,13 +2495,13 @@ xfce_panel_plugin_position_widget (XfcePanelPlugin *plugin,
       break;
 
     default: /* GTK_ARROW_RIGHT and GTK_ARROW_NONE */
-      *x += attach_widget->allocation.width;
+      *x += alloc.width;
       break;
     }
 
   /* get the monitor geometry */
   screen = gtk_widget_get_screen (attach_widget);
-  monitor_num = gdk_screen_get_monitor_at_window (screen, attach_widget->window);
+  monitor_num = gdk_screen_get_monitor_at_window (screen, gtk_widget_get_window (attach_widget));
   gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
 
   /* keep the menu inside the screen */
diff --git a/panel/panel-dialogs.c b/panel/panel-dialogs.c
index 4897b14..5cec79c 100644
--- a/panel/panel-dialogs.c
+++ b/panel/panel-dialogs.c
@@ -36,6 +36,7 @@
 
 
 
+#ifn GTK_CHECK_VERSION (3, 0, 0)
 static void
 panel_dialogs_show_about_email_hook (GtkAboutDialog *dialog,
                                      const gchar    *uri,
@@ -56,6 +57,7 @@ panel_dialogs_show_about_email_hook (GtkAboutDialog *dialog,
       g_error_free (error);
     }
 }
+#endif
 
 
 
@@ -76,7 +78,9 @@ panel_dialogs_show_about (void)
                                 "Jasper Huijsmans <jasper at xfce.org>",
                                 "Tic-tac-toe <tictactoe at xfce.org>");
 
+#ifn GTK_CHECK_VERSION (3, 0, 0)
   gtk_about_dialog_set_email_hook (panel_dialogs_show_about_email_hook, NULL, NULL);
+#endif
 
   gtk_show_about_dialog (NULL,
                          "authors", authors,
diff --git a/panel/panel-itembar.c b/panel/panel-itembar.c
index 2c436ac..8440462 100644
--- a/panel/panel-itembar.c
+++ b/panel/panel-itembar.c
@@ -236,7 +236,7 @@ panel_itembar_init (PanelItembar *itembar)
   itembar->highlight_index = -1;
   itembar->highlight_length = -1;
 
-  GTK_WIDGET_SET_FLAGS (GTK_WIDGET (itembar), GTK_NO_WINDOW);
+  gtk_widget_set_has_window (GTK_WIDGET (itembar), FALSE);
 
   gtk_widget_set_redraw_on_allocate (GTK_WIDGET (itembar), FALSE);
 }
diff --git a/plugins/systray/systray-box.c b/plugins/systray/systray-box.c
index 991becb..c5183da 100644
--- a/plugins/systray/systray-box.c
+++ b/plugins/systray/systray-box.c
@@ -141,7 +141,7 @@ systray_box_class_init (SystrayBoxClass *klass)
 static void
 systray_box_init (SystrayBox *box)
 {
-  GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW);
+  gtk_widget_set_has_window (GTK_WIDGET (box), FALSE);
 
   box->childeren = NULL;
   box->size_max = SIZE_MAX_DEFAULT;
diff --git a/plugins/tasklist/tasklist-widget.c b/plugins/tasklist/tasklist-widget.c
index 65420c0..8f433fa 100644
--- a/plugins/tasklist/tasklist-widget.c
+++ b/plugins/tasklist/tasklist-widget.c
@@ -531,7 +531,7 @@ xfce_tasklist_class_init (XfceTasklistClass *klass)
 static void
 xfce_tasklist_init (XfceTasklist *tasklist)
 {
-  GTK_WIDGET_SET_FLAGS (tasklist, GTK_NO_WINDOW);
+  gtk_widget_set_has_window (GTK_WIDGET (tasklist), FALSE);
 
   tasklist->locked = 0;
   tasklist->screen = NULL;


More information about the Xfce4-commits mailing list