コード例 #1
0
ファイル: SrvTarget.cs プロジェクト: f-spot/f-spot-xplat
        public static GLib.List ListSort(GLib.List targets)
        {
            var raw_ret = g_srv_target_list_sort(targets == null ? IntPtr.Zero : targets.Handle);
            var ret     = new GLib.List(raw_ret);

            return(ret);
        }
コード例 #2
0
        public RadioMenuItem(RadioMenuItem[] group, string label) : base(IntPtr.Zero)
        {
            if (GetType() != typeof(RadioMenuItem))
            {
                CreateNativeObject(new string [0], new GLib.Value [0]);
                AccelLabel al = new AccelLabel("");
                al.TextWithMnemonic = label;
                al.SetAlignment(0.0f, 0.5f);
                Add(al);
                al.AccelWidget = this;
                Group          = group;
                return;
            }
            IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup(label);
            IntPtr native_group = IntPtr.Zero;

            if (group != null)
            {
                GLib.List list = new GLib.List(IntPtr.Zero);
                foreach (RadioMenuItem item in group)
                {
                    list.Append(item.Handle);
                }
                native_group = list.Handle;
            }
            Raw = gtk_radio_menu_item_new_with_mnemonic(native_group, native_label);
            GLib.Marshaller.Free(native_label);
        }
