Beispiel #1
0
 public ListStoreMapping()
 {
     store_types = new List<GType>();
     callbacks = new List<GetStoreValueCallback>();
     store_types.Add((GType)typeof(DataRow));
     ColumnsStore = new NodeStore(typeof(ConfigurableColumn));
 }
Beispiel #2
0
 public PagoParcialDialog(Gtk.Window parent,string monto, List<Produc> listapago,string usuario)
 {
     this.listaPago_ = listapago;
     this.usuario_ = usuario;
     this.pagototal = monto;
     this.Build ();
 }
		internal static async void Execute ()
		{
			var project = IdeApp.ProjectOperations.CurrentSelectedProject;
			if (project == null)
				return;
			var analysisProject = TypeSystemService.GetCodeAnalysisProject (project);
			if (analysisProject == null)
				return;
			try {
				using (var monitor = IdeApp.Workbench.ProgressMonitors.GetStatusProgressMonitor (GettextCatalog.GetString ("Analyzing project"), null, false, true, false, null, true)) {
					CancellationToken token = monitor.CancellationToken;
					var allDiagnostics = await Task.Run (async delegate {
						var diagnosticList = new List<Diagnostic> ();
						monitor.BeginTask (GettextCatalog.GetString ("Analyzing {0}", project.Name), 1);
						var providers = await AnalyzeWholeSolutionHandler.GetProviders (analysisProject);
						diagnosticList.AddRange (await AnalyzeWholeSolutionHandler.GetDiagnostics (analysisProject, providers, token));
						monitor.EndTask ();
						return diagnosticList;
					}).ConfigureAwait (false);

					await Runtime.RunInMainThread (delegate {
						AnalyzeWholeSolutionHandler.Report (monitor, allDiagnostics, project);
					}).ConfigureAwait (false);
				}
			} catch (OperationCanceledException) {
			} catch (AggregateException ae) {
				ae.Flatten ().Handle (ix => ix is OperationCanceledException);
			} catch (Exception e) {
				LoggingService.LogError ("Error while running diagnostics.", e);
			}
		}
Beispiel #4
0
    public static string RandomNoteColor()
    {
        GLib.List colors = new GLib.List(typeof(string));
        colors.Append("#f4ff51");
        colors.Append("#88dcd5");
        colors.Append("#b3f75f");
        colors.Append("#f75f77");
        colors.Append("#dc5ff7");
        Random random = new Random();

        return((string)colors[random.Next(colors.Count)]);
    }
Beispiel #5
0
		public ZlibDecompressor (GLib.ZlibCompressorFormat format) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (ZlibDecompressor)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("format");
				vals.Add (new GLib.Value (format));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_zlib_decompressor_new((int) format);
		}
Beispiel #6
0
		public InetAddress (GLib.SocketFamily family) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (InetAddress)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("family");
				vals.Add (new GLib.Value (family));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_inet_address_new_any((int) family);
		}
		public ThreadedSocketService (int max_threads) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (ThreadedSocketService)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("max_threads");
				vals.Add (new GLib.Value (max_threads));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_threaded_socket_service_new(max_threads);
		}
Beispiel #8
0
		public SimplePermission (bool allowed) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (SimplePermission)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("allowed");
				vals.Add (new GLib.Value (allowed));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_simple_permission_new(allowed);
		}
Beispiel #9
0
        protected void LoadItems(System.IO.FileInfo [] files)
        {
            List<IBrowsableItem> items = new List<IBrowsableItem> ();
            foreach (var f in files) {
                if (FSpot.ImageFile.HasLoader (f.FullName)) {
                    Console.WriteLine (f.FullName);
                    items.Add (new FileBrowsableItem (f.FullName));
                }
            }

            list = items;
            this.Reload ();
        }
Beispiel #10
0
		public UnixFDMessage (GLib.UnixFDList fd_list) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (UnixFDMessage)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (fd_list != null) {
					names.Add ("fd_list");
					vals.Add (new GLib.Value (fd_list));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_unix_fd_message_new_with_fd_list(fd_list == null ? IntPtr.Zero : fd_list.Handle);
		}
