]> git.0d.be Git - empathy.git/blobdiff - libempathy-gtk/empathy-avatar-image.c
Use a flat namespace for internal includes
[empathy.git] / libempathy-gtk / empathy-avatar-image.c
index ef4185ae9da85e9873f19d33ef210923af7d3aed..f66827f641906f969e6b80eb17a0e715105d2c6a 100644 (file)
 #include "config.h"
 
 #include <glib/gi18n-lib.h>
-#include <gdk/gdkkeysyms.h>
-#include <gdk/gdk.h>
-#include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 
-#include <libempathy/empathy-utils.h>
+#include "empathy-utils.h"
 #include "empathy-avatar-image.h"
 #include "empathy-ui-utils.h"
 
@@ -132,8 +129,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 +137,6 @@ avatar_image_filter_func (GdkXEvent  *gdkxevent,
                                priv->popup = NULL;
                        }
                }
-               break;
        }
 
        return GDK_FILTER_CONTINUE;
@@ -150,25 +145,24 @@ avatar_image_filter_func (GdkXEvent  *gdkxevent,
 static void
 avatar_image_add_filter (EmpathyAvatarImage *avatar_image)
 {
+       Display    *display;
        Window     window;
-       GdkWindow *gdkwindow;
        gint       mask;
+       XWindowAttributes attrs;
 
        mask = PropertyChangeMask;
 
-       window = GDK_ROOT_WINDOW ();
-       gdkwindow = gdk_xid_table_lookup (window);
+       window = gdk_x11_get_default_root_xwindow ();
+       display = gdk_x11_get_default_xdisplay ();
 
        gdk_error_trap_push ();
-       if (gdkwindow) {
-               XWindowAttributes attrs;
-               XGetWindowAttributes (gdk_display, window, &attrs);
-               mask |= attrs.your_event_mask;
-       }
 
-       XSelectInput (gdk_display, window, mask);
+       XGetWindowAttributes (display, window, &attrs);
+       mask |= attrs.your_event_mask;
+
+       XSelectInput (display, window, mask);
 
-       gdk_error_trap_pop ();
+       gdk_error_trap_pop_ignored ();
 
        gdk_window_add_filter (NULL, avatar_image_filter_func, avatar_image);
 }
@@ -313,9 +307,7 @@ empathy_avatar_image_set (EmpathyAvatarImage *avatar_image,
        }
 
        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;
        }