[gtk+/refactor: 21/23] gtk/gtkplug.c: Use accessor functions to access GtkWindow
- From: Javier Jardón <jjardon src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/refactor: 21/23] gtk/gtkplug.c: Use accessor functions to access GtkWindow
- Date: Tue, 24 Aug 2010 15:25:39 +0000 (UTC)
commit e52fb43da02cc7cba98ea3a3c5deab2e97ff1702
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 | 35 +++++++++++++++++++----------------
1 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c
index 0297e50..1bb88f1 100644
--- a/gtk/gtkplug.c
+++ b/gtk/gtkplug.c
@@ -208,13 +208,9 @@ gtk_plug_class_init (GtkPlugClass *class)
static void
gtk_plug_init (GtkPlug *plug)
{
- GtkWindow *window = GTK_WINDOW (plug);
-
plug->priv = G_TYPE_INSTANCE_GET_PRIVATE (plug,
GTK_TYPE_PLUG,
GtkPlugPriv);
-
- window->type = GTK_WINDOW_TOPLEVEL;
}
static void
@@ -253,9 +249,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 ();
@@ -634,16 +630,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;
@@ -661,8 +659,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))
{
@@ -857,7 +855,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);
}
@@ -1009,13 +1007,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);
@@ -1106,11 +1107,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]