Beispiel #11
0
		public FileIcon (GLib.IFile file) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (FileIcon)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (file != null) {
					names.Add ("file");
					vals.Add (new GLib.Value (file));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_file_icon_new(file == null ? IntPtr.Zero : ((file is GLib.Object) ? (file as GLib.Object).Handle : (file as GLib.FileAdapter).Handle));
		}
Beispiel #12
0
		public Settings (string schema) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Settings)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("schema");
				vals.Add (new GLib.Value (schema));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_schema = GLib.Marshaller.StringToPtrGStrdup (schema);
			Raw = g_settings_new(native_schema);
			GLib.Marshaller.Free (native_schema);
		}
		public BookmarksItemProvider ()
		{
			items = new List<AbstractDockItem> ();

			computer = new NonRemovableItem ("computer://", Catalog.GetString ("Computer"), "computer");
			home = FileDockItem.NewFromUri (string.Format ("file://{0}",
			    Environment.GetFolderPath (Environment.SpecialFolder.Personal)));
		
			UpdateItems ();
			
			watcher = FileMonitor.File (BookmarksFile, FileMonitorFlags.None, null);
			
			watcher.Changed += WatcherChanged;
		}
Beispiel #14
0
        public PagoChequeDialog(Gtk.Window parent,string monto, List<Produc> listapago,string usuario)
            : base("Pago Con Cheque", parent, Gtk.DialogFlags.DestroyWithParent)
        {
            this.listaPago_ = listapago;
            this.usuario_ = usuario;
            this.pagototal = monto;
            this.Build ();
            this.db = new ControladorBaseDatos();

            bool correcta = false;

            try {
                correcta = this.db.ConfiguracionCorrectaBd;
            }
            catch (Exception ex)
            {
                correcta = false;
            }
            if (!correcta)
            {

                this.db = null;
                this.db = new ControladorBaseDatos();

                correcta = false;

                try {
                    correcta = this.db.ConfiguracionCorrectaBd;
                }
                catch (Exception ex)
                {
                    correcta = false;
                }
            }

            comboboxBanco.AppendText("Santander");
            comboboxBanco.AppendText("Chile");
            comboboxBanco.AppendText("BCI");

            comboboxPlaza.AppendText("Valdivia");
            comboboxPlaza.AppendText("Santiago");
            comboboxPlaza.AppendText("Rancagua");
            comboboxPlaza.AppendText("Talca");
            comboboxPlaza.AppendText("Chillan");
            comboboxPlaza.AppendText("Concepcion");
            comboboxPlaza.AppendText("Osorno");
            comboboxPlaza.AppendText("Puerto Montt");

            entryMonto.Text=monto;
        }
Beispiel #15
0
		public Emblem (GLib.IIcon icon) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Emblem)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (icon != null) {
					names.Add ("icon");
					vals.Add (new GLib.Value (icon));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_emblem_new(icon == null ? IntPtr.Zero : ((icon is GLib.Object) ? (icon as GLib.Object).Handle : (icon as GLib.IconAdapter).Handle));
		}
		public UnixCredentialsMessage (GLib.Credentials credentials) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (UnixCredentialsMessage)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (credentials != null) {
					names.Add ("credentials");
					vals.Add (new GLib.Value (credentials));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_unix_credentials_message_new_with_credentials(credentials == null ? IntPtr.Zero : credentials.Handle);
		}
		public BufferedOutputStream (GLib.OutputStream base_stream) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (BufferedOutputStream)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (base_stream != null) {
					names.Add ("base_stream");
					vals.Add (new GLib.Value (base_stream));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_buffered_output_stream_new(base_stream == null ? IntPtr.Zero : base_stream.Handle);
		}
Beispiel #18
0
		public UnixSocketAddress (string path) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (UnixSocketAddress)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("path");
				vals.Add (new GLib.Value (path));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_path = GLib.Marshaller.StringToPtrGStrdup (path);
			Raw = g_unix_socket_address_new(native_path);
			GLib.Marshaller.Free (native_path);
		}
