コード例 #1
0
            public Tests()
            {
                Gnome.Vfs.Vfs.Initialize();

                collection    = new FSpot.UriCollection();
                item          = new BrowsablePointer(collection, 0);
                item.Changed += delegate {
                    changed = true;
                };
            }
コード例 #2
0
 public DirectoryLoader(UriCollection collection, SafeUri uri)
 {
     this.collection = collection;
     file            = FileFactory.NewForUri(uri);
     file.EnumerateChildrenAsync("standard::*",
                                 FileQueryInfoFlags.None,
                                 500,
                                 null,
                                 InfoLoaded);
 }
コード例 #3
0
 public DirectoryLoader(UriCollection collection, System.Uri uri)
 {
     this.collection = collection;
     this.uri        = uri;
     Gnome.Vfs.Directory.GetEntries(uri.ToString(),
                                    Gnome.Vfs.FileInfoOptions.Default,
                                    20,
                                    (int)Gnome.Vfs.Async.Priority.Default,
                                    InfoLoaded);
 }
コード例 #4
0
            public RssLoader(UriCollection collection, Uri uri)
            {
                var doc = new XmlDocument();

                doc.Load(uri.ToString());
                var ns = new XmlNamespaceManager(doc.NameTable);

                ns.AddNamespace("media", "http://search.yahoo.com/mrss/");
                ns.AddNamespace("pheed", "http://www.pheed.com/pheed/");
                ns.AddNamespace("apple", "http://www.apple.com/ilife/wallpapers");

                var items = new List <FilePhoto> ();
                var list  = doc.SelectNodes("/rss/channel/item/media:content", ns);

                foreach (XmlNode item in list)
                {
                    var image_uri = new Uri(item.Attributes["url"].Value);
                    Log.Debug($"flickr uri = {image_uri}");
                    items.Add(new FilePhoto(image_uri));
                }

                if (list.Count < 1)
                {
                    list = doc.SelectNodes("/rss/channel/item/pheed:imgsrc", ns);
                    foreach (XmlNode item in list)
                    {
                        var image_uri = new Uri(item.InnerText.Trim());
                        Log.Debug($"pheed uri = {uri}");
                        items.Add(new FilePhoto(image_uri));
                    }
                }

                if (list.Count < 1)
                {
                    list = doc.SelectNodes("/rss/channel/item/apple:image", ns);
                    foreach (XmlNode item in list)
                    {
                        var image_uri = new Uri(item.InnerText.Trim());
                        Log.Debug($"apple uri = {uri}");
                        items.Add(new FilePhoto(image_uri));
                    }
                }
                collection.Add(items.ToArray());
            }
コード例 #5
0
            public RssLoader(UriCollection collection, System.Uri uri)
            {
                XmlDocument doc = new XmlDocument();

                doc.Load(uri.ToString());
                XmlNamespaceManager ns = new XmlNamespaceManager(doc.NameTable);

                ns.AddNamespace("media", "http://search.yahoo.com/mrss/");
                ns.AddNamespace("pheed", "http://www.pheed.com/pheed/");
                ns.AddNamespace("apple", "http://www.apple.com/ilife/wallpapers");

                ArrayList   items = new ArrayList();
                XmlNodeList list  = doc.SelectNodes("/rss/channel/item/media:content", ns);

                foreach (XmlNode item in list)
                {
                    Uri image_uri = new Uri(item.Attributes ["url"].Value);
                    System.Console.WriteLine("flickr uri = {0}", image_uri.ToString());
                    items.Add(new FileBrowsableItem(image_uri));
                }

                if (list.Count < 1)
                {
                    list = doc.SelectNodes("/rss/channel/item/pheed:imgsrc", ns);
                    foreach (XmlNode item in list)
                    {
                        Uri image_uri = new Uri(item.InnerText.Trim());
                        System.Console.WriteLine("pheed uri = {0}", uri);
                        items.Add(new FileBrowsableItem(image_uri));
                    }
                }

                if (list.Count < 1)
                {
                    list = doc.SelectNodes("/rss/channel/item/apple:image", ns);
                    foreach (XmlNode item in list)
                    {
                        Uri image_uri = new Uri(item.InnerText.Trim());
                        System.Console.WriteLine("apple uri = {0}", uri);
                        items.Add(new FileBrowsableItem(image_uri));
                    }
                }
                collection.Add(items.ToArray(typeof(FileBrowsableItem)) as FileBrowsableItem []);
            }
