From 98e9bcffa0cc8ed6f831138545864f939c28aa29 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Mon, 27 May 2013 12:27:53 +0200 Subject: [PATCH] PsppireButtonBox: Remove dependence on flags deprecated in Gtk3 --- src/ui/gui/psppire-hbuttonbox.c | 15 ++++----------- src/ui/gui/psppire-vbuttonbox.c | 16 ++++------------ 2 files changed, 8 insertions(+), 23 deletions(-) diff --git a/src/ui/gui/psppire-hbuttonbox.c b/src/ui/gui/psppire-hbuttonbox.c index d200b9d087..c86d470725 100644 --- a/src/ui/gui/psppire-hbuttonbox.c +++ b/src/ui/gui/psppire-hbuttonbox.c @@ -37,7 +37,6 @@ static void gtk_hbutton_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static const GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE; GType psppire_hbutton_box_get_type (void) @@ -115,8 +114,7 @@ gtk_hbutton_box_size_request (GtkWidget *widget, bbox = GTK_BUTTON_BOX (widget); spacing = gtk_box_get_spacing (box); - layout = gtk_button_box_get_layout (bbox) != GTK_BUTTONBOX_DEFAULT_STYLE - ? gtk_button_box_get_layout (bbox) : default_layout_style; + layout = gtk_button_box_get_layout (bbox) ; _psppire_button_box_child_requisition (widget, &nvis_children, @@ -137,14 +135,12 @@ gtk_hbutton_box_size_request (GtkWidget *widget, requisition->width = nvis_children*child_width + ((nvis_children+1)*spacing); break; + default: case GTK_BUTTONBOX_EDGE: case GTK_BUTTONBOX_START: case GTK_BUTTONBOX_END: requisition->width = nvis_children*child_width + ((nvis_children-1)*spacing); break; - default: - g_assert_not_reached(); - break; } requisition->height = child_height; @@ -180,8 +176,7 @@ gtk_hbutton_box_size_allocate (GtkWidget *widget, base_box = GTK_BOX (widget); box = GTK_BUTTON_BOX (widget); spacing = gtk_box_get_spacing (base_box); - layout = gtk_button_box_get_layout (box) != GTK_BUTTONBOX_DEFAULT_STYLE - ? gtk_button_box_get_layout (box) : default_layout_style; + layout = gtk_button_box_get_layout (box) ; _psppire_button_box_child_requisition (widget, &nvis_children, &n_secondaries, @@ -196,6 +191,7 @@ gtk_hbutton_box_size_allocate (GtkWidget *widget, x = allocation->x + gtk_container_get_border_width (GTK_CONTAINER (box)) + childspacing; secondary_x = x + ((nvis_children - n_secondaries) * (child_width + childspacing)); break; + default: case GTK_BUTTONBOX_EDGE: if (nvis_children >= 2) { @@ -226,9 +222,6 @@ gtk_hbutton_box_size_allocate (GtkWidget *widget, - gtk_container_get_border_width (GTK_CONTAINER (box)); secondary_x = allocation->x + gtk_container_get_border_width (GTK_CONTAINER (box)); break; - default: - g_assert_not_reached(); - break; } diff --git a/src/ui/gui/psppire-vbuttonbox.c b/src/ui/gui/psppire-vbuttonbox.c index 2af878f38e..8c6d25afbe 100644 --- a/src/ui/gui/psppire-vbuttonbox.c +++ b/src/ui/gui/psppire-vbuttonbox.c @@ -37,8 +37,6 @@ static void gtk_vbutton_box_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static const GtkButtonBoxStyle default_layout_style = GTK_BUTTONBOX_EDGE; - GType psppire_vbutton_box_get_type (void) { @@ -115,8 +113,7 @@ gtk_vbutton_box_size_request (GtkWidget *widget, bbox = GTK_BUTTON_BOX (widget); spacing = gtk_box_get_spacing (box); - layout = gtk_button_box_get_layout (bbox) != GTK_BUTTONBOX_DEFAULT_STYLE - ? gtk_button_box_get_layout (bbox) : default_layout_style; + layout = gtk_button_box_get_layout (bbox); _psppire_button_box_child_requisition (widget, &nvis_children, @@ -140,12 +137,10 @@ gtk_vbutton_box_size_request (GtkWidget *widget, case GTK_BUTTONBOX_EDGE: case GTK_BUTTONBOX_START: case GTK_BUTTONBOX_END: + default: requisition->height = nvis_children*child_height + ((nvis_children-1)*spacing); break; - default: - g_assert_not_reached(); - break; } requisition->width = child_width; } @@ -180,8 +175,7 @@ gtk_vbutton_box_size_allocate (GtkWidget *widget, base_box = GTK_BOX (widget); box = GTK_BUTTON_BOX (widget); spacing = gtk_box_get_spacing (base_box); - layout = gtk_button_box_get_layout (box) != GTK_BUTTONBOX_DEFAULT_STYLE - ? gtk_button_box_get_layout (box) : default_layout_style; + layout = gtk_button_box_get_layout (box) ; _psppire_button_box_child_requisition (widget, &nvis_children, &n_secondaries, @@ -197,6 +191,7 @@ gtk_vbutton_box_size_allocate (GtkWidget *widget, secondary_y = y + ((nvis_children - n_secondaries) * (child_height + childspacing)); break; case GTK_BUTTONBOX_EDGE: + default: if (nvis_children >= 2) { childspacing = (height - (nvis_children*child_height)) / (nvis_children-1); @@ -226,9 +221,6 @@ gtk_vbutton_box_size_allocate (GtkWidget *widget, - gtk_container_get_border_width (GTK_CONTAINER (box)); secondary_y = allocation->y + gtk_container_get_border_width (GTK_CONTAINER (box)); break; - default: - g_assert_not_reached(); - break; } x = allocation->x + (allocation->width - child_width) / 2; -- 2.30.2