[Xfce4-commits] <xfce4-settings:master> Use accessors where possible (Mike Massonnet).

Jérôme Guelfucci noreply at xfce.org
Sat Jan 2 13:00:18 CET 2010


Updating branch refs/heads/master
         to e09b16c362b936fb22d3d9854975709291185bf3 (commit)
       from 8afec93c01857ca89665ed2aa2f4efe34208536c (commit)

commit e09b16c362b936fb22d3d9854975709291185bf3
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Thu Dec 10 13:25:37 2009 +0100

    Use accessors where possible (Mike Massonnet).

 xfce4-settings-helper/clipboard-manager.c |   13 +++++++------
 xfce4-settings-helper/utils.c             |   11 +++++++----
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/xfce4-settings-helper/clipboard-manager.c b/xfce4-settings-helper/clipboard-manager.c
index 686476b..1845578 100644
--- a/xfce4-settings-helper/clipboard-manager.c
+++ b/xfce4-settings-helper/clipboard-manager.c
@@ -138,7 +138,8 @@ xfce_clipboard_manager_default_get_func (GtkClipboard     *clipboard,
     {
         selection_data_cache = list->data;
 
-        if (selection_data->target == selection_data_cache->target)
+        if (gtk_selection_data_get_target (selection_data) ==
+            gtk_selection_data_get_target (selection_data_cache))
             break;
 
         selection_data_cache = NULL;
@@ -147,10 +148,8 @@ xfce_clipboard_manager_default_get_func (GtkClipboard     *clipboard,
     if (selection_data_cache == NULL)
         return;
 
-    gtk_selection_data_set (selection_data, selection_data->target,
-                            selection_data_cache->format,
-                            selection_data_cache->data,
-                            selection_data_cache->length);
+    gtk_selection_data_free (selection_data);
+    selection_data = gtk_selection_data_copy (selection_data_cache);
 }
 
 
@@ -179,7 +178,9 @@ xfce_clipboard_manager_default_restore (XfceClipboardManager *manager)
     for (list = manager->default_cache; list->next != NULL; list = list->next)
     {
         sdata = list->data;
-        gtk_target_list_add (target_list, sdata->target, 0, 0);
+        gtk_target_list_add (target_list,
+                             gtk_selection_data_get_target (sdata),
+                             0, 0);
     }
 
     targets = gtk_target_table_new_from_list (target_list, &n_targets);
diff --git a/xfce4-settings-helper/utils.c b/xfce4-settings-helper/utils.c
index 345db69..2d8692a 100644
--- a/xfce4-settings-helper/utils.c
+++ b/xfce4-settings-helper/utils.c
@@ -40,6 +40,7 @@ xfce_utils_selection_owner (const gchar   *selection_name,
     GtkWidget *invisible;
     Display *dpy = GDK_DISPLAY_XDISPLAY (gdpy);
     GdkWindow *rootwin = gdk_screen_get_root_window (gdk_display_get_screen (gdpy, 0));
+    GdkWindow *invisible_window;
     Window xroot = GDK_WINDOW_XID (rootwin);
     GdkAtom selection_atom;
     Atom selection_atom_x11;
@@ -67,7 +68,9 @@ xfce_utils_selection_owner (const gchar   *selection_name,
     gtk_widget_realize (invisible);
     gtk_widget_add_events (invisible, GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK);
 
-    if (!gdk_selection_owner_set_for_display (gdpy, invisible->window,
+    invisible_window = gtk_widget_get_window (invisible);
+
+    if (!gdk_selection_owner_set_for_display (gdpy, invisible_window,
                                               selection_atom, GDK_CURRENT_TIME,
                                               TRUE))
     {
@@ -77,7 +80,7 @@ xfce_utils_selection_owner (const gchar   *selection_name,
     }
 
     /* but we can use gdk here since we only care if it's our window */
-    if (gdk_selection_owner_get_for_display (gdpy, selection_atom) != invisible->window)
+    if (gdk_selection_owner_get_for_display (gdpy, selection_atom) != invisible_window)
     {
         gtk_widget_destroy (invisible);
         return FALSE;
@@ -89,7 +92,7 @@ xfce_utils_selection_owner (const gchar   *selection_name,
     xev.format = 32;
     xev.data.l[0] = CurrentTime;
     xev.data.l[1] = selection_atom_x11;
-    xev.data.l[2] = GDK_WINDOW_XID (invisible->window);
+    xev.data.l[2] = GDK_WINDOW_XID (invisible_window);
     xev.data.l[3] = xev.data.l[4] = 0;
 
     gdk_error_trap_push ();
@@ -99,7 +102,7 @@ xfce_utils_selection_owner (const gchar   *selection_name,
       g_critical ("Failed to send client event");
 
     if (filter_func != NULL)
-        gdk_window_add_filter (invisible->window, filter_func, invisible);
+        gdk_window_add_filter (invisible_window, filter_func, invisible);
 #endif
 
     return TRUE;



More information about the Xfce4-commits mailing list