コード例 #6
0
			public RssLoader (UriCollection collection, System.Uri uri)
			{
				XmlDocument doc = new XmlDocument ();
				doc.Load (uri.ToString ());
				XmlNamespaceManager ns = new XmlNamespaceManager (doc.NameTable);
				ns.AddNamespace ("media", "http://search.yahoo.com/mrss/");
				ns.AddNamespace ("pheed", "http://www.pheed.com/pheed/");
				ns.AddNamespace ("apple", "http://www.apple.com/ilife/wallpapers");

				ArrayList items = new ArrayList ();
				XmlNodeList list = doc.SelectNodes ("/rss/channel/item/media:content", ns);
				foreach (XmlNode item in list) {
					Uri image_uri = new Uri (item.Attributes ["url"].Value);
					System.Console.WriteLine ("flickr uri = {0}", image_uri.ToString ());
					items.Add (new FileBrowsableItem (image_uri));
				}

				if (list.Count < 1) {
					list = doc.SelectNodes ("/rss/channel/item/pheed:imgsrc", ns);
					foreach (XmlNode item in list) {
						Uri image_uri = new Uri (item.InnerText.Trim ());
						System.Console.WriteLine ("pheed uri = {0}", uri);
						items.Add (new FileBrowsableItem (image_uri));
					}
				}

				if (list.Count < 1) {
					list = doc.SelectNodes ("/rss/channel/item/apple:image", ns);
					foreach (XmlNode item in list) {
						Uri image_uri = new Uri (item.InnerText.Trim ());
						System.Console.WriteLine ("apple uri = {0}", uri);
						items.Add (new FileBrowsableItem (image_uri));
					}
				}
				collection.Add (items.ToArray (typeof (FileBrowsableItem)) as FileBrowsableItem []);
			}
コード例 #7
0
			public DirectoryLoader (UriCollection collection, System.Uri uri)
			{
				this.collection = collection;
				this.uri = uri;
				Gnome.Vfs.Directory.GetEntries (uri.ToString (),
								Gnome.Vfs.FileInfoOptions.Default,
								20, 
								(int)Gnome.Vfs.Async.Priority.Default,
								InfoLoaded);
			}
コード例 #8
0
ファイル: UriCollection.cs プロジェクト: iainlane/f-spot
 public DirectoryLoader(UriCollection collection, System.Uri uri)
 {
     this.collection = collection;
     this.uri = uri;
     file = FileFactory.NewForUri (uri);
     file.EnumerateChildrenAsync ("standard::*",
                      FileQueryInfoFlags.None,
                      500,
                      null,
                      InfoLoaded);
 }
コード例 #9
0
ファイル: SingleView.cs プロジェクト: Yetangitu/f-spot
        public SingleView(SafeUri [] uris)
        {
            this.uri = uris [0];
            Log.Debug ("uri: " + this.uri);

            GtkBeans.Builder builder = new GtkBeans.Builder ("single_view.ui");
            builder.Autoconnect (this);

            LoadPreference (Preferences.VIEWER_WIDTH);
            LoadPreference (Preferences.VIEWER_MAXIMIZED);

            Gtk.Toolbar toolbar = new Gtk.Toolbar ();
            toolbar_hbox.PackStart (toolbar);

            rl_button = GtkUtil.ToolButtonFromTheme ("object-rotate-left", Catalog.GetString ("Rotate Left"), true);
            rl_button.Clicked += HandleRotate270Command;
            rl_button.TooltipText = Catalog.GetString ("Rotate photo left");
            toolbar.Insert (rl_button, -1);

            rr_button = GtkUtil.ToolButtonFromTheme ("object-rotate-right", Catalog.GetString ("Rotate Right"), true);
            rr_button.Clicked += HandleRotate90Command;
            rr_button.TooltipText = Catalog.GetString ("Rotate photo right");
            toolbar.Insert (rr_button, -1);

            toolbar.Insert (new SeparatorToolItem (), -1);

            ToolButton fs_button = GtkUtil.ToolButtonFromTheme ("view-fullscreen", Catalog.GetString ("Fullscreen"), true);
            fs_button.Clicked += HandleViewFullscreen;
            fs_button.TooltipText = Catalog.GetString ("View photos fullscreen");
            toolbar.Insert (fs_button, -1);

            ToolButton ss_button = GtkUtil.ToolButtonFromTheme ("media-playback-start", Catalog.GetString ("Slideshow"), true);
            ss_button.Clicked += HandleViewSlideshow;
            ss_button.TooltipText = Catalog.GetString ("View photos in a slideshow");
            toolbar.Insert (ss_button, -1);

            collection = new UriCollection (uris);

            TargetList targetList = new TargetList();
            targetList.AddTextTargets((uint)DragDropTargets.TargetType.PlainText);
            targetList.AddUriTargets((uint)DragDropTargets.TargetType.UriList);

            directory_view = new SelectionCollectionGridView (collection);
            directory_view.Selection.Changed += HandleSelectionChanged;
            directory_view.DragDataReceived += HandleDragDataReceived;
            Gtk.Drag.DestSet (directory_view, DestDefaults.All, (TargetEntry[])targetList,
                    DragAction.Copy | DragAction.Move);
            directory_view.DisplayTags = false;
            directory_view.DisplayDates = false;
            directory_view.DisplayRatings = false;

            directory_scrolled = new ScrolledWindow();
            directory_scrolled.Add (directory_view);

            sidebar = new Sidebar ();

            info_vbox.Add (sidebar);
            sidebar.AppendPage (directory_scrolled, Catalog.GetString ("Folder"), "gtk-directory");

            AddinManager.AddExtensionNodeHandler ("/FSpot/Sidebar", OnSidebarExtensionChanged);

            sidebar.Context = ViewContext.Single;

            sidebar.CloseRequested += HandleHideSidePane;
            sidebar.Show ();

            ThumbnailLoader.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw (); };

            image_view = new PhotoImageView (collection);
            GtkUtil.ModifyColors (image_view);
            GtkUtil.ModifyColors (image_scrolled);
            image_view.ZoomChanged += HandleZoomChanged;
            image_view.Item.Changed += HandleItemChanged;
            image_view.ButtonPressEvent += HandleImageViewButtonPressEvent;
            image_view.DragDataReceived += HandleDragDataReceived;
            Gtk.Drag.DestSet (image_view, DestDefaults.All, (TargetEntry[])targetList,
                    DragAction.Copy | DragAction.Move);
            image_scrolled.Add (image_view);

            Window.ShowAll ();

            zoom_scale.ValueChanged += HandleZoomScaleValueChanged;

            LoadPreference (Preferences.VIEWER_SHOW_TOOLBAR);
            LoadPreference (Preferences.VIEWER_INTERPOLATION);
            LoadPreference (Preferences.VIEWER_TRANSPARENCY);
            LoadPreference (Preferences.VIEWER_TRANS_COLOR);

            ShowSidebar = collection.Count > 1;

            LoadPreference (Preferences.VIEWER_SHOW_FILENAMES);

            Preferences.SettingChanged += OnPreferencesChanged;
            Window.DeleteEvent += HandleDeleteEvent;

            collection.Changed += HandleCollectionChanged;

            // wrap the methods to fit to the delegate
            image_view.Item.Changed += delegate (object sender, BrowsablePointerChangedEventArgs old) {
                    BrowsablePointer pointer = sender as BrowsablePointer;
                    if (pointer == null)
                        return;
                    IPhoto [] item = {pointer.Current};
                    sidebar.HandleSelectionChanged (new PhotoList (item));
            };

            image_view.Item.Collection.ItemsChanged += sidebar.HandleSelectionItemsChanged;

            UpdateStatusLabel ();

            if (collection.Count > 0)
                directory_view.Selection.Add (0);

            export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode ("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem (this).Submenu;
            export.Submenu.ShowAll ();
            export.Activated += HandleExportActivated ;
        }
