aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ephy-gui.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ephy-gui.c')
-rw-r--r--lib/ephy-gui.c55
1 files changed, 20 insertions, 35 deletions
diff --git a/lib/ephy-gui.c b/lib/ephy-gui.c
index 03ccab5f6..39f72b9d3 100644
--- a/lib/ephy-gui.c
+++ b/lib/ephy-gui.c
@@ -133,10 +133,9 @@ ephy_gui_menu_position_under_widget (GtkMenu *menu,
gboolean
ephy_gui_confirm_overwrite_file (GtkWidget *parent, const char *filename)
{
- char *primary_text, *question, *converted;
- GtkWidget *dialog, *hbox, *label;
- GtkWidget *image;
- gboolean res;
+ GtkWidget *dialog;
+ char *converted;
+ gboolean retval;
if (filename == NULL) return FALSE;
@@ -148,47 +147,33 @@ ephy_gui_confirm_overwrite_file (GtkWidget *parent, const char *filename)
converted = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
if (converted == NULL) return FALSE;
- primary_text = g_strdup_printf (_("A file %s already exists."),
- converted);
+ dialog = gtk_message_dialog_new
+ (parent ? GTK_WINDOW (parent) : NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_CANCEL,
+ _("A file %s already exists."), converted);
- question = g_strdup_printf ("<b><big>%s</big></b>\n\n%s", primary_text,
- _("If you choose to overwrite this file, "
- "the contents will be lost."));
+ gtk_message_dialog_format_secondary_text
+ (GTK_MESSAGE_DIALOG (dialog),
+ _("If you choose to overwrite this file, "
+ "the contents will be lost."));
- dialog = gtk_dialog_new_with_buttons (_("Overwrite File"),
- parent ? GTK_WINDOW (parent) : NULL,
- GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR,
- GTK_STOCK_CANCEL,
- GTK_RESPONSE_CANCEL,
- _("_Overwrite"), GTK_RESPONSE_ACCEPT,
- NULL);
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ _("_Overwrite"), GTK_RESPONSE_ACCEPT);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Overwrite File"));
gtk_window_set_icon_name (GTK_WINDOW (dialog), "web-browser");
- hbox = gtk_hbox_new (FALSE, 6);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 12);
- image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
- gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
- gtk_box_pack_start (GTK_BOX (hbox), image, TRUE, TRUE, 0);
-
- label = gtk_label_new (NULL);
- gtk_label_set_selectable (GTK_LABEL (label), TRUE);
- gtk_label_set_markup (GTK_LABEL (label), question);
- gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0);
- gtk_widget_show_all (hbox);
-
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dialog), TRUE);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)), 6);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CANCEL);
- res = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) ? TRUE : FALSE;
+
+ retval = (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT);
gtk_widget_destroy (dialog);
- g_free (primary_text);
- g_free (question);
g_free (converted);
- return res;
+ return retval;
}
void