コード例 #3
0
ファイル: Layer.cs プロジェクト: nimeshgit/gstreamer-sharp
        public bool SetActiveForTracks(bool active, GLib.List tracks)
        {
            bool raw_ret = ges_layer_set_active_for_tracks(Handle, active, tracks == null ? IntPtr.Zero : tracks.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
コード例 #4
0
        public static GLib.List IdListFromApplicationList(GLib.List applications)
        {
            IntPtr raw_ret = gnome_vfs_mime_id_list_from_application_list(applications == null ? IntPtr.Zero : applications.Handle);

            GLib.List ret = new GLib.List(raw_ret);
            return(ret);
        }
コード例 #5
0
ファイル: Io.cs プロジェクト: Yetangitu/f-spot
		public static GLib.List ModulesLoadAllInDirectory(string dirname) {
			IntPtr native_dirname = GLib.Marshaller.StringToPtrGStrdup (dirname);
			IntPtr raw_ret = g_io_modules_load_all_in_directory(native_dirname);
			GLib.List ret = new GLib.List(raw_ret);
			GLib.Marshaller.Free (native_dirname);
			return ret;
		}
コード例 #6
0
        public bool Edit(GLib.List layers, int new_layer_priority, GES.EditMode mode, GES.Edge edge, ulong position)
        {
            bool raw_ret = ges_container_edit(Handle, layers == null ? IntPtr.Zero : layers.Handle, new_layer_priority, (int)mode, (int)edge, position);
            bool ret     = raw_ret;

            return(ret);
        }
コード例 #7
0
        public static GLib.List IdListFromComponentList(GLib.List components)
        {
            IntPtr raw_ret = gnome_vfs_mime_id_list_from_component_list(components == null ? IntPtr.Zero : components.Handle);

            GLib.List ret = new GLib.List(raw_ret);
            return(ret);
        }
コード例 #8
0
ファイル: Xfer.cs プロジェクト: gongfuPanada/gnome-sharp
        public static Result XferUriList(Uri[] sources,
                                         Uri[] targets,
                                         XferOptions options,
                                         XferErrorMode errorMode,
                                         XferOverwriteMode overwriteMode,
                                         XferProgressCallback callback)
        {
            XferProgressCallbackWrapper wrapper = new XferProgressCallbackWrapper(callback, null);

            GLib.List sourcesList = new GLib.List(typeof(Uri));
            foreach (Uri uri in sources)
            {
                sourcesList.Append(uri.Handle);
            }

            GLib.List targetsList = new GLib.List(typeof(Uri));
            foreach (Uri uri in targets)
            {
                targetsList.Append(uri.Handle);
            }

            return(gnome_vfs_xfer_uri_list(sourcesList.Handle,
                                           targetsList.Handle,
                                           options, errorMode,
                                           overwriteMode,
                                           wrapper.NativeDelegate,
                                           IntPtr.Zero));
        }
コード例 #9
0
        public static GES.Container Group(GLib.List containers)
        {
            IntPtr raw_ret = ges_container_group(containers == null ? IntPtr.Zero : containers.Handle);

            GES.Container ret = GLib.Object.GetObject(raw_ret) as GES.Container;
            return(ret);
        }
コード例 #10
0
        public bool Start(GLib.List providers, GtkSource.CompletionContext context)
        {
            bool raw_ret = gtk_source_completion_start(Handle, providers == null ? IntPtr.Zero : providers.Handle, context == null ? IntPtr.Zero : context.Handle);
            bool ret     = raw_ret;

            return(ret);
        }
コード例 #11
0
        static IntPtr GetProperties_cb(IntPtr inst)
        {
            try {
                PropertyProbeImplementor __obj = GLib.Object.GetObject(inst, false) as PropertyProbeImplementor;

                string[]  properties      = __obj.Properties;
                GLib.List properties_list = new GLib.List(typeof(IntPtr));
                IntPtr    gclass          = Marshal.ReadIntPtr(inst);
                foreach (string prop in properties)
                {
                    IntPtr name  = GLib.Marshaller.StringToPtrGStrdup(prop);
                    IntPtr pspec = g_object_class_find_property(gclass, name);
                    GLib.Marshaller.Free(name);
                    if (pspec != IntPtr.Zero)
                    {
                        properties_list.Prepend(pspec);
                    }
                }

                /* FIXME: We leak the list! */
                return(properties_list.Handle);
            } catch (Exception e) {
                GLib.ExceptionManager.RaiseUnhandledException(e, true);
                // NOTREACHED: above call does not return.
                throw e;
            }
        }
コード例 #12
0
        public RadioToolButton(RadioToolButton[] group, string stock_id) : base(IntPtr.Zero)
        {
            if (GetType() != typeof(RadioToolButton))
            {
                GLib.Value[] vals  = new GLib.Value [1];
                string[]     names = { "stock_id" };
                vals [0] = new GLib.Value(stock_id);
                CreateNativeObject(names, vals);
                Group = group;
                return;
            }
            IntPtr stock_id_as_native = GLib.Marshaller.StringToPtrGStrdup(stock_id);
            IntPtr native_group       = IntPtr.Zero;

            if (group != null)
            {
                GLib.List list = new GLib.List(IntPtr.Zero);
                foreach (RadioToolButton item in group)
                {
                    list.Append(item.Handle);
                }
                native_group = list.Handle;
            }
            Raw = gtk_radio_tool_button_new_from_stock(native_group, stock_id_as_native);
            GLib.Marshaller.Free(stock_id_as_native);
        }
コード例 #13
0
        public static Gst.PluginFeature[] ListCopy(GLib.List list)
        {
            IntPtr raw_ret = gst_plugin_feature_list_copy(list == null ? IntPtr.Zero : list.Handle);

            Gst.PluginFeature[] ret = (Gst.PluginFeature[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List), true, true, typeof(Gst.PluginFeature));
            return(ret);
        }
コード例 #14
0
        public static Gst.ElementFactory[] ListFilter(GLib.List list, Gst.Caps caps, Gst.PadDirection direction, bool subsetonly)
        {
            IntPtr raw_ret = gst_element_factory_list_filter(list == null ? IntPtr.Zero : list.Handle, caps == null ? IntPtr.Zero : caps.Handle, (int)direction, subsetonly);

            Gst.ElementFactory[] ret = (Gst.ElementFactory[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List), true, true, typeof(Gst.ElementFactory));
            return(ret);
        }
コード例 #15
0
ファイル: FileEnumerator.cs プロジェクト: Yetangitu/f-spot
		public unsafe GLib.List NextFilesFinish(GLib.AsyncResult result) {
			IntPtr error = IntPtr.Zero;
			IntPtr raw_ret = g_file_enumerator_next_files_finish(Handle, result == null ? IntPtr.Zero : result.Handle, out error);
			GLib.List ret = new GLib.List(raw_ret);
			if (error != IntPtr.Zero) throw new GLib.GException (error);
			return ret;
		}
コード例 #16
0
        public static void Init()
        {
            try
            {
                notify_init(Assembly.GetExecutingAssembly().FullName);

                var list = new GLib.List(notify_get_server_caps(), typeof(string));
                foreach (var item in list)
                {
                    if (item.ToString() == "actions")
                    {
                        allowactions = true;
                        break;
                    }
                }

                var methods = typeof(LinuxNotificationHandler).GetMethods(BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic);
                foreach (var m in methods)
                {
                    if (m.Name == "Activated")
                    {
                        activatedmethod = m;
                        break;
                    }
                }

                init = true;
            }
            catch
            {
                Console.WriteLine("Error, libnotify.so.4 was not found, notifications won't be displayed.");
                init = false;
            }
        }
コード例 #17
0
        public bool Edit(GLib.List layers, GES.EditMode mode, GES.Edge edge, ulong position)
        {
            bool raw_ret = ges_track_element_edit(Handle, layers == null ? IntPtr.Zero : layers.Handle, (int)mode, (int)edge, position);
            bool ret     = raw_ret;

            return(ret);
        }
コード例 #18
0
ファイル: RadioMenuItem.cs プロジェクト: Gravecorp/gtk-sharp
 public RadioMenuItem(RadioMenuItem[] group, string label)
     : base(IntPtr.Zero)
 {
     if (GetType () != typeof (RadioMenuItem)) {
         CreateNativeObject (new string [0], new GLib.Value [0]);
         AccelLabel al = new AccelLabel ("");
         al.TextWithMnemonic = label;
         al.SetAlignment (0.0f, 0.5f);
         Add (al);
         al.AccelWidget = this;
         Group = group;
         return;
     }
     IntPtr native_label = GLib.Marshaller.StringToPtrGStrdup (label);
     IntPtr native_group = IntPtr.Zero;
     if (group != null) {
         GLib.List list = new GLib.List(IntPtr.Zero);
         foreach (RadioMenuItem item in group) {
             list.Append (item.Handle);
         }
         native_group = list.Handle;
     }
     Raw = gtk_radio_menu_item_new_with_mnemonic(native_group, native_label);
     GLib.Marshaller.Free (native_label);
 }
コード例 #19
0
        public string GetDisplay(GLib.AppInfo info, GLib.List files)
        {
            IntPtr raw_ret = g_app_launch_context_get_display(Handle, info == null ? IntPtr.Zero : info.Handle, files == null ? IntPtr.Zero : files.Handle);
            string ret     = GLib.Marshaller.PtrToStringGFree(raw_ret);

            return(ret);
        }
コード例 #20
0
        public Gnome.Vfs.Result Launch(GLib.List uris)
        {
            int raw_ret = gnome_vfs_mime_application_launch(Handle, uris == null ? IntPtr.Zero : uris.Handle);

            Gnome.Vfs.Result ret = (Gnome.Vfs.Result)raw_ret;
            return(ret);
        }
コード例 #21
0
        public string GetStartupNotifyId(AppInfo info, GLib.List files)
        {
            var    raw_ret = g_app_launch_context_get_startup_notify_id(Handle, info == null ? IntPtr.Zero : info.Handle, files == null ? IntPtr.Zero : files.Handle);
            string ret     = GLib.Marshaller.PtrToStringGFree(raw_ret);

            return(ret);
        }
コード例 #22
0
        public Gnome.Vfs.Result LaunchWithEnv(GLib.List uris, string envp)
        {
            int raw_ret = gnome_vfs_mime_application_launch_with_env(Handle, uris == null ? IntPtr.Zero : uris.Handle, GLib.Marshaller.StringToPtrGStrdup(envp));

            Gnome.Vfs.Result ret = (Gnome.Vfs.Result)raw_ret;
            return(ret);
        }
コード例 #23
0
        public static GLib.SrvTarget[] ListSort(GLib.List targets)
        {
            IntPtr raw_ret = g_srv_target_list_sort(targets == null ? IntPtr.Zero : targets.Handle);

            GLib.SrvTarget[] ret = (GLib.SrvTarget[])GLib.Marshaller.ListPtrToArray(raw_ret, typeof(GLib.List), false, false, typeof(GLib.SrvTarget));
            return(ret);
        }
コード例 #24
0
        public GLib.List BoxFrame()
        {
            IntPtr raw_ret = f_detect(Handle);

            GLib.List list = new GLib.List(raw_ret, typeof(Gdk.Rectangle), true, true);
            return(list);
        }
コード例 #25
0
ファイル: Global.cs プロジェクト: MrJoe/lat
        public static GnomeKeyring.Result FindNetworkPassword(string user, out NetworkPasswordData[] result)
        {
            IntPtr result_handle;
            IntPtr user_as_native     = GLib.Marshaller.StringToPtrGStrdup(user);
            IntPtr domain_as_native   = GLib.Marshaller.StringToPtrGStrdup(null);
            IntPtr server_as_native   = GLib.Marshaller.StringToPtrGStrdup(null);
            IntPtr objekt_as_native   = GLib.Marshaller.StringToPtrGStrdup(null);
            IntPtr protocol_as_native = GLib.Marshaller.StringToPtrGStrdup(null);
            IntPtr authtype_as_native = GLib.Marshaller.StringToPtrGStrdup(null);
            int    raw_ret            = gnome_keyring_find_network_password_sync(user_as_native, domain_as_native, server_as_native, objekt_as_native, protocol_as_native, authtype_as_native, 0, out result_handle);

            GnomeKeyring.Result ret = (GnomeKeyring.Result)raw_ret;
            GLib.Marshaller.Free(user_as_native);
            GLib.Marshaller.Free(domain_as_native);
            GLib.Marshaller.Free(server_as_native);
            GLib.Marshaller.Free(objekt_as_native);
            GLib.Marshaller.Free(protocol_as_native);
            GLib.Marshaller.Free(authtype_as_native);

            GLib.List l = new GLib.List(result_handle, typeof(NetworkPasswordData));
            result = new NetworkPasswordData[l.Count];
            for (int i = 0; i < l.Count; i++)
            {
                result[i] = (NetworkPasswordData)l[i];
            }

            return(ret);
        }
コード例 #26
0
        public string GetStartupNotifyId(GLib.IAppInfo info, GLib.List files)
        {
            IntPtr raw_ret = g_app_launch_context_get_startup_notify_id(Handle, info == null ? IntPtr.Zero : ((info is GLib.Object) ? (info as GLib.Object).Handle : (info as GLib.AppInfoAdapter).Handle), files == null ? IntPtr.Zero : files.Handle);
            string ret     = GLib.Marshaller.PtrToStringGFree(raw_ret);

            return(ret);
        }
コード例 #27
0
        public GLib.List GetSlaves(Gdk.SeatCapabilities capabilities)
        {
            IntPtr raw_ret = gdk_seat_get_slaves(Handle, (int)capabilities);

            GLib.List ret = new GLib.List(raw_ret);
            return(ret);
        }
コード例 #28
0
        public static GLib.List TypesGetRegistered()
        {
            var raw_ret = g_content_types_get_registered();
            var ret     = new GLib.List(raw_ret);

            return(ret);
        }
コード例 #29
0
ファイル: Object.cs プロジェクト: xiaohszx/gstreamer-sharp
        public static bool CheckUniqueness(GLib.List list, string name)
        {
            IntPtr native_name = GLib.Marshaller.StringToPtrGStrdup(name);
            bool   raw_ret     = gst_object_check_uniqueness(list == null ? IntPtr.Zero : list.Handle, native_name);
            bool   ret         = raw_ret;

            GLib.Marshaller.Free(native_name);
            return(ret);
        }
コード例 #30
0
        public static GLib.List ItemizeWithBaseDir(Pango.Context context, Pango.Direction base_dir, string text, int start_index, int length, Pango.AttrList attrs, Pango.AttrIterator cached_iter)
        {
            IntPtr native_text = GLib.Marshaller.StringToPtrGStrdup(text);
            IntPtr raw_ret     = pango_itemize_with_base_dir(context == null ? IntPtr.Zero : context.Handle, (int)base_dir, native_text, start_index, length, attrs == null ? IntPtr.Zero : attrs.Handle, cached_iter == null ? IntPtr.Zero : cached_iter.Handle);

            GLib.List ret = new GLib.List(raw_ret);
            GLib.Marshaller.Free(native_text);
            return(ret);
        }
コード例 #31
0
ファイル: TreeSelection.cs プロジェクト: Gravecorp/gtk-sharp
        public TreePath[] GetSelectedRows()
        {
            IntPtr list_ptr = gtk_tree_selection_get_selected_rows (Handle, IntPtr.Zero);
            if (list_ptr == IntPtr.Zero)
                return new TreePath [0];

            GLib.List list = new GLib.List (list_ptr, typeof (Gtk.TreePath));
            return (TreePath[]) GLib.Marshaller.ListToArray (list, typeof (Gtk.TreePath));
        }
コード例 #32
0
ファイル: Event.cs プロジェクト: GStreamer/gstreamer-sharp
        public GLib.List ParseSelectStreams()
        {
            GLib.List streams;
            IntPtr    native_streams;

            gst_event_parse_select_streams(Handle, out native_streams);
            streams = new GLib.List(native_streams);
            return(streams);
        }
コード例 #33
0
        public static GLib.List ModulesLoadAllInDirectoryWithScope(string dirname, GLib.IOModuleScope scope)
        {
            IntPtr native_dirname = GLib.Marshaller.StringToPtrGStrdup(dirname);
            IntPtr raw_ret        = g_io_modules_load_all_in_directory_with_scope(native_dirname, scope == null ? IntPtr.Zero : scope.Handle);

            GLib.List ret = new GLib.List(raw_ret);
            GLib.Marshaller.Free(native_dirname);
            return(ret);
        }
コード例 #34
0
ファイル: Io.cs プロジェクト: f-spot/f-spot-xplat
        public static GLib.List ModulesLoadAllInDirectory(string dirname)
        {
            IntPtr native_dirname = GLib.Marshaller.StringToPtrGStrdup(dirname);
            var    raw_ret        = g_io_modules_load_all_in_directory(native_dirname);
            var    ret            = new GLib.List(raw_ret);

            GLib.Marshaller.Free(native_dirname);
            return(ret);
        }
		public void NativeCallback (IntPtr handle, Result result, IntPtr list, uint entries_read, IntPtr data)
		{
			GLib.List infos = new GLib.List (list, typeof (IntPtr));
			FileInfo[] entries = new FileInfo [infos.Count];
			int i = 0;
			foreach (IntPtr info in infos) 
				entries[i++] = new FileInfo (info);
			
			_managed (result, entries, entries_read);			
		}
コード例 #36
0
ファイル: Screen.cs プロジェクト: Gravecorp/gtk-sharp
 public Visual[] ListVisuals()
 {
     IntPtr raw_ret = gdk_screen_list_visuals (Handle);
     if (raw_ret == IntPtr.Zero)
         return new Visual [0];
     GLib.List list = new GLib.List(raw_ret);
     Visual[] result = new Visual [list.Count];
     for (int i = 0; i < list.Count; i++)
         result [i] = list [i] as Visual;
     return result;
 }
コード例 #37
0
ファイル: Display.cs プロジェクト: Gravecorp/gtk-sharp
 public Device[] ListDevices()
 {
     IntPtr raw_ret = gdk_display_list_devices (Handle);
     if (raw_ret == IntPtr.Zero)
         return new Device [0];
     GLib.List list = new GLib.List(raw_ret);
     Device[] result = new Device [list.Count];
     for (int i = 0; i < list.Count; i++)
         result [i] = list [i] as Device;
     return result;
 }
コード例 #38
0
ファイル: Global.cs プロジェクト: Gravecorp/gtk-sharp
 public static Device[] DevicesList()
 {
     IntPtr raw_ret = gdk_devices_list ();
     if (raw_ret == IntPtr.Zero)
         return new Device [0];
     GLib.List list = new GLib.List(raw_ret);
     Device[] result = new Device [list.Count];
     for (int i = 0; i < list.Count; i++)
         result [i] = list [i] as Device;
     return result;
 }
コード例 #39
0
        public static string[] List()
        {
            IntPtr list_ptr = gnome_font_family_list ();
            if (list_ptr == IntPtr.Zero)
                return new string [0];

            GLib.List list = new GLib.List (list_ptr, typeof (string));
            string[] result = new string [list.Count];
            int i = 0;
            foreach (string val in list)
                result [i++] = val;
            return result;
        }
コード例 #40
0
		public static FileInfo[] GetEntries (string text_uri, FileInfoOptions options)
		{
			IntPtr raw_ret;
			Result result = gnome_vfs_directory_list_load (out raw_ret, text_uri, options);
			Vfs.ThrowException (text_uri, result);
			
			GLib.List list = new GLib.List (raw_ret, typeof (IntPtr));
			list.Managed = true;
			FileInfo[] entries = new FileInfo [list.Count];
			int i = 0;
			foreach (IntPtr info in list)
				entries[i++] = new FileInfo (info);
			
			return entries;
		}
コード例 #41
0
ファイル: IconTheme.cs プロジェクト: liberostelios/gtk-sharp
		public string[] ListIcons (string context)
		{
			IntPtr native = GLib.Marshaller.StringToPtrGStrdup (context);
			IntPtr list_ptr = gtk_icon_theme_list_icons (Handle, native);
			GLib.Marshaller.Free (native);
			if (list_ptr == IntPtr.Zero)
				return new string [0];

			GLib.List list = new GLib.List (list_ptr, typeof (string), true, true);
			string[] result = new string [list.Count];
			int i = 0;
			foreach (string val in list)
				result [i++] = val;
			return result;
		}
コード例 #42
0
		public RadioToolButton (RadioToolButton[] group) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (RadioToolButton)) {
				CreateNativeObject (new string [0], new GLib.Value [0]);
				Group = group;
				return;
			}
			IntPtr native_group = IntPtr.Zero;
			if (group != null) {
				GLib.List list = new GLib.List(IntPtr.Zero);
				foreach (RadioToolButton item in group) {
					list.Append (item.Handle);
				}
				native_group = list.Handle;
			}
			Raw = gtk_radio_tool_button_new(native_group);
		}