コード例 #10
0
        public SingleView(Uri [] uris)
        {
            string glade_name = "single_view";

            this.uri = uris [0];

            System.Console.WriteLine("uri = {0}", uri.ToString());

            xml = new Glade.XML(null, "f-spot.glade", glade_name, "f-spot");
            xml.Autoconnect(this);
            window = (Gtk.Window)xml.GetWidget(glade_name);

            LoadPreference(Preferences.VIEWER_WIDTH);
            LoadPreference(Preferences.VIEWER_MAXIMIZED);

            Gtk.Toolbar toolbar = new Gtk.Toolbar();
            toolbar_hbox.PackStart(toolbar);

            ToolButton rl_button = GtkUtil.ToolButtonFromTheme("object-rotate-left", Catalog.GetString("Rotate Left"), true);

            rl_button.Clicked += HandleRotate270Command;
            rl_button.SetTooltip(toolTips, Catalog.GetString("Rotate photo left"), null);
            toolbar.Insert(rl_button, -1);

            ToolButton rr_button = GtkUtil.ToolButtonFromTheme("object-rotate-right", Catalog.GetString("Rotate Right"), true);

            rr_button.Clicked += HandleRotate90Command;
            rr_button.SetTooltip(toolTips, Catalog.GetString("Rotate photo right"), null);
            toolbar.Insert(rr_button, -1);

            toolbar.Insert(new SeparatorToolItem(), -1);

            ToolButton fs_button = GtkUtil.ToolButtonFromTheme("view-fullscreen", Catalog.GetString("Fullscreen"), true);

            fs_button.Clicked += HandleViewFullscreen;
            fs_button.SetTooltip(toolTips, Catalog.GetString("View photos fullscreen"), null);
            toolbar.Insert(fs_button, -1);

            ToolButton ss_button = GtkUtil.ToolButtonFromTheme("media-playback-start", Catalog.GetString("Slideshow"), true);

            ss_button.Clicked += HandleViewSlideshow;
            ss_button.SetTooltip(toolTips, Catalog.GetString("View photos in a slideshow"), null);
            toolbar.Insert(ss_button, -1);

            collection = new UriCollection(uris);

            TargetEntry [] dest_table = { new TargetEntry("text/uri-list", 0, 0),
                                          new TargetEntry("text/plain",    0, 1) };

            directory_view = new FSpot.Widgets.IconView(collection);
            directory_view.Selection.Changed += HandleSelectionChanged;
            directory_view.DragDataReceived  += HandleDragDataReceived;
            Gtk.Drag.DestSet(directory_view, DestDefaults.All, dest_table,
                             DragAction.Copy | DragAction.Move);
            directory_view.DisplayTags    = false;
            directory_view.DisplayDates   = false;
            directory_view.DisplayRatings = false;

            directory_scrolled = new ScrolledWindow();
            directory_scrolled.Add(directory_view);

            sidebar = new Sidebar();

            info_vbox.Add(sidebar);
            sidebar.AppendPage(directory_scrolled, Catalog.GetString("Folder"), "gtk-directory");

            AddinManager.AddExtensionNodeHandler("/FSpot/Sidebar", OnSidebarExtensionChanged);

            sidebar.Context = ViewContext.Single;

            sidebar.CloseRequested += HandleHideSidePane;
            sidebar.Show();

            ThumbnailGenerator.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw(); };

            image_view = new PhotoImageView(collection);
            GtkUtil.ModifyColors(image_view);
            GtkUtil.ModifyColors(image_scrolled);
            image_view.ZoomChanged      += HandleZoomChanged;
            image_view.Item.Changed     += HandleItemChanged;
            image_view.ButtonPressEvent += HandleImageViewButtonPressEvent;
            image_view.DragDataReceived += HandleDragDataReceived;
            Gtk.Drag.DestSet(image_view, DestDefaults.All, dest_table,
                             DragAction.Copy | DragAction.Move);
            image_scrolled.Add(image_view);

            Window.ShowAll();

            zoom_scale.ValueChanged += HandleZoomScaleValueChanged;

            LoadPreference(Preferences.VIEWER_SHOW_TOOLBAR);
            LoadPreference(Preferences.VIEWER_INTERPOLATION);
            LoadPreference(Preferences.VIEWER_TRANSPARENCY);
            LoadPreference(Preferences.VIEWER_TRANS_COLOR);

            ShowSidebar = collection.Count > 1;

            LoadPreference(Preferences.VIEWER_SHOW_FILENAMES);

            Preferences.SettingChanged += OnPreferencesChanged;
            window.DeleteEvent         += HandleDeleteEvent;

            collection.Changed += HandleCollectionChanged;

            // wrap the methods to fit to the delegate
            image_view.Item.Changed += delegate(BrowsablePointer pointer, BrowsablePointerChangedArgs old) {
                IBrowsableItem [] item       = { pointer.Current };
                PhotoArray        item_array = new PhotoArray(item);
                sidebar.HandleSelectionChanged(item_array);
            };

            image_view.Item.Collection.ItemsChanged += sidebar.HandleSelectionItemsChanged;

            UpdateStatusLabel();

            if (collection.Count > 0)
            {
                directory_view.Selection.Add(0);
            }

            export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem(this).Submenu;
            export.Submenu.ShowAll();
            export.Activated += HandleExportActivated;
        }