Beispiel #19
0
        // Called when the NoteAddin is attached to a Note
        public override void Initialize()
        {
            csList = new List<CodeSnippetWindow> ();

            if (Note.TagTable.Lookup ("codesnippet_code") == null) {
                NoteTag codesnippet_code_tag = new NoteTag ("codesnippet_code");
                /* Invisible causes instability, replaced by Size = 1
                 * But it seems not to work in Windows. */
                codesnippet_code_tag.Invisible = true;
                codesnippet_code_tag.Size = 1;
                codesnippet_code_tag.Editable = false;
                codesnippet_code_tag.CanSerialize = false;
                Note.TagTable.Add (codesnippet_code_tag);
            }
        }
Beispiel #20
0
		public NetworkAddress (string hostname, ushort port) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (NetworkAddress)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("hostname");
				vals.Add (new GLib.Value (hostname));
				names.Add ("port");
				vals.Add (new GLib.Value (port));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_hostname = GLib.Marshaller.StringToPtrGStrdup (hostname);
			Raw = g_network_address_new(native_hostname, port);
			GLib.Marshaller.Free (native_hostname);
		}
Beispiel #21
0
		public Application (string application_id, GLib.ApplicationFlags flags) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Application)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("application_id");
				vals.Add (new GLib.Value (application_id));
				names.Add ("flags");
				vals.Add (new GLib.Value (flags));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_application_id = GLib.Marshaller.StringToPtrGStrdup (application_id);
			Raw = g_application_new(native_application_id, (int) flags);
			GLib.Marshaller.Free (native_application_id);
		}
Beispiel #22
0
		public SimpleAction (string name, GLib.VariantType parameter_type) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (SimpleAction)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("name");
				vals.Add (new GLib.Value (name));
				names.Add ("parameter_type");
				vals.Add (new GLib.Value (parameter_type));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup (name);
			Raw = g_simple_action_new(native_name, parameter_type == null ? IntPtr.Zero : parameter_type.Handle);
			GLib.Marshaller.Free (native_name);
		}
Beispiel #23
0
		public InetSocketAddress (GLib.InetAddress address, ushort port) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (InetSocketAddress)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (address != null) {
					names.Add ("address");
					vals.Add (new GLib.Value (address));
				}
				names.Add ("port");
				vals.Add (new GLib.Value (port));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_inet_socket_address_new(address == null ? IntPtr.Zero : address.Handle, port);
		}
		public ConverterOutputStream (GLib.OutputStream base_stream, GLib.IConverter converter) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (ConverterOutputStream)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (base_stream != null) {
					names.Add ("base_stream");
					vals.Add (new GLib.Value (base_stream));
				}
				if (converter != null) {
					names.Add ("converter");
					vals.Add (new GLib.Value (converter));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_converter_output_stream_new(base_stream == null ? IntPtr.Zero : base_stream.Handle, converter == null ? IntPtr.Zero : ((converter is GLib.Object) ? (converter as GLib.Object).Handle : (converter as GLib.ConverterAdapter).Handle));
		}
		public TcpWrapperConnection (GLib.IOStream base_io_stream, GLib.Socket socket) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (TcpWrapperConnection)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				if (base_io_stream != null) {
					names.Add ("base_io_stream");
					vals.Add (new GLib.Value (base_io_stream));
				}
				if (socket != null) {
					names.Add ("socket");
					vals.Add (new GLib.Value (socket));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			Raw = g_tcp_wrapper_connection_new(base_io_stream == null ? IntPtr.Zero : base_io_stream.Handle, socket == null ? IntPtr.Zero : socket.Handle);
		}
Beispiel #26
0
		public Settings (string schema, GLib.SettingsBackend backend) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (Settings)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("schema");
				vals.Add (new GLib.Value (schema));
				if (backend != null) {
					names.Add ("backend");
					vals.Add (new GLib.Value (backend));
				}
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_schema = GLib.Marshaller.StringToPtrGStrdup (schema);
			Raw = g_settings_new_with_backend(native_schema, backend == null ? IntPtr.Zero : backend.Handle);
			GLib.Marshaller.Free (native_schema);
		}