コード例 #43
0
		public void RefreshRecentDocs ()
		{
			List<AbstractDockItem> items = new List<AbstractDockItem> ();
			
			GLib.List recent_items = new GLib.List (Gtk.RecentManager.Default.Items.Handle, typeof(Gtk.RecentInfo), false, false);
			IEnumerable<Gtk.RecentInfo> infos = recent_items.OfType<Gtk.RecentInfo> ();
			CanClear = recent_items.Count > 0;
			
			items.Add (emptyItem);
			items.AddRange (infos.Where (it => it.Exists ())
								 .OrderByDescending (f => f.Modified)
								 .Take (NumRecentDocs)
								 .Select (f => (AbstractDockItem)FileDockItem.NewFromUri (f.Uri)));
			
			foreach (Gtk.RecentInfo ri in infos)
				ri.Dispose ();
			recent_items.Dispose ();
			
			Items = items;
		}
コード例 #44
0
		public RadioToolButton (RadioToolButton[] group, string stock_id) : base (IntPtr.Zero)
		{
			if (GetType () != typeof (RadioToolButton)) {
				GLib.Value[] vals = new GLib.Value [1];
				string[] names = { "stock_id" };
				vals [0] = new GLib.Value (stock_id);
				CreateNativeObject (names, vals);
				Group = group;
				return;
			}
			IntPtr stock_id_as_native = GLib.Marshaller.StringToPtrGStrdup (stock_id);
			IntPtr native_group = IntPtr.Zero;
			if (group != null) {
				GLib.List list = new GLib.List(IntPtr.Zero);
				foreach (RadioToolButton item in group) {
					list.Append (item.Handle);
				}
				native_group = list.Handle;
			}
			Raw = gtk_radio_tool_button_new_from_stock(native_group, stock_id_as_native);
			GLib.Marshaller.Free (stock_id_as_native);
		}