コード例 #11
0
ファイル: UriCollection.cs プロジェクト: Yetangitu/f-spot
            public RssLoader(UriCollection collection, SafeUri uri)
            {
                XmlDocument doc = new XmlDocument ();
                doc.Load (uri.ToString ());
                XmlNamespaceManager ns = new XmlNamespaceManager (doc.NameTable);
                ns.AddNamespace ("media", "http://search.yahoo.com/mrss/");
                ns.AddNamespace ("pheed", "http://www.pheed.com/pheed/");
                ns.AddNamespace ("apple", "http://www.apple.com/ilife/wallpapers");

                List<FilePhoto> items = new List<FilePhoto> ();
                XmlNodeList list = doc.SelectNodes ("/rss/channel/item/media:content", ns);
                foreach (XmlNode item in list) {
                    SafeUri image_uri = new SafeUri (item.Attributes ["url"].Value);
                    Hyena.Log.DebugFormat ("flickr uri = {0}", image_uri.ToString ());
                    items.Add (new FilePhoto (image_uri));
                }

                if (list.Count < 1) {
                    list = doc.SelectNodes ("/rss/channel/item/pheed:imgsrc", ns);
                    foreach (XmlNode item in list) {
                        SafeUri image_uri = new SafeUri (item.InnerText.Trim ());
                        Hyena.Log.DebugFormat ("pheed uri = {0}", uri);
                        items.Add (new FilePhoto (image_uri));
                    }
                }

                if (list.Count < 1) {
                    list = doc.SelectNodes ("/rss/channel/item/apple:image", ns);
                    foreach (XmlNode item in list) {
                        SafeUri image_uri = new SafeUri (item.InnerText.Trim ());
                        Hyena.Log.DebugFormat ("apple uri = {0}", uri);
                        items.Add (new FilePhoto (image_uri));
                    }
                }
                collection.Add (items.ToArray ());
            }
