f-spot r4559 - in trunk: . src src/Extensions src/Widgets
- From: sdelcroix svn gnome org
- To: svn-commits-list gnome org
- Subject: f-spot r4559 - in trunk: . src src/Extensions src/Widgets
- Date: Mon, 3 Nov 2008 13:43:20 +0000 (UTC)
Author: sdelcroix
Date: Mon Nov 3 13:43:20 2008
New Revision: 4559
URL: http://svn.gnome.org/viewvc/f-spot?rev=4559&view=rev
Log:
2008-10-29 Stephane Delcroix <sdelcroix novell com>
* src/Extensions/PopupCommands.cs:
* src/Mainwindow.cs: changes related to Gio.AppInfo
Modified:
trunk/ChangeLog
trunk/src/Extensions/PopupCommands.cs
trunk/src/MainWindow.cs
trunk/src/Makefile.am
trunk/src/Widgets/OpenWithMenu.cs
Modified: trunk/src/Extensions/PopupCommands.cs
==============================================================================
--- trunk/src/Extensions/PopupCommands.cs (original)
+++ trunk/src/Extensions/PopupCommands.cs Mon Nov 3 13:43:20 2008
@@ -10,6 +10,8 @@
using System;
+using GLib;
+
namespace FSpot.Extensions
{
public class CopyLocation : ICommand
@@ -58,9 +60,8 @@
public Gtk.Menu GetMenu ()
{
- owm = new Widgets.OpenWithMenu (MainWindow.Toplevel.SelectedMimeTypes);
- owm.IgnoreApp = "f-spot";
- owm.ApplicationActivated += delegate (Gnome.Vfs.MimeApplication app) { MainWindow.Toplevel.HandleOpenWith (this, app); };
+ owm = new Widgets.OpenWithMenu (MainWindow.Toplevel.SelectedMimeTypes, "f-spot");
+ owm.ApplicationActivated += delegate (AppInfo app) { MainWindow.Toplevel.HandleOpenWith (this, app); };
return (Gtk.Menu) owm;
}
Modified: trunk/src/MainWindow.cs
==============================================================================
--- trunk/src/MainWindow.cs (original)
+++ trunk/src/MainWindow.cs Mon Nov 3 13:43:20 2008
@@ -1,5 +1,6 @@
using Gdk;
using Gtk;
+
using Glade;
using Mono.Addins;
using Mono.Unix;
@@ -3049,7 +3050,7 @@
}
}
- public void HandleOpenWith (object sender, Gnome.Vfs.MimeApplication mime_application)
+ public void HandleOpenWith (object sender, GLib.AppInfo application)
{
Photo[] selected = SelectedPhotos ();
@@ -3060,7 +3061,7 @@
string msg = String.Format (Catalog.GetPluralString (
"Before launching {1}, should F-Spot create a new version of the selected photo to preserve the original?",
"Before launching {1}, should F-Spot create new versions of the selected photos to preserve the originals?", selected.Length),
- selected.Length, mime_application.Name);
+ selected.Length, application.Name);
// FIXME add cancel button? add help button?
HigMessageDialog hmd = new HigMessageDialog(GetToplevel (sender), DialogFlags.DestroyWithParent,
@@ -3089,7 +3090,7 @@
foreach (Photo photo in selected) {
try {
if (create_new_versions) {
- uint version = photo.CreateNamedVersion (mime_application.Name, photo.DefaultVersionId, true);
+ uint version = photo.CreateNamedVersion (application.Name, photo.DefaultVersionId, true);
photo.DefaultVersionId = version;
}
} catch (Exception e) {
@@ -3109,7 +3110,11 @@
if (create_new_versions)
db.Photos.Commit (selected);
- mime_application.Launch (uri_list);
+ try {
+ application.LaunchUris (uri_list, null);
+ } catch (System.Exception) {
+ Log.ErrorFormat ("Failed to lauch {0}", application.Name);
+ }
}
public void GetWidgetPosition(Widget widget, out int x, out int y)
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Mon Nov 3 13:43:20 2008
@@ -337,6 +337,7 @@
$(LINK_SMUGMUG) \
$(LINK_TAO) \
$(LINK_SEMWEB) \
+ $(LINK_GIO) \
-r:System.Data \
-r:System.Web \
-r:Mono.Data.SqliteClient \
Modified: trunk/src/Widgets/OpenWithMenu.cs
==============================================================================
--- trunk/src/Widgets/OpenWithMenu.cs (original)
+++ trunk/src/Widgets/OpenWithMenu.cs Mon Nov 3 13:43:20 2008
@@ -27,9 +27,6 @@
public delegate string [] TypeFetcher ();
TypeFetcher type_fetcher;
- string [] types;
- bool populated = false;
-
List<string> ignore_apps;
public string [] IgnoreApp {
get {
@@ -39,7 +36,7 @@
}
}
- bool show_icons = false;
+ bool show_icons = true;
public bool ShowIcons {
get { return show_icons; }
set { show_icons = value; }
@@ -58,20 +55,11 @@
//FIXME: this should be private and done on Draw()
public void Populate (object sender, EventArgs args)
{
- string [] types = type_fetcher ();
-
- if (this.types != types && populated) {
- populated = false;
-
- Widget [] dead_pool = Children;
- for (int i = 0; i < dead_pool.Length; i++)
- dead_pool [i].Destroy ();
- }
-
- if (populated)
- return;
+ Widget [] dead_pool = Children;
+ for (int i = 0; i < dead_pool.Length; i++)
+ dead_pool [i].Destroy ();
- foreach (AppInfo app in ApplicationsFor (types)) {
+ foreach (AppInfo app in ApplicationsFor (type_fetcher ())) {
AppMenuItem i = new AppMenuItem (app, show_icons);
i.Activated += HandleItemActivated;
Append (i);
@@ -84,22 +72,22 @@
}
ShowAll ();
-
- populated = true;
}
AppInfo[] ApplicationsFor (string [] types)
{
List<AppInfo> app_infos = new List<AppInfo> ();
+ HashSet<string> existing_ids = new HashSet<string> ();
foreach (string type in types)
foreach (AppInfo appinfo in AppInfoAdapter.GetAllForType (type)) {
- if (app_infos.Contains (appinfo))
+ if (existing_ids.Contains (appinfo.Id))
continue;
if (!appinfo.SupportsUris ())
continue;
if (ignore_apps != null && ignore_apps.Contains (appinfo.Executable))
continue;
app_infos.Add (appinfo);
+ existing_ids.Add (appinfo.Id);
}
return app_infos.ToArray ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]