psppire_dialog_close (dialog);
}
+static gboolean
+is_acceptable (GtkWidget *w)
+{
+ GtkWidget *toplevel = gtk_widget_get_toplevel (w);
+
+ return (PSPPIRE_IS_DIALOG (toplevel)
+ && psppire_dialog_is_acceptable (PSPPIRE_DIALOG (toplevel)));
+}
static void
close_dialog (GtkWidget *w, gpointer data)
static void
continue_button_clicked (GtkWidget *w, gpointer data)
{
- close_and_respond (w, PSPPIRE_RESPONSE_CONTINUE);
+ if (is_acceptable (w))
+ close_and_respond (w, PSPPIRE_RESPONSE_CONTINUE);
}
static void
ok_button_clicked (GtkWidget *w, gpointer data)
{
- close_and_respond (w, GTK_RESPONSE_OK);
+ if (is_acceptable (w))
+ close_and_respond (w, GTK_RESPONSE_OK);
}
static void
paste_button_clicked (GtkWidget *w, gpointer data)
{
- close_and_respond (w, PSPPIRE_RESPONSE_PASTE);
+ if (is_acceptable (w))
+ close_and_respond (w, PSPPIRE_RESPONSE_PASTE);
}
static void
goto_button_clicked (GtkWidget *w, gpointer data)
{
- close_and_respond (w, PSPPIRE_RESPONSE_GOTO);
+ if (is_acceptable (w))
+ close_and_respond (w, PSPPIRE_RESPONSE_GOTO);
}
{
bb->def = PSPPIRE_BUTTON_CONTINUE;
- bb->button[PSPPIRE_BUTTON_OK] = gtk_button_new_from_stock (GTK_STOCK_OK);
+ bb->button[PSPPIRE_BUTTON_OK] = gtk_button_new_with_label (_("OK"));
psppire_box_pack_start_defaults (GTK_BOX (bb), bb->button[PSPPIRE_BUTTON_OK]);
g_signal_connect (bb->button[PSPPIRE_BUTTON_OK], "clicked",
G_CALLBACK (ok_button_clicked), NULL);
bb->button[PSPPIRE_BUTTON_GOTO] =
- gtk_button_new_from_stock (GTK_STOCK_JUMP_TO);
+ gtk_button_new_with_label (_("Go To"));
psppire_box_pack_start_defaults (GTK_BOX (bb), bb->button[PSPPIRE_BUTTON_GOTO]);
g_signal_connect (bb->button[PSPPIRE_BUTTON_GOTO], "clicked",
G_CALLBACK (goto_button_clicked), NULL);
- bb->button[PSPPIRE_BUTTON_PASTE] = gtk_button_new_from_stock (GTK_STOCK_PASTE);
+ bb->button[PSPPIRE_BUTTON_PASTE] = gtk_button_new_with_label (_("Paste"));
g_signal_connect (bb->button[PSPPIRE_BUTTON_PASTE], "clicked",
G_CALLBACK (paste_button_clicked), NULL);
psppire_box_pack_start_defaults (GTK_BOX (bb), bb->button[PSPPIRE_BUTTON_PASTE]);
g_object_set (bb->button[PSPPIRE_BUTTON_PASTE], "no-show-all", TRUE, NULL);
- bb->button[PSPPIRE_BUTTON_CANCEL] = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
+ bb->button[PSPPIRE_BUTTON_CANCEL] = gtk_button_new_with_label (_("Cancel"));
g_signal_connect (bb->button[PSPPIRE_BUTTON_CANCEL], "clicked",
G_CALLBACK (close_dialog), NULL);
psppire_box_pack_start_defaults (GTK_BOX (bb), bb->button[PSPPIRE_BUTTON_CANCEL]);
g_object_set (bb->button[PSPPIRE_BUTTON_CANCEL], "no-show-all", TRUE, NULL);
- bb->button[PSPPIRE_BUTTON_CLOSE] = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
+ bb->button[PSPPIRE_BUTTON_CLOSE] = gtk_button_new_with_label (_("Close"));
g_signal_connect (bb->button[PSPPIRE_BUTTON_CLOSE], "clicked",
G_CALLBACK (close_dialog), NULL);
psppire_box_pack_start_defaults (GTK_BOX (bb), bb->button[PSPPIRE_BUTTON_CLOSE]);
g_object_set (bb->button[PSPPIRE_BUTTON_CLOSE], "no-show-all", TRUE, NULL);
- bb->button[PSPPIRE_BUTTON_RESET] = gtk_button_new_from_stock ("pspp-stock-reset");
+ bb->button[PSPPIRE_BUTTON_RESET] = gtk_button_new_with_label (_("Reset"));
g_signal_connect (bb->button[PSPPIRE_BUTTON_RESET], "clicked",
G_CALLBACK (refresh_clicked), NULL);
psppire_box_pack_start_defaults (GTK_BOX (bb), bb->button[PSPPIRE_BUTTON_RESET]);
g_object_set (bb->button[PSPPIRE_BUTTON_RESET], "no-show-all", TRUE, NULL);
- bb->button[PSPPIRE_BUTTON_HELP] = gtk_button_new_from_stock (GTK_STOCK_HELP);
+ bb->button[PSPPIRE_BUTTON_HELP] = gtk_button_new_with_label (_("Help"));
g_signal_connect (bb->button[PSPPIRE_BUTTON_HELP], "clicked",
G_CALLBACK (help_clicked), NULL);
psppire_box_pack_start_defaults (GTK_BOX (bb), bb->button[PSPPIRE_BUTTON_HELP]);
}
-/* This function is lifted verbatim from the Gtk2.10.6 library */
-
+/* This function was lifted verbatim from the Gtk2.10.6 library.
+ But later modified to fit Gtk2.24
+ */
void
_psppire_button_box_child_requisition (GtkWidget *widget,
int *nvis_children,
int *height)
{
GtkButtonBox *bbox;
- GtkBoxChild *child;
GList *children;
gint nchildren;
gint nsecondaries;
"child-internal-pad-y", &ipad_y_default,
NULL);
- child_min_width = bbox->child_min_width != GTK_BUTTONBOX_DEFAULT
- ? bbox->child_min_width : width_default;
- child_min_height = bbox->child_min_height !=GTK_BUTTONBOX_DEFAULT
- ? bbox->child_min_height : height_default;
- ipad_x = bbox->child_ipad_x != GTK_BUTTONBOX_DEFAULT
- ? bbox->child_ipad_x : ipad_x_default;
- ipad_y = bbox->child_ipad_y != GTK_BUTTONBOX_DEFAULT
- ? bbox->child_ipad_y : ipad_y_default;
+ child_min_width = width_default;
+ child_min_height = height_default;
+ ipad_x = ipad_x_default;
+ ipad_y = ipad_y_default;
nchildren = 0;
nsecondaries = 0;
- children = GTK_BOX(bbox)->children;
+
needed_width = child_min_width;
needed_height = child_min_height;
ipad_w = ipad_x * 2;
ipad_h = ipad_y * 2;
+ children = gtk_container_get_children (GTK_CONTAINER (bbox));
while (children)
{
- child = children->data;
+ GtkWidget *child = children->data;
children = children->next;
- if (gtk_widget_get_visible (child->widget))
+ if (gtk_widget_get_visible (child))
{
+ gboolean is_secondary = FALSE;
nchildren += 1;
- gtk_widget_size_request (child->widget, &child_requisition);
+ gtk_widget_get_preferred_size (child, NULL, &child_requisition);
if (child_requisition.width + ipad_w > needed_width)
needed_width = child_requisition.width + ipad_w;
if (child_requisition.height + ipad_h > needed_height)
needed_height = child_requisition.height + ipad_h;
- if (child->is_secondary)
+
+ gtk_container_child_get (GTK_CONTAINER (bbox), child, "secondary", &is_secondary, NULL);
+
+ if (is_secondary)
nsecondaries++;
}
}