コード例 #45
0
		public static Result XferUriList (Uri[] sources,
						  Uri[] targets,
						  XferOptions options,
						  XferErrorMode errorMode,
						  XferOverwriteMode overwriteMode,
						  XferProgressCallback callback)
		{
			XferProgressCallbackWrapper wrapper = new XferProgressCallbackWrapper (callback, null);
			GLib.List sourcesList = new GLib.List (typeof (Uri));
			foreach (Uri uri in sources)
				sourcesList.Append (uri.Handle);
				
			GLib.List targetsList = new GLib.List (typeof (Uri));
			foreach (Uri uri in targets)
				targetsList.Append (uri.Handle);
			
			return gnome_vfs_xfer_uri_list (sourcesList.Handle,
							targetsList.Handle,
							options, errorMode,
							overwriteMode,
							wrapper.NativeDelegate,
							IntPtr.Zero);
		}
コード例 #46
0
	public GLib.List BoxFrame()
	{
			
		IntPtr raw_ret = f_detect(Handle);
		GLib.List list = new GLib.List (raw_ret, typeof (Gdk.Rectangle), true, true);
		return list;
	}
コード例 #47
0
ファイル: Common.cs プロジェクト: GNOME/nemo
        public static void OnButtonPressEvent(Gdk.EventButton evnt, Item item)
        {
            if (evnt.Button == 1)
            {
                item.open();
            }
            else if (evnt.Button == 3)
            {
             	Menu popup_menu = new Menu();

                MenuItem open_item = new MenuItem(Mono.Unix.Catalog.GetString("Open"));
                open_item.Activated += delegate { item.open(); };
                popup_menu.Add(open_item);

                MenuItem open_with_item = new MenuItem(Mono.Unix.Catalog.GetString("Open with"));

                Gnome.Vfs.MimeApplication[] application_handlers = Gnome.Vfs.Mime.GetAllApplications(item.mime_type);

                if (application_handlers.Length > 0) {
                    Menu handlers_menu = new Menu();

                    foreach (Gnome.Vfs.MimeApplication m in application_handlers)
                    {
                        MenuItem handlers_menu_item = new MenuItem(m.Name);
                        GLib.List tmp = new GLib.List(typeof(System.String)); // fixme, use better name
                        tmp.Append(Gnome.Vfs.Uri.GetUriFromLocalPath(item.path));
                        Gnome.Vfs.MimeApplication tmp_m = m; // go lambda bug, go
                        handlers_menu_item.Activated += delegate { tmp_m.Launch(tmp); };
                        handlers_menu.Add(handlers_menu_item);
                    }

                    open_with_item.Submenu = handlers_menu;
                }

                popup_menu.Add(open_with_item);

                MenuItem open_folder = new MenuItem(Mono.Unix.Catalog.GetString("Open dir containing file"));
                open_folder.Activated += delegate {
                    string path = item.path;
                    int index = -1;
                    if ((index = path.LastIndexOf('/')) != -1) {
                        Gnome.Vfs.MimeApplication[] folder_handlers = Gnome.Vfs.Mime.GetAllApplications("inode/directory");
                        GLib.List tmp = new GLib.List(typeof(System.String)); // fixme, use better name
                        tmp.Append(Gnome.Vfs.Uri.GetUriFromLocalPath(path.Substring(0, index+1)));
                        folder_handlers[0].Launch(tmp);
                    }
                };
                popup_menu.Add(open_folder);

                MenuItem clipboard_item = new MenuItem(Mono.Unix.Catalog.GetString("Copy path to clipboard"));
                clipboard_item.Activated += delegate {
                    Gtk.Clipboard clipboard_x = Gtk.Clipboard.Get(Gdk.Atom.Intern("PRIMARY", true));
                    clipboard_x.Text = item.path;
                    Gtk.Clipboard clipboard = Gtk.Clipboard.Get(Gdk.Atom.Intern("CLIPBOARD", true));
                    clipboard.Text = item.path;
                };
                popup_menu.Add(clipboard_item);

                MenuItem labels_item = new MenuItem(Mono.Unix.Catalog.GetString("Labels"));
                Menu categories_menu = new Menu();

                bool first_category = true;

                foreach (Category cat in Singleton<Categories>.Instance.categories) {

                    if (cat.labels.Count > 0 || Singleton<Categories>.Instance.categories.Count == 1) {

                        if (first_category)
                            first_category = false;
                        else
                            categories_menu.Add(new Gtk.SeparatorMenuItem());

                        MenuItem cat_item = new MenuItem(cat.metalabel.label);
                        categories_menu.Add(cat_item);

                        foreach (UserLabel tmp_label in cat.labels) {
                            UserLabel label = tmp_label; // go lambda bug, go

                            if (!item.contains_label(label))
                            {
                                ImageMenuItem label_item = new ImageMenuItem();

                                Gtk.Label l = new Gtk.Label(label.metalabel.label);
                                l.SetAlignment(0f, 0.5f);
                                GtkCommon.set_foreground_color(l, new Gdk.Color(label.metalabel.color.r, label.metalabel.color.g, label.metalabel.color.b));
                                label_item.Add(l);

                                label_item.Image = CairoDrawing.create_dot_image(0, 0, 0, 0, 14, 14);

                                label_item.Activated += delegate { item.make_label(label); };
                                categories_menu.Add(label_item);
                            }
                            else
                            {
                                ImageMenuItem label_item = new ImageMenuItem();

                                Gtk.Label l = new Gtk.Label(label.metalabel.label);
                                l.SetAlignment(0f, 0.5f);
                                GtkCommon.set_foreground_color(l, new Gdk.Color(label.metalabel.color.r, label.metalabel.color.g, label.metalabel.color.b));
                                label_item.Add(l);

                                label_item.Image = label.dot();

                                label_item.Activated += delegate { item.remove_label(label); };
                                categories_menu.Add(label_item);
                            }
                        }
                    }
                }

                labels_item.Submenu = categories_menu;

                popup_menu.Add(labels_item);

                popup_menu.Add(new Gtk.SeparatorMenuItem());

                string starred_text = Mono.Unix.Catalog.GetString("Add star");
                if (item.file.starred)
                    starred_text = Mono.Unix.Catalog.GetString("Remove star");

                ImageMenuItem starred_item = new ImageMenuItem(starred_text);
                starred_item.Image = new Gtk.Image(new Gdk.Pixbuf(null, "stock_about.png"));
                starred_item.Activated += delegate { item.update_starred(); };

                popup_menu.Add(starred_item);

                popup_menu.ShowAll();
              			popup_menu.Popup(null, null, null, evnt.Button, evnt.Time);

            }
        }