コード例 #12
0
		public SingleView (Uri [] uris) 
		{
			string glade_name = "single_view";
			this.uri = uris [0];
			
			System.Console.WriteLine ("uri = {0}", uri.ToString ());

			xml = new Glade.XML (null, "f-spot.glade", glade_name, "f-spot");
			xml.Autoconnect (this);
			window = (Gtk.Window) xml.GetWidget (glade_name);
		
			LoadPreference (Preferences.VIEWER_WIDTH);
			LoadPreference (Preferences.VIEWER_MAXIMIZED);

			Gtk.Toolbar toolbar = new Gtk.Toolbar ();
			toolbar_hbox.PackStart (toolbar);
			Widget rl_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-rotate-270", new System.EventHandler (HandleRotate270Command));
			SetTip (rl_button, Catalog.GetString ("Rotate photo left"));
			Widget rr_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-rotate-90", new System.EventHandler (HandleRotate90Command));
			SetTip (rr_button, Catalog.GetString ("Rotate photo right"));

			toolbar.AppendSpace ();

			Widget fs_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-fullscreen", new System.EventHandler (HandleViewFullscreen));
			SetTip (fs_button, Catalog.GetString ("View photos fullscreen"));
			Widget ss_button = GtkUtil.MakeToolbarButton (toolbar, "f-spot-slideshow", new System.EventHandler (HandleViewSlideshow));
			SetTip (ss_button, Catalog.GetString ("View photos in a slideshow"));

			collection = new UriCollection (uris);

			TargetEntry [] dest_table = {   new TargetEntry ("text/uri-list", 0, 0),
							new TargetEntry ("text/plain", 0, 1)};
			
			directory_view = new IconView (collection);
			directory_view.Selection.Changed += HandleSelectionChanged;
			directory_view.DragDataReceived += HandleDragDataReceived;
			Gtk.Drag.DestSet (directory_view, DestDefaults.All, dest_table, 
					DragAction.Copy | DragAction.Move); 
			directory_view.DisplayTags = false;
			directory_view.DisplayDates = false;
			directory_scrolled.Add (directory_view);

			ThumbnailGenerator.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw (); };

			image_view = new PhotoImageView (collection);
			FSpot.Global.ModifyColors (image_view);
			FSpot.Global.ModifyColors (image_scrolled);
			image_view.ZoomChanged += HandleZoomChanged;
			image_view.Item.Changed += HandleItemChanged;
			image_view.ButtonPressEvent += HandleImageViewButtonPressEvent;
			image_view.DragDataReceived += HandleDragDataReceived;
			Gtk.Drag.DestSet (image_view, DestDefaults.All, dest_table,
					DragAction.Copy | DragAction.Move); 
			image_scrolled.Add (image_view);
			
			Window.ShowAll ();

			zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
		
			LoadPreference (Preferences.VIEWER_SHOW_TOOLBAR);
 			LoadPreference (Preferences.VIEWER_INTERPOLATION);
			LoadPreference (Preferences.VIEWER_TRANSPARENCY);
			LoadPreference (Preferences.VIEWER_TRANS_COLOR);

			ShowSidebar = collection.Count > 1;

			near_image.SetFromStock ("f-spot-stock_near", Gtk.IconSize.SmallToolbar);
			far_image.SetFromStock ("f-spot-stock_far", Gtk.IconSize.SmallToolbar);

			slide_delay = new FSpot.Delay (new GLib.IdleHandler (SlideShow));

			LoadPreference (Preferences.VIEWER_SHOW_FILENAMES);

			Preferences.SettingChanged += OnPreferencesChanged;
			window.DeleteEvent += HandleDeleteEvent;
			
			collection.Changed += HandleCollectionChanged;
			UpdateStatusLabel ();
			
			if (collection.Count > 0)
				directory_view.Selection.Add (0);

			export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode ("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem ().Submenu;
			export.Submenu.ShowAll ();
			export.Activated += HandleExportActivated ;
		}
