gtkxpaned: Remove write-only variables.
[pspp] / lib / gtk-contrib / gtkxpaned.c
index e350295a3e3f40bbcf687ca3f3bcf7438bec217c..96f89ada7df785b0f3416daeb83d894820a3e8a2 100644 (file)
 
 #include <config.h>
 #include "gtkxpaned.h"
+
+#include <gtk/gtk.h>
 #include <ui/gui/psppire-marshal.h>
-#include <gtk/gtkbindings.h>
-#include <gtk/gtksignal.h>
 #include <gdk/gdkkeysyms.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkmain.h>
+
 
 enum WidgetProperties
 {
@@ -660,7 +659,7 @@ static void gtk_xpaned_size_request (GtkWidget* widget,
        requisition->width = 0;
        requisition->height = 0;
 
-       if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child))
+       if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child))
        {
                gtk_widget_size_request (xpaned->top_left_child, &child_requisition);
 
@@ -668,7 +667,7 @@ static void gtk_xpaned_size_request (GtkWidget* widget,
                requisition->height = child_requisition.height;
        }
 
-       if (xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child))
+       if (xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child))
        {
                gtk_widget_size_request (xpaned->top_right_child, &child_requisition);
 
@@ -676,7 +675,7 @@ static void gtk_xpaned_size_request (GtkWidget* widget,
                requisition->height = MAX (requisition->height, child_requisition.height);
        }
 
-       if (xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child))
+       if (xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child))
        {
                gtk_widget_size_request (xpaned->bottom_left_child, &child_requisition);
 
@@ -684,7 +683,7 @@ static void gtk_xpaned_size_request (GtkWidget* widget,
                requisition->height += child_requisition.height;
        }
 
-       if (xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child))
+       if (xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child))
        {
                gtk_widget_size_request (xpaned->bottom_right_child, &child_requisition);
 
@@ -697,10 +696,10 @@ static void gtk_xpaned_size_request (GtkWidget* widget,
        requisition->height += GTK_CONTAINER (xpaned)->border_width * 2;
 
        /* also add the handle "thickness" to GtkXPaneds width- and height-requisitions */
-       if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) &&
-               xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) &&
-               xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) &&
-               xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child))
+       if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) &&
+               xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) &&
+               xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) &&
+               xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child))
        {
                gint handle_size;
 
@@ -739,10 +738,10 @@ static void gtk_xpaned_size_allocate (GtkWidget* widget,
 
        widget->allocation = *allocation;
 
-       if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) &&
-               xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) &&
-               xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) &&
-               xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child))
+       if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) &&
+               xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) &&
+               xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) &&
+               xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child))
     {
                /* what sizes do the children want to be at least at */
                gtk_widget_get_child_requisition (xpaned->top_left_child,
@@ -815,9 +814,9 @@ static void gtk_xpaned_size_allocate (GtkWidget* widget,
                bottom_right_child_allocation.width = xpaned->handle_pos_east.width;
                bottom_right_child_allocation.height = xpaned->handle_pos_south.height;
 
-               if (GTK_WIDGET_REALIZED (widget))
+               if (gtk_widget_get_realized (widget))
                {
-                       if (GTK_WIDGET_MAPPED (widget))
+                       if (gtk_widget_get_mapped (widget))
                        {
                                gdk_window_show (xpaned->handle_east);
                                gdk_window_show (xpaned->handle_west);
@@ -860,7 +859,7 @@ static void gtk_xpaned_size_allocate (GtkWidget* widget,
                /* Now allocate the childen, making sure, when resizing not to
                * overlap the windows
                */
-               if (GTK_WIDGET_MAPPED (widget))
+               if (gtk_widget_get_mapped (widget))
                {
                        gtk_widget_size_allocate (xpaned->top_right_child, &top_right_child_allocation);
                        gtk_widget_size_allocate (xpaned->top_left_child, &top_left_child_allocation);
@@ -1216,10 +1215,10 @@ static void gtk_xpaned_realize (GtkWidget* widget)
 
        widget->style = gtk_style_attach (widget->style, widget->window);
 
-       if (xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) &&
-               xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) &&
-               xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) &&
-               xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child))
+       if (xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) &&
+               xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) &&
+               xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) &&
+               xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child))
        {
                gdk_window_show (xpaned->handle_east);
                gdk_window_show (xpaned->handle_west);
@@ -1325,11 +1324,11 @@ static gboolean gtk_xpaned_expose (GtkWidget* widget,
        /* I want the handle-"thickness" to be at least 3 */
        g_assert (handle_size >= 3);
 
-       if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget) &&
-               xpaned->top_left_child && GTK_WIDGET_VISIBLE (xpaned->top_left_child) &&
-               xpaned->top_right_child && GTK_WIDGET_VISIBLE (xpaned->top_right_child) &&
-               xpaned->bottom_left_child && GTK_WIDGET_VISIBLE (xpaned->bottom_left_child) &&
-               xpaned->bottom_right_child && GTK_WIDGET_VISIBLE (xpaned->bottom_right_child))
+       if (gtk_widget_get_visible (widget) && gtk_widget_get_mapped (widget) &&
+               xpaned->top_left_child && gtk_widget_get_visible (xpaned->top_left_child) &&
+               xpaned->top_right_child && gtk_widget_get_visible (xpaned->top_right_child) &&
+               xpaned->bottom_left_child && gtk_widget_get_visible (xpaned->bottom_left_child) &&
+               xpaned->bottom_right_child && gtk_widget_get_visible (xpaned->bottom_right_child))
     {
                GtkStateType state;
 
@@ -1338,7 +1337,7 @@ static gboolean gtk_xpaned_expose (GtkWidget* widget,
                else if (xpaned->handle_prelit)
                        state = GTK_STATE_PRELIGHT;
                else
-                       state = GTK_WIDGET_STATE (widget);
+                       state = gtk_widget_get_state (widget);
 
                horizontalClipArea.x = xpaned->handle_pos_west.x;
                horizontalClipArea.y = xpaned->handle_pos_west.y;
@@ -1930,7 +1929,7 @@ static void gtk_xpaned_remove (GtkContainer* container, GtkWidget* widget)
        gboolean was_visible;
 
        xpaned = GTK_XPANED (container);
-       was_visible = GTK_WIDGET_VISIBLE (widget);
+       was_visible = gtk_widget_get_visible (widget);
 
        if (xpaned->top_left_child == widget)
        {
@@ -1938,7 +1937,7 @@ static void gtk_xpaned_remove (GtkContainer* container, GtkWidget* widget)
 
                xpaned->top_left_child = NULL;
 
-               if (was_visible && GTK_WIDGET_VISIBLE (container))
+               if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
                        gtk_widget_queue_resize (GTK_WIDGET (container));
        }
        else if (xpaned->top_right_child == widget)
@@ -1947,7 +1946,7 @@ static void gtk_xpaned_remove (GtkContainer* container, GtkWidget* widget)
 
                xpaned->top_right_child = NULL;
 
-               if (was_visible && GTK_WIDGET_VISIBLE (container))
+               if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
                        gtk_widget_queue_resize (GTK_WIDGET (container));
        }
        else if (xpaned->bottom_left_child == widget)
@@ -1956,7 +1955,7 @@ static void gtk_xpaned_remove (GtkContainer* container, GtkWidget* widget)
 
                xpaned->bottom_left_child = NULL;
 
-               if (was_visible && GTK_WIDGET_VISIBLE (container))
+               if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
                        gtk_widget_queue_resize (GTK_WIDGET (container));
        }
        else if (xpaned->bottom_right_child == widget)