Beispiel #27
0
        public void TasksRemoved(object o, Evolution.ObjectsRemovedArgs args)
        {
            Logger.Debug("Tasks Removed");
            Gtk.TreeIter iter;

            GLib.List removedTasksList = new GLib.List(args.Uids.Handle,
                                                       typeof(CalComponentId));

            foreach (CalComponentId id in removedTasksList)
            {
                if (taskIters.ContainsKey(id.Uid))
                {
                    iter = taskIters[id.Uid];
                    taskStore.Remove(ref iter);
                }
            }

            Logger.Debug("{0} Tasks removed in EDS", removedTasksList.Count);
        }
		public MemoryOutputStream (IntPtr data, ulong size, GLib.ReallocFunc realloc_function, GLib.DestroyNotify destroy_function) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (MemoryOutputStream)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("data");
				vals.Add (new GLib.Value (data));
				names.Add ("size");
				vals.Add (new GLib.Value (size));
				names.Add ("realloc_function");
				vals.Add (new GLib.Value (realloc_function));
				names.Add ("destroy_function");
				vals.Add (new GLib.Value (destroy_function));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			GLibSharp.ReallocFuncWrapper realloc_function_wrapper = new GLibSharp.ReallocFuncWrapper (realloc_function);
			Raw = g_memory_output_stream_new(data, new UIntPtr (size), realloc_function_wrapper.NativeDelegate, destroy_function);
		}
Beispiel #29
0
        public static bool Remove(IdleHandler hndlr)
        {
            bool result = false;
            List<uint> keys = new List<uint> ();

            lock (Source.source_handlers) {
                foreach (uint code in Source.source_handlers.Keys) {
                    IdleProxy p = Source.source_handlers [code] as IdleProxy;

                    if (p != null && p.real_handler == hndlr) {
                        keys.Add (code);
                        result = g_source_remove (code);
                    }
                }

                foreach (object key in keys)
                    Source.source_handlers.Remove (key);
            }

            return result;
        }
Beispiel #30
0
        public PagoTarjetaDialog(Gtk.Window parent,string monto, List<Produc> listapago,string usuario)
            : base("Pago Con Tarjeta", parent, Gtk.DialogFlags.DestroyWithParent)
        {
            this.listaPago_ = listapago;
            this.usuario_ = usuario;
            this.pagototal = monto;
            this.Build ();
            this.db = new ControladorBaseDatos();

            bool correcta = false;

            try {
                correcta = this.db.ConfiguracionCorrectaBd;
            }
            catch (Exception ex)
            {
                correcta = false;
            }
            if (!correcta)
            {

                this.db = null;
                this.db = new ControladorBaseDatos();

                correcta = false;

                try {
                    correcta = this.db.ConfiguracionCorrectaBd;
                }
                catch (Exception ex)
                {
                    correcta = false;
                }
            }

            comboboxentryTipoTarjeta.AppendText("RedCompra");
            comboboxentryTipoTarjeta.AppendText("Visa");
            comboboxentryTipoTarjeta.AppendText("Mastercard");
            entryMonto.Text=monto;
        }
Beispiel #31
0
    public void SetupWindow()
    {
        this.background_window = new Window("Sticky");
        this.background_window.ModifyBg(StateType.Normal, new Gdk.Color(0, 0, 0));
        this.background_window.Decorated = false;
        this.background_window.Opacity   = 0.6;
        this.background_window.Maximize();         // Fullscreen() later

        this.background_window.DeleteEvent     += new DeleteEventHandler(Window_Delete);
        this.background_window.KeyReleaseEvent += new KeyReleaseEventHandler(check_shortcuts);

        this.note_windows = new GLib.List(typeof(NoteWindow));

        this.add_eventbox = new EventBox();
        this.add_eventbox.Add(new Gtk.Image("./note-add.png"));
        this.add_eventbox.VisibleWindow     = false;
        this.add_eventbox.ButtonPressEvent += new ButtonPressEventHandler(AddNote);
        //this.add_eventbox.EnterNotifyEvent += new EnterNotifyEventHandler (AddNote);
        this.grid = new Fixed();
        this.grid.Put(add_eventbox, 10, 10);
        this.background_window.Add(this.grid);
    }