コード例 #13
0
        public SingleView(Uri[] uris)
        {
            uri = uris[0];
            Log.Debug("uri: " + uri);

            var builder = new GtkBeans.Builder("single_view.ui");

            builder.Autoconnect(this);

            LoadPreference(Preferences.VIEWER_WIDTH);
            LoadPreference(Preferences.VIEWER_MAXIMIZED);

            var toolbar = new Gtk.Toolbar();

            toolbar_hbox.PackStart(toolbar);

            rl_button             = GtkUtil.ToolButtonFromTheme("object-rotate-left", Strings.RotateLeft, true);
            rl_button.Clicked    += HandleRotate270Command;
            rl_button.TooltipText = Strings.RotatePhotoLeft;
            toolbar.Insert(rl_button, -1);

            rr_button             = GtkUtil.ToolButtonFromTheme("object-rotate-right", Strings.RotateRight, true);
            rr_button.Clicked    += HandleRotate90Command;
            rr_button.TooltipText = Strings.RotatePhotoRight;
            toolbar.Insert(rr_button, -1);

            toolbar.Insert(new SeparatorToolItem(), -1);

            ToolButton fs_button = GtkUtil.ToolButtonFromTheme("view-fullscreen", Strings.Fullscreen, true);

            fs_button.Clicked    += HandleViewFullscreen;
            fs_button.TooltipText = Strings.ViewPhotosFullscreen;
            toolbar.Insert(fs_button, -1);

            ToolButton ss_button = GtkUtil.ToolButtonFromTheme("media-playback-start", Strings.Slideshow, true);

            ss_button.Clicked    += HandleViewSlideshow;
            ss_button.TooltipText = Strings.ViewPhotosInASlideshow;
            toolbar.Insert(ss_button, -1);

            collection = new UriCollection(uris);

            var targetList = new TargetList();

            //targetList.AddTextTargets (DragDropTargets.TargetType.PlainText);
            //targetList.AddUriTargets (DragDropTargets.TargetType.UriList);

            //directory_view = new SelectionCollectionGridView (collection);
            directory_view.Selection.Changed += HandleSelectionChanged;
            directory_view.DragDataReceived  += HandleDragDataReceived;
            Gtk.Drag.DestSet(directory_view, DestDefaults.All, (TargetEntry[])targetList,
                             DragAction.Copy | DragAction.Move);
            directory_view.DisplayTags    = false;
            directory_view.DisplayDates   = false;
            directory_view.DisplayRatings = false;

            directory_scrolled = new ScrolledWindow();
            directory_scrolled.Add(directory_view);

            sidebar = new Sidebar();

            info_vbox.Add(sidebar);
            sidebar.AppendPage(directory_scrolled, Strings.Folder, "gtk-directory");

            AddinManager.AddExtensionNodeHandler("/FSpot/Sidebar", OnSidebarExtensionChanged);

            sidebar.Context = ViewContext.Single;

            sidebar.CloseRequested += HandleHideSidePane;
            sidebar.Show();

            App.Instance.Container.Resolve <IThumbnailLoader> ().OnPixbufLoaded += delegate { directory_view.QueueDraw(); };

            imageView = new PhotoImageView(collection);
            GtkUtil.ModifyColors(imageView);
            GtkUtil.ModifyColors(image_scrolled);
            imageView.ZoomChanged      += HandleZoomChanged;
            imageView.Item.Changed     += HandleItemChanged;
            imageView.ButtonPressEvent += HandleImageViewButtonPressEvent;
            imageView.DragDataReceived += HandleDragDataReceived;
            Gtk.Drag.DestSet(imageView, DestDefaults.All, (TargetEntry[])targetList,
                             DragAction.Copy | DragAction.Move);
            image_scrolled.Add(imageView);

            Window.ShowAll();

            zoom_scale.ValueChanged += HandleZoomScaleValueChanged;

            LoadPreference(Preferences.VIEWER_SHOW_TOOLBAR);
            LoadPreference(Preferences.VIEWER_INTERPOLATION);
            LoadPreference(Preferences.VIEWER_TRANSPARENCY);
            LoadPreference(Preferences.VIEWER_TRANS_COLOR);

            ShowSidebar = collection.Count > 1;

            LoadPreference(Preferences.VIEWER_SHOW_FILENAMES);

            Preferences.SettingChanged += OnPreferencesChanged;
            Window.DeleteEvent         += HandleDeleteEvent;

            collection.Changed += HandleCollectionChanged;

            // wrap the methods to fit to the delegate
            imageView.Item.Changed += delegate(object sender, BrowsablePointerChangedEventArgs old) {
                if (!(sender is BrowsablePointer pointer))
                {
                    return;
                }
                IPhoto[] item = { pointer.Current };
                sidebar.HandleSelectionChanged(new ObservableCollection <IPhoto>(item));
            };

            imageView.Item.Collection.CollectionChanged += sidebar.HandleCollectionItemsChanged;

            UpdateStatusLabel();

            if (collection.Count > 0)
            {
                directory_view.Selection.Add(0);
            }

            export.Submenu = (AddinManager.GetExtensionNode("/FSpot/Menus/Exports") as SubmenuNode).GetMenuItem(this).Submenu;
            export.Submenu.ShowAll();
            export.Activated += HandleExportActivated;
        }
