[gnome-commander] Added gnome_cmd_prompt_message() as a wrapper for gtk_message_dialog_new() + gtk_dialog_run()



commit 8d5856126c143c16b8339bb0feb38df978d6fcc8
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Thu Dec 30 19:50:47 2010 +0100

    Added gnome_cmd_prompt_message() as a wrapper for gtk_message_dialog_new() + gtk_dialog_run()

 src/utils.h |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/utils.h b/src/utils.h
index 06178dc..9288e4c 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -261,19 +261,25 @@ void gnome_cmd_toggle_file_name_selection (GtkWidget *entry);
 
 gboolean gnome_cmd_prepend_su_to_vector (int &argc, char **&argv);
 
-inline void gnome_cmd_show_message (GtkWindow *parent, std::string message, const gchar *secondary_text=NULL)
+
+inline gint gnome_cmd_prompt_message (GtkWindow *parent, GtkMessageType type, GtkButtonsType buttons, const gchar *message, const gchar *secondary_text=NULL)
 {
-    GtkWidget *dlg = gtk_message_dialog_new (parent,
-                                             GTK_DIALOG_DESTROY_WITH_PARENT,
-                                             GTK_MESSAGE_ERROR,
-                                             GTK_BUTTONS_OK,
-                                             message.c_str());
+    GtkWidget *dlg = gtk_message_dialog_new (parent, GTK_DIALOG_DESTROY_WITH_PARENT, type, buttons, message);
 
     if (secondary_text)
         gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dlg), secondary_text);
 
-    gtk_dialog_run (GTK_DIALOG (dlg));
+    gint result = gtk_dialog_run (GTK_DIALOG (dlg));
+
     gtk_widget_destroy (dlg);
+
+    return result;
+}
+
+
+inline void gnome_cmd_show_message (GtkWindow *parent, std::string message, const gchar *secondary_text=NULL)
+{
+    gnome_cmd_prompt_message (parent, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, message.c_str(), secondary_text);
 }
 
 
@@ -290,7 +296,7 @@ inline void gnome_cmd_help_display (const gchar *file_name, const gchar *link_id
 
 inline void gnome_cmd_error_message (const gchar *title, GError *error)
 {
-    gnome_cmd_show_message (NULL, title, error->message);
+    gnome_cmd_prompt_message (NULL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, title, error->message);
     g_error_free (error);
 }
 



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