diff options
| author | Kris De Gussem <kris.degussem@gmail.com> | 2014-01-11 11:08:00 +0000 |
|---|---|---|
| committer | Kris <Kris.De.Gussem@hotmail.com> | 2014-01-11 11:08:00 +0000 |
| commit | 5105f4e289edeb4d0528dff54dbd8e33f98b6cad (patch) | |
| tree | eab28095e2f1c9ef51ca0d35290a3fb76c0b4ca9 /src | |
| parent | suppress compiler warnings (diff) | |
| download | inkscape-5105f4e289edeb4d0528dff54dbd8e33f98b6cad.tar.gz inkscape-5105f4e289edeb4d0528dff54dbd8e33f98b6cad.zip | |
gtkmmification (seems there is more margin in desktop-widget.cpp)
(bzr r12915)
Diffstat (limited to 'src')
| -rw-r--r-- | src/desktop.cpp | 2 | ||||
| -rw-r--r-- | src/desktop.h | 2 | ||||
| -rw-r--r-- | src/file.cpp | 7 | ||||
| -rw-r--r-- | src/ui/view/edit-widget-interface.h | 2 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.cpp | 25 | ||||
| -rw-r--r-- | src/widgets/desktop-widget.h | 4 |
6 files changed, 15 insertions, 27 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp index e24d7eef0..cd2d1177d 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -1298,7 +1298,7 @@ bool SPDesktop::showInfoDialog( Glib::ustring const & message ) } bool -SPDesktop::warnDialog (gchar *text) +SPDesktop::warnDialog (Glib::ustring const &text) { return _widget->warnDialog (text); } diff --git a/src/desktop.h b/src/desktop.h index faaa7e3a5..d3f2d082a 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -356,7 +356,7 @@ public: Gtk::Window* getToplevel(); void presentWindow(); bool showInfoDialog( Glib::ustring const &message ); - bool warnDialog (gchar *text); + bool warnDialog (Glib::ustring const &text); void toggleRulers(); void toggleScrollbars(); void layoutWidget(); diff --git a/src/file.cpp b/src/file.cpp index babc4df99..35039fed3 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -360,11 +360,8 @@ void sp_file_revert_dialog() bool do_revert = true; if (doc->isModifiedSinceSave()) { - gchar *text = g_strdup_printf(_("Changes will be lost! Are you sure you want to reload document %s?"), uri); - - bool response = desktop->warnDialog (text); - g_free(text); - + Glib::ustring tmpString = Glib::ustring::compose(_("Changes will be lost! Are you sure you want to reload document %1?"), uri); + bool response = desktop->warnDialog (tmpString); if (!response) { do_revert = false; } diff --git a/src/ui/view/edit-widget-interface.h b/src/ui/view/edit-widget-interface.h index 26e47abbb..55683871d 100644 --- a/src/ui/view/edit-widget-interface.h +++ b/src/ui/view/edit-widget-interface.h @@ -148,7 +148,7 @@ struct EditWidgetInterface virtual bool showInfoDialog( Glib::ustring const &message ) = 0; /// Open yes/no dialog with warning text and confirmation question. - virtual bool warnDialog (gchar*) = 0; + virtual bool warnDialog (Glib::ustring const &) = 0; virtual Inkscape::UI::Widget::Dock* getDock () = 0; }; diff --git a/src/widgets/desktop-widget.cpp b/src/widgets/desktop-widget.cpp index e5568787b..cf6a908b6 100644 --- a/src/widgets/desktop-widget.cpp +++ b/src/widgets/desktop-widget.cpp @@ -71,6 +71,7 @@ #include "verbs.h" #include <gtkmm/paned.h> +#include <gtkmm/messagedialog.h> #include <gtk/gtk.h> @@ -1397,24 +1398,14 @@ bool SPDesktopWidget::showInfoDialog( Glib::ustring const &message ) return result; } -bool -SPDesktopWidget::warnDialog (gchar* text) +bool SPDesktopWidget::warnDialog (Glib::ustring const &text) { - GtkWindow *w =GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(this))); - if (w) - { - GtkWidget *dialog = gtk_message_dialog_new( - w, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_WARNING, - GTK_BUTTONS_YES_NO, - "%s", text); - gint response = gtk_dialog_run(GTK_DIALOG(dialog)); - gtk_widget_destroy(dialog); - if (response == GTK_RESPONSE_YES) - return true; - } - return false; + Gtk::MessageDialog dialog (*window, text, false, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK_CANCEL); + gint response = dialog.run(); + if (response == Gtk::RESPONSE_OK) + return true; + else + return false; } void diff --git a/src/widgets/desktop-widget.h b/src/widgets/desktop-widget.h index 58739cf3b..a77d56fc3 100644 --- a/src/widgets/desktop-widget.h +++ b/src/widgets/desktop-widget.h @@ -212,7 +212,7 @@ struct SPDesktopWidget { return _dtw->showInfoDialog( message ); } - virtual bool warnDialog (gchar* text) + virtual bool warnDialog (Glib::ustring const &text) { return _dtw->warnDialog (text); } virtual Inkscape::UI::Widget::Dock* getDock () @@ -232,7 +232,7 @@ struct SPDesktopWidget { void setWindowTransient (void *p, int transient_policy); void presentWindow(); bool showInfoDialog( Glib::ustring const &message ); - bool warnDialog (gchar *text); + bool warnDialog (Glib::ustring const &text); void setToolboxFocusTo (gchar const *); void setToolboxAdjustmentValue (gchar const * id, double value); void setToolboxSelectOneValue (gchar const * id, gint value); |