コード例 #14
0
		public SingleView (Uri [] uris) 
		{
			string glade_name = "single_view";
			this.uri = uris [0];
			
			System.Console.WriteLine ("uri = {0}", uri.ToString ());

			xml = new Glade.XML (null, "f-spot.glade", glade_name, "f-spot");
			xml.Autoconnect (this);
			window = (Gtk.Window) xml.GetWidget (glade_name);
		
			LoadPreference (Preferences.VIEWER_WIDTH);
			LoadPreference (Preferences.VIEWER_MAXIMIZED);

			Gtk.Toolbar toolbar = new Gtk.Toolbar ();
			toolbar_hbox.PackStart (toolbar);
		
			ToolButton rl_button = GtkUtil.ToolButtonFromTheme ("object-rotate-left", Catalog.GetString ("Rotate Left"), true);
			rl_button.Clicked += HandleRotate270Command;
			rl_button.SetTooltip (toolTips, Catalog.GetString ("Rotate photo left"), null);
			toolbar.Insert (rl_button, -1);

			ToolButton rr_button = GtkUtil.ToolButtonFromTheme ("object-rotate-right", Catalog.GetString ("Rotate Right"), true);
			rr_button.Clicked += HandleRotate90Command;
			rr_button.SetTooltip (toolTips, Catalog.GetString ("Rotate photo right"), null);
			toolbar.Insert (rr_button, -1);

			toolbar.Insert (new SeparatorToolItem (), -1);

			ToolButton fs_button = GtkUtil.ToolButtonFromTheme ("view-fullscreen", Catalog.GetString ("Fullscreen"), true);
			fs_button.Clicked += HandleViewFullscreen;
			fs_button.SetTooltip (toolTips, Catalog.GetString ("View photos fullscreen"), null);
			toolbar.Insert (fs_button, -1);

			ToolButton ss_button = GtkUtil.ToolButtonFromTheme ("media-playback-start", Catalog.GetString ("Slideshow"), true);
			ss_button.Clicked += HandleViewSlideshow;
			ss_button.SetTooltip (toolTips, Catalog.GetString ("View photos in a slideshow"), null);
			toolbar.Insert (ss_button, -1);

			collection = new UriCollection (uris);

			TargetEntry [] dest_table = {   new TargetEntry ("text/uri-list", 0, 0),
							new TargetEntry ("text/plain", 0, 1)};
			
			directory_view = new FSpot.Widgets.IconView (collection);
			directory_view.Selection.Changed += HandleSelectionChanged;
			directory_view.DragDataReceived += HandleDragDataReceived;
			Gtk.Drag.DestSet (directory_view, DestDefaults.All, dest_table, 
					DragAction.Copy | DragAction.Move); 
			directory_view.DisplayTags = false;
			directory_view.DisplayDates = false;
			directory_view.DisplayRatings = false;

			directory_scrolled = new ScrolledWindow();
			directory_scrolled.Add (directory_view);

			sidebar = new Sidebar ();

			info_vbox.Add (sidebar);
			sidebar.AppendPage (directory_scrolled, Catalog.GetString ("Folder"), "gtk-directory");

			AddinManager.AddExtensionNodeHandler ("/FSpot/Sidebar", OnSidebarExtensionChanged);
 		
			sidebar.Context = ViewContext.Single;

			sidebar.CloseRequested += HandleHideSidePane;
			sidebar.Show ();

			ThumbnailGenerator.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw (); };

			image_view = new PhotoImageView (collection);
			GtkUtil.ModifyColors (image_view);
			GtkUtil.ModifyColors (image_scrolled);
			image_view.ZoomChanged += HandleZoomChanged;
			image_view.Item.Changed += HandleItemChanged;
			image_view.ButtonPressEvent += HandleImageViewButtonPressEvent;
			image_view.DragDataReceived += HandleDragDataReceived;
			Gtk.Drag.DestSet (image_view, DestDefaults.All, dest_table,
					DragAction.Copy | DragAction.Move); 
			image_scrolled.Add (image_view);
			
			Window.ShowAll ();

			zoom_scale.ValueChanged += HandleZoomScaleValueChanged;
		
			LoadPreference (Preferences.VIEWER_SHOW_TOOLBAR);
 			LoadPreference (Preferences.VIEWER_INTERPOLATION);
			LoadPreference (Preferences.VIEWER_TRANSPARENCY);
			LoadPreference (Preferences.VIEWER_TRANS_COLOR);

			ShowSidebar = collection.Count > 1;

			LoadPreference (Preferences.VIEWER_SHOW_FILENAMES);

			Preferences.SettingChanged += OnPreferencesChanged;
			window.DeleteEvent += HandleDeleteEvent;
			
			collection.Changed += HandleCollectionChanged;

			// wrap the methods to fit to the delegate
			image_view.Item.Changed += delegate (BrowsablePointer pointer, BrowsablePointerChangedArgs old) {
															IBrowsableItem [] item = {pointer.Current};
															PhotoArray item_array = new PhotoArray (item);
															sidebar.HandleSelectionChanged (item_array);
													};
			
			image_view.Item.Collection.ItemsChanged += sidebar.HandleSelectionItemsChanged;

			UpdateStatusLabel ();
			
			if (collection.Count > 0)
				directory_view.Selection.Add (0);

			export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode ("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem (this).Submenu;
			export.Submenu.ShowAll ();
			export.Activated += HandleExportActivated ;
		}
