[gtk+/refactor: 21/23] gtk/gtkplug.c: Use accessor functions to access GtkWindow



commit f727fb1e13e5144f2e0d9acd40290d80be90ed34
Author: Javier Jardón <jjardon gnome org>
Date:   Tue Aug 17 15:14:20 2010 +0200

    gtk/gtkplug.c: Use accessor functions to access GtkWindow

 gtk/gtkplug.c |   31 +++++++++++++++++++------------
 1 files changed, 19 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c
index 169e491..331e11d 100644
--- a/gtk/gtkplug.c
+++ b/gtk/gtkplug.c
@@ -255,9 +255,9 @@ gtk_plug_set_is_child (GtkPlug  *plug,
     }
   else
     {
-      if (GTK_WINDOW (plug)->focus_widget)
+      if (gtk_window_get_focus (GTK_WINDOW (plug)))
 	gtk_window_set_focus (GTK_WINDOW (plug), NULL);
-      if (GTK_WINDOW (plug)->default_widget)
+      if (gtk_window_get_default_widget (GTK_WINDOW (plug)))
 	gtk_window_set_default (GTK_WINDOW (plug), NULL);
 
       priv->modality_group = gtk_window_group_new ();
@@ -636,16 +636,18 @@ gtk_plug_realize (GtkWidget *widget)
   GtkWindow *window = GTK_WINDOW (widget);
   GdkWindow *gdk_window;
   GdkWindowAttr attributes;
+  const gchar *title;
   gint attributes_mask;
 
   gtk_widget_set_realized (widget, TRUE);
 
+  title = gtk_window_get_title (window);
   gtk_widget_get_allocation (widget, &allocation);
 
   attributes.window_type = GDK_WINDOW_CHILD;	/* XXX GDK_WINDOW_PLUG ? */
-  attributes.title = window->title;
-  attributes.wmclass_name = window->wmclass_name;
-  attributes.wmclass_class = window->wmclass_class;
+  attributes.title = g_strdup (title);
+  attributes.wmclass_name = g_strdup (g_get_prgname ());
+  attributes.wmclass_class = g_strdup (gdk_get_program_class ());
   attributes.width = allocation.width;
   attributes.height = allocation.height;
   attributes.wclass = GDK_INPUT_OUTPUT;
@@ -663,8 +665,8 @@ gtk_plug_realize (GtkWidget *widget)
 			    GDK_STRUCTURE_MASK);
 
   attributes_mask = GDK_WA_VISUAL | GDK_WA_COLORMAP;
-  attributes_mask |= (window->title ? GDK_WA_TITLE : 0);
-  attributes_mask |= (window->wmclass_name ? GDK_WA_WMCLASS : 0);
+  attributes_mask |= (title ? GDK_WA_TITLE : 0);
+  attributes_mask |= (g_strdup (g_get_prgname ()) ? GDK_WA_WMCLASS : 0);
 
   if (gtk_widget_is_toplevel (widget))
     {
@@ -859,7 +861,7 @@ gtk_plug_set_focus (GtkWindow *window,
   /* Ask for focus from embedder
    */
 
-  if (focus && !window->has_toplevel_focus)
+  if (focus && !gtk_window_has_toplevel_focus (window))
     _gtk_plug_windowing_set_focus (plug);
 }
 
@@ -1011,13 +1013,16 @@ gtk_plug_focus (GtkWidget        *widget,
    */
   if (old_focus_child)
     {
+      GtkWidget *focus_widget;
+
       if (gtk_widget_child_focus (old_focus_child, direction))
 	return TRUE;
 
-      if (window->focus_widget)
+      focus_widget = gtk_window_get_focus (window);
+      if (focus_widget)
 	{
 	  /* Wrapped off the end, clear the focus setting for the toplevel */
-	  parent = gtk_widget_get_parent (window->focus_widget);
+	  parent = gtk_widget_get_parent (focus_widget);
 	  while (parent)
 	    {
 	      gtk_container_set_focus_child (GTK_CONTAINER (parent), NULL);
@@ -1108,11 +1113,13 @@ _gtk_plug_focus_first_last (GtkPlug          *plug,
 			    GtkDirectionType  direction)
 {
   GtkWindow *window = GTK_WINDOW (plug);
+  GtkWidget *focus_widget;
   GtkWidget *parent;
 
-  if (window->focus_widget)
+  focus_widget = gtk_window_get_focus (window);
+  if (focus_widget)
     {
-      parent = gtk_widget_get_parent (window->focus_widget);
+      parent = gtk_widget_get_parent (focus_widget);
       while (parent)
 	{
 	  gtk_container_set_focus_child (GTK_CONTAINER (parent), NULL);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]