aboutsummaryrefslogtreecommitdiffstats
path: root/embed/ephy-embed.c
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2010-06-08 13:14:53 +0800
committerDiego Escalante Urrelo <descalante@igalia.com>2010-06-12 03:59:59 +0800
commit0680a9c0802bcf6df9d0e497e7528458b52e582a (patch)
treef43654764ea502ea4ead87752d9aeac33602d670 /embed/ephy-embed.c
parentcb35325a30fae5edcedaebe10108713196421e72 (diff)
downloadgsoc2013-epiphany-0680a9c0802bcf6df9d0e497e7528458b52e582a.tar
gsoc2013-epiphany-0680a9c0802bcf6df9d0e497e7528458b52e582a.tar.gz
gsoc2013-epiphany-0680a9c0802bcf6df9d0e497e7528458b52e582a.tar.bz2
gsoc2013-epiphany-0680a9c0802bcf6df9d0e497e7528458b52e582a.tar.lz
gsoc2013-epiphany-0680a9c0802bcf6df9d0e497e7528458b52e582a.tar.xz
gsoc2013-epiphany-0680a9c0802bcf6df9d0e497e7528458b52e582a.tar.zst
gsoc2013-epiphany-0680a9c0802bcf6df9d0e497e7528458b52e582a.zip
ephy-embed: clean up confirm_action_from_mime
Avoid duplication of code. Bug #621050
Diffstat (limited to 'embed/ephy-embed.c')
-rw-r--r--embed/ephy-embed.c71
1 files changed, 36 insertions, 35 deletions
diff --git a/embed/ephy-embed.c b/embed/ephy-embed.c
index 6bfe68b90..8ac2325f3 100644
--- a/embed/ephy-embed.c
+++ b/embed/ephy-embed.c
@@ -561,6 +561,9 @@ confirm_action_from_mime (WebKitWebView *web_view,
int default_response;
WebKitNetworkResponse *response;
SoupMessage *message;
+ GtkMessageType mtype;
+ char *title;
+ char *secondary;
parent_window = gtk_widget_get_toplevel (GTK_WIDGET(web_view));
if (!gtk_widget_is_toplevel (parent_window))
@@ -603,46 +606,44 @@ confirm_action_from_mime (WebKitWebView *web_view,
suggested_filename = webkit_download_get_suggested_filename (download);
if (mime_permission != EPHY_MIME_PERMISSION_SAFE && helper_app) {
- dialog = gtk_message_dialog_new (GTK_WINDOW (parent_window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
- _("Download this potentially unsafe file?"));
-
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- /* translators: First %s is the file type description,
- Second %s is the file name */
- _("File Type: “%s”.\n\nIt is unsafe to open “%s” as "
- "it could potentially damage your documents or "
- "invade your privacy. You can download it instead."),
- mime_description, suggested_filename);
+ title = _("Download this potentially unsafe file?");
+ mtype = GTK_MESSAGE_WARNING;
+ /* translators: First %s is the file type description, second %s is the
+ * file name */
+ secondary = g_strdup_printf (_("File Type: “%s”.\n\nIt is unsafe to open "
+ "“%s” as it could potentially damage your "
+ "documents or invade your privacy. "
+ "You can download it instead."),
+ mime_description, suggested_filename);
+
action_label = STOCK_DOWNLOAD;
} else if (action == DOWNLOAD_ACTION_OPEN && helper_app) {
- dialog = gtk_message_dialog_new (GTK_WINDOW (parent_window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
- _("Open this file?"));
-
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- /* translators: First %s is the file type description,
- Second %s is the file name,
- Third %s is the application used to open the file */
- _("File Type: “%s”.\n\nYou can open “%s” using “%s” or save it."),
- mime_description, suggested_filename,
- g_app_info_get_name (helper_app));
+ title = _("Open this file?");
+ mtype = GTK_MESSAGE_QUESTION;
+ /* translators: First %s is the file type description, second %s is the
+ * file name, third %s is the application used to open the file */
+ secondary = g_strdup_printf (_("File Type: “%s”.\n\nYou can open “%s” "
+ "using “%s” or save it."),
+ mime_description, suggested_filename,
+ g_app_info_get_name (helper_app));
} else {
- dialog = gtk_message_dialog_new (GTK_WINDOW (parent_window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
- _("Download this file?"));
-
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
- /* translators: First %s is the file type description,
- Second %s is the file name */
- _("File Type: “%s”.\n\nYou have no application able to open “%s”. "
- "You can download it instead."),
- mime_description, suggested_filename);
+ title = _("Download this file?");
+ mtype = GTK_MESSAGE_QUESTION;
+ /* translators: First %s is the file type description, second %s is the
+ * file name */
+ secondary = g_strdup_printf (_("File Type: “%s”.\n\nYou have no "
+ "application able to open “%s”. "
+ "You can download it instead."),
+ mime_description, suggested_filename);
}
+ dialog = gtk_message_dialog_new (GTK_WINDOW (parent_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ mtype, GTK_BUTTONS_NONE,
+ title);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ secondary, NULL);
+
g_free (mime_description);
button = gtk_button_new_with_mnemonic (_("_Save As..."));