コード例 #15
0
        public SingleView(Uri [] uris)
        {
            string glade_name = "single_view";

            this.uri = uris [0];

            System.Console.WriteLine("uri = {0}", uri.ToString());

            xml = new Glade.XML(null, "f-spot.glade", glade_name, "f-spot");
            xml.Autoconnect(this);
            window = (Gtk.Window)xml.GetWidget(glade_name);

            LoadPreference(Preferences.VIEWER_WIDTH);
            LoadPreference(Preferences.VIEWER_MAXIMIZED);

            Gtk.Toolbar toolbar = new Gtk.Toolbar();
            toolbar_hbox.PackStart(toolbar);
            Widget rl_button = GtkUtil.MakeToolbarButton(toolbar, "f-spot-rotate-270", new System.EventHandler(HandleRotate270Command));

            SetTip(rl_button, Catalog.GetString("Rotate photo left"));
            Widget rr_button = GtkUtil.MakeToolbarButton(toolbar, "f-spot-rotate-90", new System.EventHandler(HandleRotate90Command));

            SetTip(rr_button, Catalog.GetString("Rotate photo right"));

            toolbar.AppendSpace();

            Widget fs_button = GtkUtil.MakeToolbarButton(toolbar, "f-spot-fullscreen", new System.EventHandler(HandleViewFullscreen));

            SetTip(fs_button, Catalog.GetString("View photos fullscreen"));
            Widget ss_button = GtkUtil.MakeToolbarButton(toolbar, "f-spot-slideshow", new System.EventHandler(HandleViewSlideshow));

            SetTip(ss_button, Catalog.GetString("View photos in a slideshow"));

            collection = new UriCollection(uris);

            TargetEntry [] dest_table = { new TargetEntry("text/uri-list", 0, 0),
                                          new TargetEntry("text/plain",    0, 1) };

            directory_view = new IconView(collection);
            directory_view.Selection.Changed += HandleSelectionChanged;
            directory_view.DragDataReceived  += HandleDragDataReceived;
            Gtk.Drag.DestSet(directory_view, DestDefaults.All, dest_table,
                             DragAction.Copy | DragAction.Move);
            directory_view.DisplayTags  = false;
            directory_view.DisplayDates = false;
            directory_scrolled.Add(directory_view);

            ThumbnailGenerator.Default.OnPixbufLoaded += delegate { directory_view.QueueDraw(); };

            image_view = new PhotoImageView(collection);
            FSpot.Global.ModifyColors(image_view);
            FSpot.Global.ModifyColors(image_scrolled);
            image_view.ZoomChanged      += HandleZoomChanged;
            image_view.Item.Changed     += HandleItemChanged;
            image_view.ButtonPressEvent += HandleImageViewButtonPressEvent;
            image_view.DragDataReceived += HandleDragDataReceived;
            Gtk.Drag.DestSet(image_view, DestDefaults.All, dest_table,
                             DragAction.Copy | DragAction.Move);
            image_scrolled.Add(image_view);

            Window.ShowAll();

            zoom_scale.ValueChanged += HandleZoomScaleValueChanged;

            LoadPreference(Preferences.VIEWER_SHOW_TOOLBAR);
            LoadPreference(Preferences.VIEWER_INTERPOLATION);
            LoadPreference(Preferences.VIEWER_TRANSPARENCY);
            LoadPreference(Preferences.VIEWER_TRANS_COLOR);

            ShowSidebar = collection.Count > 1;

            near_image.SetFromStock("f-spot-stock_near", Gtk.IconSize.SmallToolbar);
            far_image.SetFromStock("f-spot-stock_far", Gtk.IconSize.SmallToolbar);

            slide_delay = new FSpot.Delay(new GLib.IdleHandler(SlideShow));

            LoadPreference(Preferences.VIEWER_SHOW_FILENAMES);

            Preferences.SettingChanged += OnPreferencesChanged;
            window.DeleteEvent         += HandleDeleteEvent;

            collection.Changed += HandleCollectionChanged;
            UpdateStatusLabel();

            if (collection.Count > 0)
            {
                directory_view.Selection.Add(0);
            }

            export.Submenu = (Mono.Addins.AddinManager.GetExtensionNode("/FSpot/Menus/Exports") as FSpot.Extensions.SubmenuNode).GetMenuItem().Submenu;
            export.Submenu.ShowAll();
            export.Activated += HandleExportActivated;
        }
コード例 #16
0
			public Tests ()
			{
				Gnome.Vfs.Vfs.Initialize ();

				collection = new FSpot.UriCollection ();
				item = new BrowsablePointer (collection, 0);
				item.Changed += delegate {
					changed = true;
				};
			}