]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-avatar-image.c
Merge branch 'sasl'
[empathy.git] / libempathy-gtk / empathy-avatar-image.c
index e5513231bf82c83cc97b29717d7f344812ab349d..a8041d2bad153e74edf0a8bc57b91f9f75335687 100644 (file)
@@ -15,8 +15,8 @@
  *
  * You should have received a copy of the GNU General Public
  * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA  02110-1301  USA
  *
  * Authors: Xavier Claessens <xclaesse@gmail.com>
  */
@@ -132,8 +132,7 @@ avatar_image_filter_func (GdkXEvent  *gdkxevent,
 
        priv = GET_PRIV (data);
 
-       switch (xevent->type) {
-       case PropertyNotify:
+       if (xevent->type == PropertyNotify) {
                atom = gdk_x11_get_xatom_by_name ("_NET_CURRENT_DESKTOP");
                if (xevent->xproperty.atom == atom) {
                        if (priv->popup) {
@@ -141,7 +140,6 @@ avatar_image_filter_func (GdkXEvent  *gdkxevent,
                                priv->popup = NULL;
                        }
                }
-               break;
        }
 
        return GDK_FILTER_CONTINUE;
@@ -162,13 +160,13 @@ avatar_image_add_filter (EmpathyAvatarImage *avatar_image)
        gdk_error_trap_push ();
        if (gdkwindow) {
                XWindowAttributes attrs;
-               XGetWindowAttributes (gdk_display, window, &attrs);
+               XGetWindowAttributes (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), window, &attrs);
                mask |= attrs.your_event_mask;
        }
 
-       XSelectInput (gdk_display, window, mask);
+       XSelectInput (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), window, mask);
 
-       gdk_error_trap_pop ();
+       gdk_error_trap_pop_ignored ();
 
        gdk_window_add_filter (NULL, avatar_image_filter_func, avatar_image);
 }
@@ -190,6 +188,7 @@ avatar_image_button_press_event (GtkWidget *widget, GdkEventButton *event)
        gint                   popup_width, popup_height;
        gint                   width, height;
        GdkPixbuf             *pixbuf;
+       GtkAllocation          allocation;
 
        priv = GET_PRIV (widget);
 
@@ -205,8 +204,9 @@ avatar_image_button_press_event (GtkWidget *widget, GdkEventButton *event)
        popup_width = gdk_pixbuf_get_width (priv->pixbuf);
        popup_height = gdk_pixbuf_get_height (priv->pixbuf);
 
-       width = priv->image->allocation.width;
-       height = priv->image->allocation.height;
+       gtk_widget_get_allocation (priv->image, &allocation);
+       width = allocation.width;
+       height = allocation.height;
 
        /* Don't show a popup if the popup is smaller then the currently avatar
         * image.
@@ -232,7 +232,7 @@ avatar_image_button_press_event (GtkWidget *widget, GdkEventButton *event)
        gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
        g_object_unref (pixbuf);
 
-       gdk_window_get_origin (priv->image->window, &x, &y);
+       gdk_window_get_origin (gtk_widget_get_window (priv->image), &x, &y);
 
        x = x - (popup_width - width) / 2;
        y = y - (popup_height - height) / 2;
@@ -306,13 +306,12 @@ empathy_avatar_image_set (EmpathyAvatarImage *avatar_image,
        }
 
        if (avatar) {
-               priv->pixbuf = empathy_pixbuf_from_data (avatar->data, avatar->len);
+               priv->pixbuf = empathy_pixbuf_from_data ((gchar *) avatar->data,
+                               avatar->len);
        }
 
        if (!priv->pixbuf) {
-               gtk_image_set_from_icon_name (GTK_IMAGE (priv->image),
-                                             "stock_person",
-                                             GTK_ICON_SIZE_DIALOG);
+               gtk_image_clear (GTK_IMAGE (priv->image));
                return;
        }