コード例 #48
0
ファイル: Tile.cs プロジェクト: ArsenShnurkov/beagle-1
		private void OpenWith (Gnome.Vfs.MimeApplication mime_application)
		{
			GLib.List uri_list = new GLib.List (typeof (string));
			uri_list.Append (Hit.EscapedUri);
			mime_application.Launch (uri_list);
		}
コード例 #49
0
ファイル: Tile.cs プロジェクト: ArsenShnurkov/beagle-1
		protected void OpenFromMime (Hit hit)
		{
			string command = null;
			string uri = null, path = null;

			string mimetype = hit.MimeType;

			// FIXME: This is evil.  Nautilus should be handling
			// inode/directory, not just x-directory/normal
			if (mimetype == "inode/directory")
				mimetype = "x-directory/normal";

			// FIXME: I'm not sure that opening the parent
			// URI (if present) is the right thing to do in
			// all cases, but it does work for all our
			// current cases.
			if (hit.ParentUri != null)
				uri = hit.EscapedParentUri;
			else
				uri = hit.EscapedUri;

#if ENABLE_DESKTOP_LAUNCH
			RunDefaultHandler ("desktop-launch", uri);
#elif ENABLE_XDG_OPEN
			RunDefaultHandler ("xdg-open", uri);
#else
			MimeApplication app;
			app = Mime.GetDefaultApplication (mimetype);
			if (app == null) {
				Console.WriteLine ("Can't open MimeType '{0}'", mimetype);
				return;
			}
			
			bool expect_uris = app.SupportsUris ();
			path = hit.Path;

			GLib.List list = new GLib.List ((IntPtr) 0);
			list.Append (expect_uris ? uri : path);

			Gnome.Vfs.Result result = app.Launch (list);
			if (result != Gnome.Vfs.Result.Ok)
				Console.WriteLine ("Error in opening {0}: {1}", uri, result);
#endif
		}
