[meld] filediff, misc: Update run_dialog usage to use new updated helper



commit 0ff406c012f1888501c1612d733bff199812cf69
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Oct 12 08:49:13 2014 +1000

    filediff, misc: Update run_dialog usage to use new updated helper

 meld/filediff.py |   17 ++++++++++++-----
 meld/misc.py     |   11 ++++++-----
 2 files changed, 18 insertions(+), 10 deletions(-)
---
diff --git a/meld/filediff.py b/meld/filediff.py
index cc78a16..cecfbb6 100644
--- a/meld/filediff.py
+++ b/meld/filediff.py
@@ -1664,12 +1664,19 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
                     '\r\n': ("DOS/Windows (CR-LF)", 1),
                     '\r': ("Mac OS (CR)", 2),
                 }
-                newline = misc.run_dialog( _("This file '%s' contains a mixture of line endings.\n\nWhich 
format would you like to use?") % bufdata.label,
-                    self, Gtk.MessageType.WARNING, buttonstype=Gtk.ButtonsType.CANCEL,
-                    extrabuttons=[ buttons[b] for b in bufdata.newlines ] )
+                dialog_buttons = [(_("_Cancel"), Gtk.ResponseType.CANCEL)]
+                dialog_buttons += [buttons[b] for b in bufdata.newlines]
+                newline = misc.modal_dialog(
+                    primary=_("Inconsistent line endings found"),
+                    secondary=_(
+                        "'%s' contains a mixture of line endings. Select the "
+                        "line ending format to use.") % bufdata.label,
+                    buttons=dialog_buttons,
+                    messagetype=Gtk.MessageType.WARNING
+                )
                 if newline < 0:
-                    return
-                for k,v in buttons.items():
+                    return False
+                for k, v in buttons.items():
                     if v[1] == newline:
                         bufdata.newlines = k
                         if k != '\n':
diff --git a/meld/misc.py b/meld/misc.py
index f6530e8..ae128b2 100644
--- a/meld/misc.py
+++ b/meld/misc.py
@@ -78,16 +78,17 @@ def modal_dialog(
 
     if not parent:
         from meld.meldapp import app
-        parent = app.window.widget
+        parent = app.get_active_window()
     elif not isinstance(parent, Gtk.Window):
         parent = parent.get_toplevel()
 
     dialog = Gtk.MessageDialog(
-        parent=parent,
-        flags=Gtk.DialogFlags.MODAL | Gtk.DialogFlags.DESTROY_WITH_PARENT,
-        type=messagetype,
+        transient_for=parent,
+        modal=True,
+        destroy_with_parent=True,
+        message_type=messagetype,
         buttons=Gtk.ButtonsType.NONE,
-        message_format=primary)
+        text=primary)
     dialog.format_secondary_markup(secondary)
 
     for label, response_id in buttons:


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