@@ -1965,7 +1964,7 @@ static void gtk_xpaned_remove (GtkContainer* container, GtkWidget* widget)
 
                xpaned->bottom_right_child = NULL;
 
-               if (was_visible && GTK_WIDGET_VISIBLE (container))
+               if (was_visible && gtk_widget_get_visible (GTK_WIDGET (container)))
                        gtk_widget_queue_resize (GTK_WIDGET (container));
        }
        else
@@ -2413,8 +2412,6 @@ gtk_xpaned_compute_position (GtkXPaned* xpaned,
        GdkPoint old_max_position;
        gint handle_size;
        gint border_width = GTK_CONTAINER (xpaned)->border_width;
-       float fX;
-       float fY;
 
        g_return_if_fail (GTK_IS_XPANED (xpaned));
 
@@ -2425,9 +2422,6 @@ gtk_xpaned_compute_position (GtkXPaned* xpaned,
        old_max_position.x = xpaned->max_position.x;
        old_max_position.y = xpaned->max_position.y;
 
-       fX = 100.0f * (float) old_position.x / (float) allocation->width;
-       fY = 100.0f * (float) old_position.y / (float) allocation->height;
-
        xpaned->min_position.x = xpaned->top_left_child_shrink ? 0 : top_left_child_req->width;
        xpaned->min_position.y = xpaned->top_left_child_shrink ? 0 : top_left_child_req->height;
 
@@ -2575,9 +2569,6 @@ gtk_xpaned_compute_position (GtkXPaned* xpaned,
 
        xpaned->last_allocation.width = allocation->width;
        xpaned->last_allocation.height = allocation->height;
-
-       fX = 100.0f * (float) old_position.x / (float) allocation->width;
-       fY = 100.0f * (float) old_position.y / (float) allocation->height;
 }
 
 static void gtk_xpaned_set_saved_focus (GtkXPaned* xpaned, GtkWidget* widget)
@@ -2668,7 +2659,7 @@ static GtkWidget* xpaned_get_focus_widget (GtkXPaned* xpaned)
        GtkWidget* toplevel;
 
        toplevel = gtk_widget_get_toplevel (GTK_WIDGET (xpaned));
-       if (GTK_WIDGET_TOPLEVEL (toplevel))
+       if (gtk_widget_is_toplevel (toplevel))
                return GTK_WINDOW (toplevel)->focus_widget;
 
        return NULL;
@@ -3059,7 +3050,7 @@ static void gtk_xpaned_restore_focus (GtkXPaned* xpaned)
        if (gtk_widget_is_focus (GTK_WIDGET (xpaned)))
        {
                if (xpaned->priv->saved_focus &&
-                       GTK_WIDGET_SENSITIVE (xpaned->priv->saved_focus))
+                       gtk_widget_get_sensitive (xpaned->priv->saved_focus))
                {
                        gtk_widget_grab_focus (xpaned->priv->saved_focus);
                }