Re: [pdfmod] Small patch for opening more than one PDF at the the same time through d'n'd



Thanks for your help :-)

On Thu, Aug 20, 2009 at 12:30 AM, Sandy
Armstrong<sanfordarmstrong gmail com> wrote:
> On Wed, Aug 19, 2009 at 3:20 PM, Markus
> Lobedann<markus lobedann gmail com> wrote:
>> Hi,
>>
>> I don't know if this funtionality is wanted, but I thought it is a
>> nice addition since calling PdfMod through the command line with
>> multiple filenames does the same thing.
>>
>> Basically i took the code from "LoadFiles" in Client.cs and adjusted
>> it for the d'n'd event.
>
> That sounds pretty handy.  :-)
>

Nice to know that you think this patch might be handy!

>> This is my first time working with Mono, GTK# and offering a patch to
>> gnome at all. So please bear with me if I did anything wrong and tell
>> me what to do different.
>
> Congrats an your first patch!  The best thing to do is to open a new
> enhancement bug in GNOME bugzilla (choose 'pdfmod' as the prodcut).
> From there, you can attach your patch and it can be reviewed by one of
> the pdfmod developers.
>
> It's hard to try out patches when they're included inline in emails.  ;-)

I just created the enhancement-request on the GNOME bugzilla, and
attached the patch the proper way ;-)
(to this mail too...)

>
> Hope this helps,
> Sandy

These tips sure do help!

> _______________________________________________
> pdfmod-list mailing list
> pdfmod-list gnome org
> http://mail.gnome.org/mailman/listinfo/pdfmod-list
>

Regards
Markus


-- 
Chaos, Panik und Unordnung - mein Werk hier ist vollendet.
http://exitus.dynalias.org
diff --git a/src/PdfMod/Gui/DocumentIconView.cs b/src/PdfMod/Gui/DocumentIconView.cs
index 921fab3..4dfb65a 100644
--- a/src/PdfMod/Gui/DocumentIconView.cs
+++ b/src/PdfMod/Gui/DocumentIconView.cs
@@ -6,6 +6,10 @@ using System.Linq;
 using Gtk;
 using Gdk;
 
+using Mono.Unix;
+
+using Hyena.Gui;
+
 using PdfSharp.Pdf;
 
 using PdfMod.Pdf;
@@ -307,8 +311,31 @@ namespace PdfMod.Gui
                 args.RetVal = true;
             } else if (target == uri_src_target.Target) {
                 var uris = System.Text.Encoding.UTF8.GetString (args.SelectionData.Data).Split (newline, StringSplitOptions.RemoveEmptyEntries);
-                if (uris.Length == 1 && app.Document == null) {
-                    app.LoadPath (uris[0]);
+				if (uris.Length >= 1 && app.Document == null) {
+					if (uris.Length == 1) {
+		                app.LoadPath (uris[0]);
+		            } else if (uris.Length > 1) {
+		                // Make sure the user wants to open N windows
+		                var message_dialog = new Hyena.Widgets.HigMessageDialog (
+		                    app.Window, DialogFlags.Modal, MessageType.Question, ButtonsType.None,
+		                    String.Format (Catalog.GetPluralString (
+		                        "Continue, opening {0} document in separate windows?", "Continue, opening all {0} documents in separate windows?", uris.Length),
+		                        uris.Length),
+		                    String.Empty);
+		                message_dialog.AddButton (Stock.Cancel, ResponseType.Cancel, false);
+		                message_dialog.AddButton (Catalog.GetString ("Open _First"), ResponseType.Accept, false);
+		                message_dialog.AddButton (Catalog.GetString ("Open _All"), ResponseType.Ok, true);
+		                var response = message_dialog.Run ();
+		                message_dialog.Destroy ();
+		
+		                if ((Gtk.ResponseType)response == Gtk.ResponseType.Ok) {
+		                    foreach (var uri in uris) {
+		                        app.LoadPath (uri.ToString());
+		                    }
+		                } else if ((Gtk.ResponseType)response == Gtk.ResponseType.Accept) {
+		                    app.LoadPath (uris[0]);
+		                }
+		            }
                     args.RetVal = true;
                 } else {
                     int to_index = GetDropIndex (args.X, args.Y);


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