diff options
author | Javier Jardón <jjardon@gnome.org> | 2010-06-03 09:36:39 +0200 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2010-07-13 19:40:47 +0200 |
commit | 7f2cc85db96afb9806fc62ce6e32c47e49a9f4d3 (patch) | |
tree | 9b4e9a147f29c3ac181d1901579c9dd16a386acc /gtk | |
parent | 80df961edb1557bae3a545e6b18871d7c4c6f566 (diff) | |
download | gtk+-7f2cc85db96afb9806fc62ce6e32c47e49a9f4d3.tar.gz |
Use accessor functions to access GtkDialog
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkcolorseldialog.c | 12 | ||||
-rw-r--r-- | gtk/gtkcustompaperunixdialog.c | 15 | ||||
-rw-r--r-- | gtk/gtkfilechooserdialog.c | 34 | ||||
-rw-r--r-- | gtk/gtkfontsel.c | 14 | ||||
-rw-r--r-- | gtk/gtkmessagedialog.c | 13 | ||||
-rw-r--r-- | gtk/gtkmountoperation.c | 12 | ||||
-rw-r--r-- | gtk/gtkpagesetupunixdialog.c | 12 | ||||
-rw-r--r-- | gtk/gtkprintbackend.c | 4 | ||||
-rw-r--r-- | gtk/gtkprintunixdialog.c | 12 | ||||
-rw-r--r-- | gtk/gtkrecentchooserdialog.c | 28 | ||||
-rw-r--r-- | gtk/tests/builder.c | 11 |
11 files changed, 114 insertions, 53 deletions
diff --git a/gtk/gtkcolorseldialog.c b/gtk/gtkcolorseldialog.c index 9de4d8144e..a203de4df1 100644 --- a/gtk/gtkcolorseldialog.c +++ b/gtk/gtkcolorseldialog.c @@ -141,23 +141,27 @@ gtk_color_selection_dialog_init (GtkColorSelectionDialog *colorseldiag) { GtkColorSelectionDialogPriv *priv; GtkDialog *dialog = GTK_DIALOG (colorseldiag); + GtkWidget *action_area, *content_area; colorseldiag->priv = G_TYPE_INSTANCE_GET_PRIVATE (colorseldiag, GTK_TYPE_COLOR_SELECTION_DIALOG, GtkColorSelectionDialogPriv); priv = colorseldiag->priv; + content_area = gtk_dialog_get_content_area (dialog); + action_area = gtk_dialog_get_action_area (dialog); + gtk_dialog_set_has_separator (dialog, FALSE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); - gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5); - gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6); + gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); + gtk_box_set_spacing (GTK_BOX (action_area), 6); priv->colorsel = gtk_color_selection_new (); gtk_container_set_border_width (GTK_CONTAINER (priv->colorsel), 5); gtk_color_selection_set_has_palette (GTK_COLOR_SELECTION (priv->colorsel), FALSE); gtk_color_selection_set_has_opacity_control (GTK_COLOR_SELECTION (priv->colorsel), FALSE); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (colorseldiag)->vbox), priv->colorsel); + gtk_container_add (GTK_CONTAINER (content_area), priv->colorsel); gtk_widget_show (priv->colorsel); priv->cancel_button = gtk_dialog_add_button (dialog, diff --git a/gtk/gtkcustompaperunixdialog.c b/gtk/gtkcustompaperunixdialog.c index cc95bec46a..ffd23e8d31 100644 --- a/gtk/gtkcustompaperunixdialog.c +++ b/gtk/gtkcustompaperunixdialog.c @@ -963,6 +963,8 @@ static void populate_dialog (GtkCustomPaperUnixDialog *dialog) { GtkCustomPaperUnixDialogPrivate *priv = dialog->priv; + GtkDialog *cpu_dialog = GTK_DIALOG (dialog); + GtkWidget *action_area, *content_area; GtkWidget *image, *table, *label, *widget, *frame, *combo; GtkWidget *hbox, *vbox, *treeview, *scrolled, *button_box, *button; GtkCellRenderer *cell; @@ -971,15 +973,18 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog) GtkTreeSelection *selection; GtkUnit user_units; - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE); + content_area = gtk_dialog_get_content_area (cpu_dialog); + action_area = gtk_dialog_get_action_area (cpu_dialog); + + gtk_dialog_set_has_separator (cpu_dialog, FALSE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6); + gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); + gtk_box_set_spacing (GTK_BOX (action_area), 6); hbox = gtk_hbox_new (FALSE, 18); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0); gtk_widget_show (hbox); vbox = gtk_vbox_new (FALSE, 6); diff --git a/gtk/gtkfilechooserdialog.c b/gtk/gtkfilechooserdialog.c index ad1f911df7..491594eac1 100644 --- a/gtk/gtkfilechooserdialog.c +++ b/gtk/gtkfilechooserdialog.c @@ -80,6 +80,7 @@ gtk_file_chooser_dialog_class_init (GtkFileChooserDialogClass *class) static void gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog) { + GtkWidget *action_area, *content_area; GtkFileChooserDialogPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog, GTK_TYPE_FILE_CHOOSER_DIALOG, GtkFileChooserDialogPrivate); @@ -88,10 +89,13 @@ gtk_file_chooser_dialog_init (GtkFileChooserDialog *dialog) dialog->priv = priv; dialog->priv->response_requested = FALSE; + content_area = gtk_dialog_get_content_area (fc_dialog); + action_area = gtk_dialog_get_action_area (fc_dialog); + gtk_dialog_set_has_separator (fc_dialog, FALSE); gtk_container_set_border_width (GTK_CONTAINER (fc_dialog), 5); - gtk_box_set_spacing (GTK_BOX (fc_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width (GTK_CONTAINER (fc_dialog->action_area), 5); + gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); /* We do a signal connection here rather than overriding the method in * class_init because GtkDialog::response is a RUN_LAST signal. We want *our* @@ -126,6 +130,8 @@ static void file_chooser_widget_file_activated (GtkFileChooser *chooser, GtkFileChooserDialog *dialog) { + GtkDialog *fc_dialog = GTK_DIALOG (dialog); + GtkWidget *action_area; GList *children, *l; if (gtk_window_activate_default (GTK_WINDOW (dialog))) @@ -134,8 +140,8 @@ file_chooser_widget_file_activated (GtkFileChooser *chooser, /* There probably isn't a default widget, so make things easier for the * programmer by looking for a reasonable button on our own. */ - - children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area)); + action_area = gtk_dialog_get_action_area (fc_dialog); + children = gtk_container_get_children (GTK_CONTAINER (action_area)); for (l = children; l; l = l->next) { @@ -143,7 +149,7 @@ file_chooser_widget_file_activated (GtkFileChooser *chooser, int response_id; widget = GTK_WIDGET (l->data); - response_id = gtk_dialog_get_response_for_widget (GTK_DIALOG (dialog), widget); + response_id = gtk_dialog_get_response_for_widget (fc_dialog, widget); if (is_stock_accept_response_id (response_id)) { gtk_widget_activate (widget); /* Should we gtk_dialog_response (dialog, response_id) instead? */ @@ -221,6 +227,8 @@ static void file_chooser_widget_response_requested (GtkWidget *widget, GtkFileChooserDialog *dialog) { + GtkDialog *fc_dialog = GTK_DIALOG (dialog); + GtkWidget *action_area; GList *children, *l; dialog->priv->response_requested = TRUE; @@ -231,8 +239,8 @@ file_chooser_widget_response_requested (GtkWidget *widget, /* There probably isn't a default widget, so make things easier for the * programmer by looking for a reasonable button on our own. */ - - children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area)); + action_area = gtk_dialog_get_action_area (fc_dialog); + children = gtk_container_get_children (GTK_CONTAINER (action_area)); for (l = children; l; l = l->next) { @@ -240,7 +248,7 @@ file_chooser_widget_response_requested (GtkWidget *widget, int response_id; widget = GTK_WIDGET (l->data); - response_id = gtk_dialog_get_response_for_widget (GTK_DIALOG (dialog), widget); + response_id = gtk_dialog_get_response_for_widget (fc_dialog, widget); if (is_stock_accept_response_id (response_id)) { gtk_widget_activate (widget); /* Should we gtk_dialog_response (dialog, response_id) instead? */ @@ -260,6 +268,7 @@ gtk_file_chooser_dialog_constructor (GType type, GObjectConstructParam *construct_params) { GtkFileChooserDialogPrivate *priv; + GtkWidget *content_area; GObject *object; object = G_OBJECT_CLASS (gtk_file_chooser_dialog_parent_class)->constructor (type, @@ -282,8 +291,10 @@ gtk_file_chooser_dialog_constructor (GType type, g_signal_connect (priv->widget, "response-requested", G_CALLBACK (file_chooser_widget_response_requested), object); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (object)); + gtk_container_set_border_width (GTK_CONTAINER (priv->widget), 5); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (content_area), priv->widget, TRUE, TRUE, 0); gtk_widget_show (priv->widget); @@ -338,7 +349,10 @@ foreach_ensure_default_response_cb (GtkWidget *widget, static void ensure_default_response (GtkFileChooserDialog *dialog) { - gtk_container_foreach (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), + GtkWidget *action_area; + + action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog)); + gtk_container_foreach (GTK_CONTAINER (action_area), foreach_ensure_default_response_cb, dialog); } diff --git a/gtk/gtkfontsel.c b/gtk/gtkfontsel.c index 9438b948ea..ae433ba9ba 100644 --- a/gtk/gtkfontsel.c +++ b/gtk/gtkfontsel.c @@ -1552,18 +1552,22 @@ static void gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag) { GtkDialog *dialog = GTK_DIALOG (fontseldiag); + GtkWidget *action_area, *content_area; + + content_area = gtk_dialog_get_content_area (dialog); + action_area = gtk_dialog_get_action_area (dialog); gtk_dialog_set_has_separator (dialog, FALSE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); - gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5); - gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6); + gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); + gtk_box_set_spacing (GTK_BOX (action_area), 6); gtk_widget_push_composite_child (); gtk_window_set_resizable (GTK_WINDOW (fontseldiag), TRUE); - fontseldiag->main_vbox = dialog->vbox; + fontseldiag->main_vbox = content_area; fontseldiag->fontsel = gtk_font_selection_new (); gtk_container_set_border_width (GTK_CONTAINER (fontseldiag->fontsel), 5); @@ -1572,7 +1576,7 @@ gtk_font_selection_dialog_init (GtkFontSelectionDialog *fontseldiag) fontseldiag->fontsel, TRUE, TRUE, 0); /* Create the action area */ - fontseldiag->action_area = dialog->action_area; + fontseldiag->action_area = action_area; fontseldiag->cancel_button = gtk_dialog_add_button (dialog, GTK_STOCK_CANCEL, diff --git a/gtk/gtkmessagedialog.c b/gtk/gtkmessagedialog.c index 2bd1d14396..7eaca4808e 100644 --- a/gtk/gtkmessagedialog.c +++ b/gtk/gtkmessagedialog.c @@ -329,10 +329,15 @@ static void gtk_message_dialog_init (GtkMessageDialog *dialog) { GtkWidget *hbox; + GtkDialog *message_dialog = GTK_DIALOG (dialog); + GtkWidget *action_area, *content_area; GtkMessageDialogPrivate *priv; priv = GTK_MESSAGE_DIALOG_GET_PRIVATE (dialog); + content_area = gtk_dialog_get_content_area (message_dialog); + action_area = gtk_dialog_get_action_area (message_dialog); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gtk_window_set_title (GTK_WINDOW (dialog), ""); gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), TRUE); @@ -369,15 +374,15 @@ gtk_message_dialog_init (GtkMessageDialog *dialog) gtk_box_pack_start (GTK_BOX (hbox), priv->message_area, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), + gtk_box_pack_start (GTK_BOX (content_area), hbox, FALSE, FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 14); /* 14 + 2 * 5 = 24 */ - gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6); + gtk_box_set_spacing (GTK_BOX (content_area), 14); /* 14 + 2 * 5 = 24 */ + gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); + gtk_box_set_spacing (GTK_BOX (action_area), 6); gtk_widget_show_all (hbox); diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c index 120ee69463..e30d13c7b0 100644 --- a/gtk/gtkmountoperation.c +++ b/gtk/gtkmountoperation.c @@ -457,6 +457,7 @@ gtk_mount_operation_ask_password (GMountOperation *mount_op, GtkWidget *hbox, *main_vbox, *vbox, *icon; GtkWidget *table; GtkWidget *message_label; + GtkWidget *content_area, *action_area; gboolean can_anonymous; guint rows; const gchar *secondary; @@ -472,12 +473,15 @@ gtk_mount_operation_ask_password (GMountOperation *mount_op, priv->dialog = dialog; + content_area = gtk_dialog_get_content_area (dialog); + action_area = gtk_dialog_get_action_area (dialog); + /* Set the dialog up with HIG properties */ gtk_dialog_set_has_separator (dialog, FALSE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); - gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5); - gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6); + gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); + gtk_box_set_spacing (GTK_BOX (action_area), 6); gtk_window_set_resizable (window, FALSE); gtk_window_set_title (window, ""); @@ -497,7 +501,7 @@ gtk_mount_operation_ask_password (GMountOperation *mount_op, /* Build contents */ hbox = gtk_hbox_new (FALSE, 12); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); - gtk_box_pack_start (GTK_BOX (dialog->vbox), hbox, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0); icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, GTK_ICON_SIZE_DIALOG); diff --git a/gtk/gtkpagesetupunixdialog.c b/gtk/gtkpagesetupunixdialog.c index 7543febb21..ff0ed19d4e 100644 --- a/gtk/gtkpagesetupunixdialog.c +++ b/gtk/gtkpagesetupunixdialog.c @@ -887,21 +887,25 @@ populate_dialog (GtkPageSetupUnixDialog *ps_dialog) GtkPageSetupUnixDialogPrivate *priv = ps_dialog->priv; GtkDialog *dialog = GTK_DIALOG (ps_dialog); GtkWidget *table, *label, *combo, *radio_button; + GtkWidget *action_area, *content_area; GtkCellRenderer *cell; gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); + content_area = gtk_dialog_get_content_area (dialog); + action_area = gtk_dialog_get_action_area (dialog); + gtk_dialog_set_has_separator (dialog, FALSE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); - gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5); - gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6); + gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); + gtk_box_set_spacing (GTK_BOX (action_area), 6); table = gtk_table_new (5, 4, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 12); gtk_container_set_border_width (GTK_CONTAINER (table), 5); - gtk_box_pack_start (GTK_BOX (dialog->vbox), table, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (content_area), table, TRUE, TRUE, 0); gtk_widget_show (table); label = gtk_label_new_with_mnemonic (_("_Format for:")); diff --git a/gtk/gtkprintbackend.c b/gtk/gtkprintbackend.c index bdb6a1d2cc..f12f237b28 100644 --- a/gtk/gtkprintbackend.c +++ b/gtk/gtkprintbackend.c @@ -733,6 +733,7 @@ request_password (GtkPrintBackend *backend, GtkPrintBackendPrivate *priv = backend->priv; GtkWidget *dialog, *box, *main_box, *label, *icon, *vbox, *entry; GtkWidget *focus = NULL; + GtkWidget *content_area; gchar *markup; gint length; gint i; @@ -775,7 +776,8 @@ request_password (GtkPrintBackend *backend, /* Packing */ - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), main_box, TRUE, FALSE, 0); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); + gtk_box_pack_start (GTK_BOX (content_area), main_box, TRUE, FALSE, 0); gtk_box_pack_start (GTK_BOX (main_box), icon, FALSE, FALSE, 6); gtk_box_pack_start (GTK_BOX (main_box), vbox, FALSE, FALSE, 6); diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c index 757b4234f3..c6d6d0fe07 100644 --- a/gtk/gtkprintunixdialog.c +++ b/gtk/gtkprintunixdialog.c @@ -3768,16 +3768,20 @@ populate_dialog (GtkPrintUnixDialog *print_dialog) GtkPrintUnixDialogPrivate *priv = print_dialog->priv; GtkDialog *dialog = GTK_DIALOG (print_dialog); GtkWidget *vbox, *conflict_hbox, *image, *label; + GtkWidget *action_area, *content_area; + + content_area = gtk_dialog_get_content_area (dialog); + action_area = gtk_dialog_get_action_area (dialog); gtk_dialog_set_has_separator (dialog, FALSE); gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); - gtk_box_set_spacing (GTK_BOX (dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 5); - gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6); + gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); + gtk_box_set_spacing (GTK_BOX (action_area), 6); vbox = gtk_vbox_new (FALSE, 6); gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); - gtk_box_pack_start (GTK_BOX (dialog->vbox), vbox, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0); gtk_widget_show (vbox); priv->notebook = gtk_notebook_new (); diff --git a/gtk/gtkrecentchooserdialog.c b/gtk/gtkrecentchooserdialog.c index e8f5b6b5ac..03de36c406 100644 --- a/gtk/gtkrecentchooserdialog.c +++ b/gtk/gtkrecentchooserdialog.c @@ -131,6 +131,8 @@ gtk_recent_chooser_dialog_class_init (GtkRecentChooserDialogClass *klass) static void gtk_recent_chooser_dialog_init (GtkRecentChooserDialog *dialog) { + GtkWidget *content_area, *action_area; + GtkRecentChooserDialogPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog, GTK_TYPE_RECENT_CHOOSER_DIALOG, GtkRecentChooserDialogPrivate); @@ -138,10 +140,13 @@ gtk_recent_chooser_dialog_init (GtkRecentChooserDialog *dialog) dialog->priv = priv; + content_area = gtk_dialog_get_content_area (rc_dialog); + action_area = gtk_dialog_get_action_area (rc_dialog); + gtk_dialog_set_has_separator (rc_dialog, FALSE); gtk_container_set_border_width (GTK_CONTAINER (rc_dialog), 5); - gtk_box_set_spacing (GTK_BOX (rc_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */ - gtk_container_set_border_width (GTK_CONTAINER (rc_dialog->action_area), 5); + gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); } @@ -152,15 +157,19 @@ static void gtk_recent_chooser_item_activated_cb (GtkRecentChooser *chooser, gpointer user_data) { + GtkDialog *rc_dialog; GtkRecentChooserDialog *dialog; + GtkWidget *action_area; GList *children, *l; dialog = GTK_RECENT_CHOOSER_DIALOG (user_data); + rc_dialog = GTK_DIALOG (dialog); if (gtk_window_activate_default (GTK_WINDOW (dialog))) return; - - children = gtk_container_get_children (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area)); + + action_area = gtk_dialog_get_action_area (rc_dialog); + children = gtk_container_get_children (GTK_CONTAINER (action_area)); for (l = children; l; l = l->next) { @@ -168,7 +177,7 @@ gtk_recent_chooser_item_activated_cb (GtkRecentChooser *chooser, gint response_id; widget = GTK_WIDGET (l->data); - response_id = gtk_dialog_get_response_for_widget (GTK_DIALOG (dialog), widget); + response_id = gtk_dialog_get_response_for_widget (rc_dialog, widget); if (response_id == GTK_RESPONSE_ACCEPT || response_id == GTK_RESPONSE_OK || @@ -191,9 +200,10 @@ gtk_recent_chooser_dialog_constructor (GType type, guint n_construct_properties, GObjectConstructParam *construct_params) { - GObject *object; GtkRecentChooserDialogPrivate *priv; - + GtkWidget *content_area; + GObject *object; + object = G_OBJECT_CLASS (gtk_recent_chooser_dialog_parent_class)->constructor (type, n_construct_properties, construct_params); @@ -212,8 +222,10 @@ gtk_recent_chooser_dialog_constructor (GType type, G_CALLBACK (gtk_recent_chooser_item_activated_cb), object); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (object)); + gtk_container_set_border_width (GTK_CONTAINER (priv->chooser), 5); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), + gtk_box_pack_start (GTK_BOX (content_area), priv->chooser, TRUE, TRUE, 0); gtk_widget_show (priv->chooser); diff --git a/gtk/tests/builder.c b/gtk/tests/builder.c index d053ed97a1..b45cc414f3 100644 --- a/gtk/tests/builder.c +++ b/gtk/tests/builder.c @@ -970,6 +970,7 @@ static void test_children (void) { GtkBuilder * builder; + GtkWidget *content_area, *dialog_action_area; GList *children; const gchar buffer1[] = "<interface>" @@ -1023,20 +1024,22 @@ test_children (void) g_list_free (children); vbox = gtk_builder_get_object (builder, "dialog1-vbox"); + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); g_assert (vbox != NULL); g_assert (GTK_IS_VBOX (vbox)); g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (GTK_WIDGET (vbox)->parent)), "dialog1") == 0); g_assert (gtk_container_get_border_width (GTK_CONTAINER (vbox)) == 10); - g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (GTK_DIALOG (dialog)->vbox)), "dialog1-vbox") == 0); + g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (content_area)), "dialog1-vbox") == 0); action_area = gtk_builder_get_object (builder, "dialog1-action_area"); + dialog_action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog)); g_assert (action_area != NULL); g_assert (GTK_IS_HBUTTON_BOX (action_area)); g_assert (GTK_WIDGET (action_area)->parent != NULL); g_assert (gtk_container_get_border_width (GTK_CONTAINER (action_area)) == 20); - g_assert (GTK_DIALOG (dialog)->action_area != NULL); - g_assert (gtk_buildable_get_name (GTK_BUILDABLE (GTK_DIALOG (dialog)->action_area)) != NULL); - g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (GTK_DIALOG (dialog)->action_area)), "dialog1-action_area") == 0); + g_assert (dialog_action_area != NULL); + g_assert (gtk_buildable_get_name (GTK_BUILDABLE (action_area)) != NULL); + g_assert (strcmp (gtk_buildable_get_name (GTK_BUILDABLE (dialog_action_area)), "dialog1-action_area") == 0); gtk_widget_destroy (GTK_WIDGET (dialog)); g_object_unref (builder); } |