Beispiel #32
0
		public NetworkService (string service, string protocol, string domain) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (NetworkService)) {
				var vals = new List<GLib.Value> ();
				var names = new List<string> ();
				names.Add ("service");
				vals.Add (new GLib.Value (service));
				names.Add ("protocol");
				vals.Add (new GLib.Value (protocol));
				names.Add ("domain");
				vals.Add (new GLib.Value (domain));
				CreateNativeObject (names.ToArray (), vals.ToArray ());
				return;
			}
			IntPtr native_service = GLib.Marshaller.StringToPtrGStrdup (service);
			IntPtr native_protocol = GLib.Marshaller.StringToPtrGStrdup (protocol);
			IntPtr native_domain = GLib.Marshaller.StringToPtrGStrdup (domain);
			Raw = g_network_service_new(native_service, native_protocol, native_domain);
			GLib.Marshaller.Free (native_service);
			GLib.Marshaller.Free (native_protocol);
			GLib.Marshaller.Free (native_domain);
		}
Beispiel #33
0
	public void SetupWindow() {

		this.background_window = new Window("Sticky");
        this.background_window.ModifyBg( StateType.Normal, new Gdk.Color (0, 0, 0) );
		this.background_window.Decorated = false;
		this.background_window.Opacity = 0.6;
		this.background_window.Maximize(); // Fullscreen() later

		this.background_window.DeleteEvent += new DeleteEventHandler (Window_Delete);
		this.background_window.KeyReleaseEvent += new KeyReleaseEventHandler(check_shortcuts);

		this.note_windows = new GLib.List (typeof (NoteWindow));

		this.add_eventbox = new EventBox();
		this.add_eventbox.Add(new Gtk.Image("./note-add.png"));
		this.add_eventbox.VisibleWindow = false;
		this.add_eventbox.ButtonPressEvent += new ButtonPressEventHandler (AddNote);
		//this.add_eventbox.EnterNotifyEvent += new EnterNotifyEventHandler (AddNote);
		this.grid = new Fixed();
		this.grid.Put(add_eventbox, 10, 10);
		this.background_window.Add(this.grid);

	}
Beispiel #34
0
 public void LaunchWithFiles(IEnumerable <IFileItem> files)
 {
     string [] uris  = files.Select(file => file.Uri).ToArray();
     GLib.List glist = new GLib.List(uris as object[], typeof(string), false, true);
     item.Launch(glist, null);
 }
Beispiel #35
0
        void LaunchWithFiles(GLib.File app, IEnumerable <GLib.File> files)
        {
            AppInfo appinfo = null;

            if (app != null)
            {
                appinfo = GLib.DesktopAppInfo.NewFromFilename(app.Path);
            }
            else
            {
                if (!files.Any())
                {
                    return;
                }

                // if we weren't given an app info, query the file for the default handler
                try {
                    appinfo = files.First().QueryDefaultHandler(null);
                } catch {
                    // file probably doesnt exist
                    return;
                }
            }

            try {
                GLib.List launchList;

                if (!files.Any())
                {
                    appinfo.Launch(null, null);

                    // check if the app supports files or Uris
                }
                else if (appinfo.SupportsFiles)
                {
                    launchList = new GLib.List(new GLib.File[] {}, typeof(GLib.File), true, false);
                    foreach (GLib.File f in files)
                    {
                        launchList.Append(f);
                    }

                    appinfo.Launch(launchList, null);
                    launchList.Dispose();
                }
                else if (appinfo.SupportsUris)
                {
                    launchList = new GLib.List(new string[] {}, typeof(string), true, true);
                    foreach (GLib.File f in files)
                    {
                        // try to use GLib.File.Uri first, if that throws an exception,
                        // catch and use P/Invoke to libdocky.  If that's still null, warn & skip the file.
                        try {
                            launchList.Append(f.Uri.ToString());
                        } catch (UriFormatException) {
                            string uri = f.StringUri();
                            if (string.IsNullOrEmpty(uri))
                            {
                                Log <SystemService> .Warn("Failed to retrieve URI for {0}.  It will be skipped.", f.Path);

                                continue;
                            }
                            launchList.Append(uri);
                        }
                    }
                    appinfo.LaunchUris(launchList, null);
                    launchList.Dispose();
                }
                else
                {
                    Log <SystemService> .Error("Error opening files. The application doesn't support files/URIs or wasn't found.");
                }
            } catch (GException e) {
                Log.Notify(string.Format("Error running: {0}", appinfo.Name), Gtk.Stock.DialogWarning, e.Message);
                Log <SystemService> .Error(e.Message);

                Log <SystemService> .Info(e.StackTrace);
            }

            (appinfo as IDisposable).Dispose();
        }
