[gnome-commander] Reverted last commit, fixed using gtk_message_dialog_set_markup



commit a8a5c190e16963f03705d5a689c5874b8e8ac4e9
Author: Uwe Scholz <uwescholz src gnome org>
Date:   Wed Feb 5 15:42:47 2014 +0100

    Reverted last commit, fixed using gtk_message_dialog_set_markup

 src/gnome-cmd-xfer.cc |   18 ++++++---------
 src/utils.cc          |   55 +-----------------------------------------------
 src/utils.h           |    6 -----
 3 files changed, 9 insertions(+), 70 deletions(-)
---
diff --git a/src/gnome-cmd-xfer.cc b/src/gnome-cmd-xfer.cc
index d28750e..da399a8 100644
--- a/src/gnome-cmd-xfer.cc
+++ b/src/gnome-cmd-xfer.cc
@@ -180,11 +180,9 @@ static gint async_xfer_callback (GnomeVFSAsyncHandle *handle, GnomeVFSXferProgre
         gchar *source_details = file_details (info->source_name);
         gchar *target_details = file_details (info->target_name);
 
-        gchar *msg1 = g_strdup_printf (_("Overwrite file:\n\n"));
-        gchar *msg2 = g_strdup_printf (_("%s\n"),target_filename);
-        gchar *msg3 = g_strdup_printf (_("%s\n\nWith:\n\n"),target_details);
-        gchar *msg4 = g_strdup_printf (_("%s\n"),source_filename);
-        gchar *msg5 = g_strdup_printf (_("%s"), source_details);
+       GtkWidget *msg;
+
+        gchar *text = g_strdup_printf (_("Overwrite file:\n\n<b>%s</b>\n<span color='dimgray' 
size='smaller'>%s</span>\n\nWith:\n\n<b>%s</b>\n<span color='dimgray' size='smaller'>%s</span>"), 
target_filename, target_details, source_filename, source_details);
 
         g_free (source_filename);
         g_free (target_filename);
@@ -192,13 +190,11 @@ static gint async_xfer_callback (GnomeVFSAsyncHandle *handle, GnomeVFSXferProgre
         g_free (target_details);
 
         gdk_threads_enter ();
-        gint ret = run_overwrite_warning_dialog (*main_win, FALSE, GTK_MESSAGE_QUESTION, msg1, msg2, msg3, 
msg4, msg5, " ",
+
+        gint ret = run_simple_dialog (*main_win, FALSE, GTK_MESSAGE_QUESTION, text, " ",
                                                 1, _("Abort"), _("Replace"), _("Replace All"), _("Skip"), 
_("Skip All"), NULL);
-        g_free (msg1);
-        g_free (msg2);
-        g_free (msg3);
-        g_free (msg4);
-        g_free (msg5);
+       g_free(text);
+
         data->prev_status = GNOME_VFS_XFER_PROGRESS_STATUS_OVERWRITE;
         gdk_threads_leave ();
         return ret==-1 ? 0 : ret;
diff --git a/src/utils.cc b/src/utils.cc
index 82d5b9c..c66dfca 100644
--- a/src/utils.cc
+++ b/src/utils.cc
@@ -184,7 +184,8 @@ gint run_simple_dialog (GtkWidget *parent, gboolean ignore_close_box,
     button_titles = convert_varargs_to_name_array (button_title_args);
     va_end (button_title_args);
 
-    dialog = gtk_message_dialog_new_with_markup (*main_win, GTK_DIALOG_MODAL, msg_type, GTK_BUTTONS_NONE, 
"%s", text);
+    dialog = gtk_message_dialog_new (*main_win, GTK_DIALOG_MODAL, msg_type, GTK_BUTTONS_NONE, NULL);
+    gtk_message_dialog_set_markup (GTK_MESSAGE_DIALOG (dialog), text);
 
     if (title)
         gtk_window_set_title (GTK_WINDOW (dialog), title);
@@ -218,58 +219,6 @@ gint run_simple_dialog (GtkWidget *parent, gboolean ignore_close_box,
     return result;
 }
 
-gint run_overwrite_warning_dialog (GtkWidget *parent, gboolean ignore_close_box,
-                                  GtkMessageType msg_type,
-                                  const char *textmsg1, const char *textmsg2, 
-                                  const char *textmsg3, const char *textmsg4, 
-                                  const char *textmsg5, const char *title, gint def_response, ...)
-{
-    va_list button_title_args;
-    const char **button_titles;
-    GtkWidget *dialog;
-    // GtkWidget *top_widget;
-    int result;
-
-    // Create the dialog.
-    va_start (button_title_args, def_response);
-    button_titles = convert_varargs_to_name_array (button_title_args);
-    va_end (button_title_args);
-
-    dialog = gtk_message_dialog_new_with_markup (*main_win, GTK_DIALOG_MODAL, msg_type, GTK_BUTTONS_NONE, 
"%s<b>%s</b><span color='dimgray' size='smaller'>%s</span><b>%s</b><span color='dimgray' 
size='smaller'>%s</span>", textmsg1, textmsg2, textmsg3, textmsg4, textmsg5);
-
-    if (title)
-        gtk_window_set_title (GTK_WINDOW (dialog), title);
-
-    for (int i=0; button_titles[i]; i++)
-        gtk_dialog_add_button (GTK_DIALOG (dialog), button_titles[i], i);
-
-    g_free (button_titles);
-
-    if (def_response>=0)
-        gtk_dialog_set_default_response (GTK_DIALOG (dialog), def_response);
-
-    // Allow close.
-    if (ignore_close_box)
-        g_signal_connect (dialog, "delete-event", G_CALLBACK (delete_event_callback), NULL);
-    else
-        g_signal_connect (dialog, "key-press-event", G_CALLBACK (on_run_dialog_keypress), dialog);
-
-    gtk_window_set_wmclass (GTK_WINDOW (dialog), "dialog", "Eel");
-
-    // Run it.
-    do
-    {
-        gtk_widget_show (dialog);
-        result = gtk_dialog_run (GTK_DIALOG (dialog));
-    }
-    while (ignore_close_box && result == GTK_RESPONSE_DELETE_EVENT);
-
-    gtk_widget_destroy (dialog);
-
-    return result;
-}
-
-
 gchar *str_uri_basename (const gchar *uri)
 {
     if (!uri)
diff --git a/src/utils.h b/src/utils.h
index abe4690..792d264 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -67,12 +67,6 @@ gint run_simple_dialog (GtkWidget *parent, gboolean ignore_close_box,
                         GtkMessageType msg_type,
                         const char *text, const char *title, gint def_response, ...);
 
-gint run_overwrite_warning_dialog (GtkWidget *parent, gboolean ignore_close_box,
-                                  GtkMessageType msg_type,
-                                  const char *textmsg1, const char *textmsg2, 
-                                  const char *textmsg3, const char *textmsg4, 
-                                  const char *textmsg5, const char *title, gint def_response, ...);
-
 inline gboolean string2int (const gchar *s, gint &i)
 {
     return sscanf (s, "%d", &i) == 1;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]