コード例 #50
0
ファイル: MainWindow.cs プロジェクト: mono/f-spot
		public void HandleOpenWith (object sender, ApplicationActivatedEventArgs e)
		{
			GLib.AppInfo application = e.AppInfo;
			Photo[] selected = SelectedPhotos ();

			if (selected == null || selected.Length < 1)
				return;

			string header = Catalog.GetPluralString ("Create New Version?", "Create New Versions?", selected.Length);
			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, application.Name);

			// FIXME add cancel button? add help button?
			HigMessageDialog hmd = new HigMessageDialog (GetToplevel (sender), DialogFlags.DestroyWithParent,
				                       MessageType.Question, Gtk.ButtonsType.None,
				                       header, msg);

			hmd.AddButton (Gtk.Stock.No, Gtk.ResponseType.No, false);
			//hmd.AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
			hmd.AddButton (Gtk.Stock.Yes, Gtk.ResponseType.Yes, true);

			bool support_xcf = false;
			;
			if (application.Id == "gimp.desktop")
				foreach (PixbufFormat format in Gdk.Pixbuf.Formats.Where(format => format.Name == "xcf"))
					support_xcf = true;

			//This allows creating a version with a .xcf extension.
			//There's no need to convert the file to xcf file format, gimp will take care of this
			if (support_xcf) {
				CheckButton cb = new CheckButton (Catalog.GetString ("XCF version"));
				cb.Active = Preferences.Get<bool> (Preferences.EDIT_CREATE_XCF_VERSION);
				hmd.VBox.Add (cb);
				cb.Toggled += (s, ea) => Preferences.Set (Preferences.EDIT_CREATE_XCF_VERSION, (s as CheckButton).Active);
				cb.Show ();
			}

			Gtk.ResponseType response = Gtk.ResponseType.Cancel;

			try {
				response = (Gtk.ResponseType)hmd.Run ();
			} finally {
				hmd.Destroy ();
			}

			bool create_xcf = false;
			if (support_xcf)
				create_xcf = Preferences.Get<bool> (Preferences.EDIT_CREATE_XCF_VERSION);

			Log.DebugFormat ("XCF ? {0}", create_xcf);

			if (response == Gtk.ResponseType.Cancel)
				return;

			bool create_new_versions = (response == Gtk.ResponseType.Yes);

			List<EditException> errors = new List<EditException> ();
			GLib.List uri_list = new GLib.List (typeof(string));
			foreach (Photo photo in selected) {
				try {
					if (create_new_versions) {
						uint version = photo.CreateNamedVersion (application.Name, create_xcf ? ".xcf" : null, photo.DefaultVersionId, true);
						photo.DefaultVersionId = version;
					}
				} catch (Exception ex) {
					errors.Add (new EditException (photo, ex));
				}

				uri_list.Append (photo.DefaultVersion.Uri.ToString ());
			}

			// FIXME need to clean up the error dialog here.
			if (errors.Count > 0) {
				Dialog md = new EditExceptionDialog (GetToplevel (sender), errors.ToArray ());
				md.Run ();
				md.Destroy ();
			}

			if (create_new_versions)
				Database.Photos.Commit (selected);

			try {
				application.LaunchUris (uri_list, null);
			} catch (Exception) {
				Log.ErrorFormat ("Failed to lauch {0}", application.Name);
			}
		}