Beispiel #36
0
        protected void CreateNewVersion()
        {
            try {
                System.Uri original_uri = GetUriForVersionFileName(this.currentphoto, this.currentphoto.DefaultVersion.Uri.LocalPath);
                System.Uri new_uri      = GetUriForVersionFileName(this.currentphoto, new_filename);
                Console.WriteLine("ok pressed: old: " + this.currentphoto.DefaultVersion.Uri.LocalPath + "; " + original_uri.ToString() + " new: " + new_filename + "; " + new_uri.ToString() + "to open with: ");

                // check if new version exist and remove
                foreach (uint id in currentphoto.VersionIds)
                {
                    if (currentphoto.GetVersion(id).Name == new_version_entry.Text)
                    {
                        this.currentphoto.DeleteVersion(id);
                    }
                }
                GLib.File destination = GLib.FileFactory.NewForUri(new_uri);
                if (destination.Exists)
                {
                    throw new Exception(String.Format("An object at this uri {0} already exists", new_uri));
                }

                //FIXME. or better, fix the copy api !
                GLib.File source = GLib.FileFactory.NewForUri(original_uri);
                source.Copy(destination, GLib.FileCopyFlags.None, null, null);

                this.currentphoto.DefaultVersionId = this.currentphoto.AddVersion(new SafeUri(new_uri).GetBaseUri(), new SafeUri(new_uri).GetFilename(), new_version_entry.Text, true);
                App.Instance.Database.Photos.Commit(this.currentphoto);

                this.currentphoto.Changes.DataChanged = true;;
                // run new version with selected application
                Gtk.TreeIter iter;
                if (owcb.GetActiveIter(out iter))
                {
                    Console.WriteLine((string)owcb.Model.GetValue(iter, 0));
                    Console.WriteLine((string)owcb.Model.GetValue(iter, 1));
                    Console.WriteLine((string[])owcb.Model.GetValue(iter, 2));
                    Console.WriteLine("Getting applications again");

                    ArrayList union = new ArrayList();
//string[] weekDays = new string[] { "image/jpeg", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
                    foreach (string mime_type in (string [])owcb.Model.GetValue(iter, 2))
                    {
                        //foreach (string mime_type in (string []) weekDays) {
                        if (mime_type == null)
                        {
                            continue;
                        }
                        MimeApplication [] apps = Gnome.Vfs.Mime.GetAllApplications(mime_type);
                        foreach (MimeApplication app in apps)
                        {
                            if (!union.Contains(app))
                            {
                                union.Add(app);
                            }
                        }
                    }
                    foreach (MimeApplication app in union)
                    {
                        if (app.BinaryName.ToString() == (string)owcb.Model.GetValue(iter, 1))
                        {
                            Console.WriteLine("Winner is " + (string)owcb.Model.GetValue(iter, 1));
                            // is there a better way to get a GLib.List???
                            GLib.List uri_list = new GLib.List(typeof(string));
                            uri_list.Append(new_uri.ToString());
                            app.Launch(uri_list);
                        }
                    }
                }
            } finally {
                Gtk.Application.Invoke(delegate { dialog.Destroy(); });
            }
        }