コード例 #51
0
ファイル: SrvTarget.cs プロジェクト: Yetangitu/f-spot
		public static GLib.List ListSort(GLib.List targets) {
			IntPtr raw_ret = g_srv_target_list_sort(targets == null ? IntPtr.Zero : targets.Handle);
			GLib.List ret = new GLib.List(raw_ret);
			return ret;
		}
コード例 #52
0
ファイル: Marshaller.cs プロジェクト: ystk/debian-gtk-sharp2
		public static Array ListPtrToArray (IntPtr list_ptr, Type list_type, bool owned, bool elements_owned, Type elem_type)
		{
			ListBase list;
			if (list_type == typeof(GLib.List))
				list = new GLib.List (list_ptr, elem_type, owned, elements_owned);
			else
				list = new GLib.SList (list_ptr, elem_type, owned, elements_owned);

			using (list)
				return ListToArray (list, elem_type);
		}
コード例 #53
0
		private void OnObjectsRemoved (object o, Evolution.ObjectsRemovedArgs args)
		{
			// FIXME: evolution-sharp doesn't know about
			// CalComponentId itself, so we have to workaround
			// this by re-creating the GLib.List with the right
			// type.
			GLib.List id_list = new GLib.List (args.Uids.Handle,
							   typeof (CalComponentId));

			foreach (CalComponentId id in id_list)
				RemoveCalComponent (id.Uid);
		}
コード例 #54
0
ファイル: Marshaller.cs プロジェクト: nuxleus/gtk-sharp
        public static Array ListPtrToArray(IntPtr list_ptr, Type list_type, bool owned, bool elements_owned, Type elem_type)
        {
            Type array_type = elem_type == typeof (ListBase.FilenameString) ? typeof (string) : elem_type;
            ListBase list;
            if (list_type == typeof(GLib.List))
                list = new GLib.List (list_ptr, elem_type, owned, elements_owned);
            else
                list = new GLib.SList (list_ptr, elem_type, owned, elements_owned);

            using (list)
                return ListToArray (list, array_type);
        }
コード例 #55
0
		public Gtk.Action[] ListActions() {
			IntPtr raw_ret = gtk_action_group_list_actions (Handle);
			GLib.List list = new GLib.List (raw_ret);
 			Gtk.Action[] result = new Gtk.Action [list.Count];
			for (int i = 0; i < list.Count; i++)
				result [i] = list [i] as Gtk.Action;
			return result;
		}
コード例 #56
0
		private void OnContactsRemoved (object o, Evolution.ContactsRemovedArgs args)
		{
			if (ignore_first_batch)
				return;

			// FIXME: This is a temporary workaround for the
			// fact that the evolution bindings return a
			// GLib.List with an object type, but there are
			// really strings in there.

			GLib.List id_list = new GLib.List (args.Ids.Handle,
							   typeof (string));

			foreach (string id in id_list)
				RemoveContact (id);
		}
コード例 #57
0
        static IntPtr GetProperties_cb(IntPtr inst)
        {
            try {
                PropertyProbeImplementor __obj = GLib.Object.GetObject (inst, false) as PropertyProbeImplementor;

                string[] properties = __obj.Properties;
                GLib.List properties_list = new GLib.List (typeof (IntPtr));
                IntPtr gclass = Marshal.ReadIntPtr (inst);
                foreach (string prop in properties) {
                    IntPtr name = GLib.Marshaller.StringToPtrGStrdup (prop);
                    IntPtr pspec = g_object_class_find_property (gclass, name);
                    GLib.Marshaller.Free (name);
                    if (pspec != IntPtr.Zero)
                        properties_list.Prepend (pspec);
                }

                /* FIXME: We leak the list! */
                return properties_list.Handle;
            } catch (Exception e) {
                GLib.ExceptionManager.RaiseUnhandledException (e, true);
                // NOTREACHED: above call does not return.
                throw e;
            }
        }
コード例 #58
0
ファイル: Content.cs プロジェクト: Yetangitu/f-spot
		public static GLib.List TypesGetRegistered() {
			IntPtr raw_ret = g_content_types_get_registered();
			GLib.List ret = new GLib.List(raw_ret);
			return ret;
		}
コード例 #59
0
 IEnumerable<IFileItem> GetRecentFiles()
 {
     GLib.List recent_items = new GLib.List (Gtk.RecentManager.Default.Items.Handle, typeof(Gtk.RecentInfo));
     foreach (Gtk.RecentInfo info in recent_items.Cast<Gtk.RecentInfo> ().Where (it => it.Exists ())) {
         yield return Services.UniverseFactory.NewFileItem (info.Uri);
         info.Dispose ();
     }
     recent_items.Dispose ();
     yield break;
 }
コード例 #60
0
ファイル: Widget.cs プロジェクト: liberostelios/gtk-sharp
		public Widget[] ListMnemonicLabels ()
		{
			IntPtr raw_ret = gtk_widget_list_mnemonic_labels (Handle);
			if (raw_ret == IntPtr.Zero)
				return new Widget [0];
			GLib.List list = new GLib.List(raw_ret);
			Widget[] result = new Widget [list.Count];
			for (int i = 0; i < list.Count; i++)
				result [i] = list [i] as Widget;
			return result;
		}