예제 #1
0
파일: Applet.cs 프로젝트: mtanski/drapes
        public static void Run(ref string[] args)
        {
            Gnome.Program p = new Gnome.Program("drapes",
                CompileOptions.Version, Gnome.Modules.UI, args);

            Gnome.PanelAppletFactory.Register(typeof(DrapesApplet));
        }
예제 #2
0
파일: Preferences.cs 프로젝트: MrJoe/lat
        public PreferencesDialog(Gnome.Program program)
        {
            ui = new Glade.XML(null, "lat.glade", "preferencesDialog", null);
            ui.Autoconnect(this);

            this.program = program;

            profileStore           = new ListStore(typeof(string));
            profilesTreeView.Model = profileStore;
            profileStore.SetSortColumnId(0, SortType.Ascending);

            TreeViewColumn col;

            col = profilesTreeView.AppendColumn("Name", new CellRendererText(), "text", 0);
            col.SortColumnId = 0;

            UpdateProfileList();

            LoadPreference(Preferences.BROWSER_SELECTION);

            preferencesDialog.Icon = Global.latIcon;
            preferencesDialog.Resize(300, 400);
            preferencesDialog.Run();

            if (gettingHelp)
            {
                preferencesDialog.Run();
                gettingHelp = false;
            }

            preferencesDialog.Destroy();
        }
예제 #3
0
 public static void Main(string[] args)
 {
     Gnome.Program program = new Gnome.Program("FastOpen", "1.0", Gnome.Modules.UI, args);
     FastOpenWindow fs = new FastOpenWindow ();
     fs.ShowAll ();
     program.Run ();
 }
예제 #4
0
        public static void Main(string[] args)
        {
            Gnome.Program  program = new Gnome.Program("FastOpen", "1.0", Gnome.Modules.UI, args);
            FastOpenWindow fs      = new FastOpenWindow();

            program.Run();
        }
예제 #5
0
        public static Gnome.Program Get()
        {
            IntPtr raw_ret = gnome_program_get();

            Gnome.Program ret = GLib.Object.GetObject(raw_ret) as Gnome.Program;
            return(ret);
        }
예제 #6
0
        public static string GetAppSettingsRelative(Gnome.Program program, string subkey)
        {
            IntPtr native_subkey = GLib.Marshaller.StringToPtrGStrdup(subkey);
            IntPtr raw_ret       = gnome_gconf_get_app_settings_relative(program == null ? IntPtr.Zero : program.Handle, native_subkey);
            string ret           = GLib.Marshaller.PtrToStringGFree(raw_ret);

            GLib.Marshaller.Free(native_subkey);
            return(ret);
        }
예제 #7
0
        public static Gnome.Program Initv(GLib.GType type, string app_id, string app_version, Gnome.ModuleInfo module_info, int argc, string argv, string first_property_name, IntPtr args)
        {
            IntPtr native_app_id              = GLib.Marshaller.StringToPtrGStrdup(app_id);
            IntPtr native_app_version         = GLib.Marshaller.StringToPtrGStrdup(app_version);
            IntPtr native_first_property_name = GLib.Marshaller.StringToPtrGStrdup(first_property_name);
            IntPtr raw_ret = gnome_program_initv(type.Val, native_app_id, native_app_version, module_info == null ? IntPtr.Zero : module_info.Handle, argc, GLib.Marshaller.StringToPtrGStrdup(argv), native_first_property_name, args);

            Gnome.Program ret = GLib.Object.GetObject(raw_ret) as Gnome.Program;
            GLib.Marshaller.Free(native_app_id);
            GLib.Marshaller.Free(native_app_version);
            GLib.Marshaller.Free(native_first_property_name);
            return(ret);
        }
예제 #8
0
        public void Initialize(string locale_dir,
		                        string display_name,
		                        string process_name,
		                        string [] args)
        {
            Mono.Unix.Catalog.Init ("tasque", Defines.LocaleDir);
            try {
                SetProcessName (process_name);
            } catch {} // Ignore exception if fail (not needed to run)

            Gtk.Application.Init ();
            program = new Gnome.Program (display_name,
                                         Defines.Version,
                                         Gnome.Modules.UI,
                                         args);
        }
예제 #9
0
        public void Initialize(string locale_dir,
                               string display_name,
                               string process_name,
                               string [] args)
        {
            Mono.Unix.Catalog.Init("tasque", Defines.LocaleDir);
            try {
                SetProcessName(process_name);
            } catch {}             // Ignore exception if fail (not needed to run)

            Gtk.Application.Init();
            program = new Gnome.Program(display_name,
                                        Defines.Version,
                                        Gnome.Modules.UI,
                                        args);
        }
예제 #10
0
        public static unsafe bool DisplayWithDocIdOnScreen(Gnome.Program program, string doc_id, string file_name, string link_id, Gdk.Screen screen)
        {
            IntPtr native_doc_id    = GLib.Marshaller.StringToPtrGStrdup(doc_id);
            IntPtr native_file_name = GLib.Marshaller.StringToPtrGStrdup(file_name);
            IntPtr native_link_id   = GLib.Marshaller.StringToPtrGStrdup(link_id);
            IntPtr error            = IntPtr.Zero;
            bool   raw_ret          = gnome_help_display_with_doc_id_on_screen(program == null ? IntPtr.Zero : program.Handle, native_doc_id, native_file_name, native_link_id, screen == null ? IntPtr.Zero : screen.Handle, out error);
            bool   ret = raw_ret;

            GLib.Marshaller.Free(native_doc_id);
            GLib.Marshaller.Free(native_file_name);
            GLib.Marshaller.Free(native_link_id);
            if (error != IntPtr.Zero)
            {
                throw new GLib.GException(error);
            }
            return(ret);
        }
예제 #11
0
        public void Initialize(string locale_dir,
                               string display_name,
                               string process_name,
                               string [] args)
        {
            try {
                SetProcessName(process_name);
            } catch {}             // Ignore exception if fail (not needed to run)

            // Register handler for saving session when logging out of Gnome
            BusG.Init();
            string startup_id = Environment.GetEnvironmentVariable("DESKTOP_AUTOSTART_ID");

            if (String.IsNullOrEmpty(startup_id))
            {
                startup_id = display_name;
            }

            try {
                SessionManager session = Bus.Session.GetObject <SessionManager> (Constants.SessionManagerInterfaceName,
                                                                                 new ObjectPath(Constants.SessionManagerPath));
                session_client_id = session.RegisterClient(display_name, startup_id);

                ClientPrivate client = Bus.Session.GetObject <ClientPrivate> (Constants.SessionManagerInterfaceName,
                                                                              session_client_id);
                client.QueryEndSession += OnQueryEndSession;
                client.EndSession      += OnEndSession;
                client.Stop            += OnStop;
            } catch (Exception e) {
                Logger.Debug("Failed to register with session manager: {0}", e.Message);
            }

            Gtk.Application.Init();
#if PANEL_APPLET
            program = new Gnome.Program(display_name,
                                        Defines.VERSION,
                                        Gnome.Modules.UI,
                                        args);
#endif
        }
예제 #12
0
		public void Initialize (string locale_dir,
		                        string display_name,
		                        string process_name,
		                        string [] args)
		{
			try {
				SetProcessName (process_name);
			} catch {} // Ignore exception if fail (not needed to run)

			// Register handler for saving session when logging out of Gnome
			BusG.Init ();
			string startup_id = Environment.GetEnvironmentVariable ("DESKTOP_AUTOSTART_ID");
			if (String.IsNullOrEmpty (startup_id))
				startup_id = display_name;

			try {
				SessionManager session = Bus.Session.GetObject<SessionManager> (Constants.SessionManagerInterfaceName,
				                                                                new ObjectPath (Constants.SessionManagerPath));
				session_client_id = session.RegisterClient (display_name, startup_id);
				
				ClientPrivate client = Bus.Session.GetObject<ClientPrivate> (Constants.SessionManagerInterfaceName,
				                                                             session_client_id);
				client.QueryEndSession += OnQueryEndSession;
				client.EndSession += OnEndSession;
				client.Stop += OnStop;
			} catch (Exception e) {
				Logger.Debug ("Failed to register with session manager: {0}", e.Message);
			}

			Gtk.Application.Init ();
#if PANEL_APPLET
			program = new Gnome.Program (display_name,
			                             Defines.VERSION,
			                             Gnome.Modules.UI,
			                             args);
#endif
		}
예제 #13
0
 static void Main(string[] argv)
 {
     Gnome.Program p = new Gnome.Program ("CSharpTestApplet", "0.1", Gnome.Modules.UI, argv);
     AppletFactory.Register (typeof (PanelAppletClass));
 }
예제 #14
0
파일: Preferences.cs 프로젝트: MrJoe/lat
        public PreferencesDialog(Gnome.Program program)
        {
            ui = new Glade.XML (null, "lat.glade", "preferencesDialog", null);
            ui.Autoconnect (this);

            this.program = program;

            profileStore = new ListStore (typeof (string));
            profilesTreeView.Model = profileStore;
            profileStore.SetSortColumnId (0, SortType.Ascending);

            TreeViewColumn col;
            col = profilesTreeView.AppendColumn ("Name", new CellRendererText (), "text", 0);
            col.SortColumnId = 0;

            UpdateProfileList ();

            LoadPreference (Preferences.BROWSER_SELECTION);

            preferencesDialog.Icon = Global.latIcon;
            preferencesDialog.Resize (300, 400);
            preferencesDialog.Run ();

            if (gettingHelp) {
                preferencesDialog.Run ();
                gettingHelp = false;
            }

            preferencesDialog.Destroy ();
        }
예제 #15
0
파일: Stetic.cs 프로젝트: mono/stetic
        public static int Main(string[] args)
        {
            int n = 0;
            IsolationMode mode = IsolationMode.None;
            bool usePartial = false;
            bool useGettext = false;
            bool genEmpty = false;
            bool useMultifile = false;

            while (n < args.Length) {
                string arg = args[n];
                if (arg.StartsWith ("--language:"))
                    language = arg.Substring (11);
                else if (arg.StartsWith ("-l:"))
                    language = arg.Substring (3);
                else if (arg.StartsWith ("-lib:"))
                    libraries.Add (arg.Substring (5));
                else if (arg.StartsWith ("--library:"))
                    libraries.Add (arg.Substring (10));
                else if (arg == "--generate" || arg == "-g")
                    break;
                else if (arg == "--noisolation")
                    mode = IsolationMode.None;
                else if (arg == "--gen-partial")
                    usePartial = true;
                else if (arg == "--gen-gettext")
                    useGettext = true;
                else if (arg == "--gen-multifile")
                    useMultifile = true;
                else if (arg == "--gen-empty")
                    genEmpty = true;
                else
                    break;
                n++;
            }

            if (args.Length == 1 && args [0] == "--help") {
                Console.WriteLine (Catalog.GetString ("Stetic - A GTK User Interface Builder"));
                Console.WriteLine (Catalog.GetString ("Usage:"));
                Console.WriteLine ("\tstetic [<file>]");
                Console.WriteLine ("\tstetic [--language:<language>] [-lib:<library>...] --generate <sourceFile> <projectFile> ...");
                return 0;
            }

            Program = new Gnome.Program ("Stetic", "0.0", Gnome.Modules.UI, args);

            int ret;

            if (args.Length - n > 2 && ((args [n] == "--generate" || args [n] == "-g"))) {
                SteticApp = Stetic.ApplicationFactory.CreateApplication (IsolationMode.None);
                GenerationOptions ops = new GenerationOptions ();
                ops.UsePartialClasses = usePartial;
                ops.GenerateEmptyBuildMethod = genEmpty;
                ops.UseGettext = useGettext;
                ops.GenerateSingleFile = !useMultifile;
                ret = GenerateCode (args [n+1], args, n+2, ops);
            }
            else {
                SteticApp = Stetic.ApplicationFactory.CreateApplication (mode);
                SteticApp.AllowInProcLibraries = false;
                ret = RunApp (args, n);
            }

            SteticApp.Dispose ();
            return ret;
        }
예제 #16
0
    public GladeApp(string[] args)
    {
        program = new Gnome.Program ("mCatalog", "1.0", Gnome.Modules.UI, args);
        Mono.Posix.Catalog.Init ("mcatalog", Defines.GNOME_LOCALE_DIR);

        // Proxy Setup
        bool use_proxy = Conf.Get ("/system/http_proxy/use_http_proxy", false);

        if (use_proxy) {
            string proxy_host = Conf.Get ("/system/http_proxy/host", "");
            int proxy_port = Conf.Get ("/system/http_proxy/port", 8080);
            string proxy = string.Format("http://{0}:{1}/", proxy_host, proxy_port);
            WebProxy proxyObject = new WebProxy(proxy, true);
            System.Net.GlobalProxySelection.Select = proxyObject;
        }

        database = new Database (Conf.HomeDir+"/db.db");
        database.Debug = true;

        Glade.XML gxml = new Glade.XML (null, "mainwindow.glade", "app1", "mcatalog");
        gxml.Autoconnect (this);
        app1.DeleteEvent += OnWindowDeleteEvent;

        presentation = new Presentation ();
        itemShelf = new ItemShelf (presentation);
        swPresentation.AddWithViewport (presentation);
        presentation.Init ();

        searchEntry.Activated += OnSearchEntryActivated;

        itemListPaned.SizeRequested += OnItemListPanedResized;

        // Fill the list hbox
        HBox hBoxList = (HBox)gxml["hBoxList"];
        buttonList = new ToggleButton ();
        buttonList.Clicked += OnButtonListClicked;
        Gtk.Image image1 = new Gtk.Image (new Gdk.Pixbuf (null, "list.png"));
        image1.Visible = true;
        buttonList.Add (image1);
        buttonList.Relief = ReliefStyle.Half;
        hBoxList.PackStart (buttonList, false, true, 0);
        buttonShelf = new ToggleButton ();
        buttonShelf.Clicked += OnButtonShelfClicked;
        Gtk.Image image2 = new Gtk.Image (new Gdk.Pixbuf (null, "shelf.png"));
        image2.Visible = true;
        buttonShelf.Add (image2);
        buttonShelf.Relief = ReliefStyle.Half;
        hBoxList.PackStart (buttonShelf, false, true, 0);
        titleWidget = new TitleWidget ();
        titleWidget.OnOrderChanged += OnOrderChanged;
        hBoxList.PackStart (titleWidget, true, true, 4);
        hBoxList.ShowAll();

        // Get the menu items we need to handle
        menuItemAddItem.Sensitive = false;
        menuItemRemoveItem.Sensitive = false;
        menuItemShelfView.Data["view"] = View.Shelf;
        menuItemListView.Data["view"] = View.List;

        menuItemShelfView.Toggled += OnViewToggled;

        // Buttons
        addItemButton.Sensitive = false;
        removeItemButton.Sensitive = false;
        lendItemButton.Sensitive = false;
        editItemButton.Sensitive = false;

        lendItemButton.Clicked += LendOrReturnItem;
        editItemButton.Clicked += EditItem;

        // Populate the catalog tree
        PopulateCatalogs ();
        PopulateBorrowers ();

        app1.ShowAll();
        RestoreWindowState ();
        program.Run();
    }
예제 #17
0
 static void Main(string[] argv)
 {
     Gnome.Program p = new Gnome.Program("CSharpTestApplet", "0.1", Gnome.Modules.UI, argv);
     AppletFactory.Register(typeof(PanelAppletClass));
 }
예제 #18
0
        public static int Main(string[] args)
        {
            int           n            = 0;
            IsolationMode mode         = IsolationMode.None;
            bool          usePartial   = false;
            bool          useGettext   = false;
            bool          genEmpty     = false;
            bool          useMultifile = false;

            while (n < args.Length)
            {
                string arg = args[n];
                if (arg.StartsWith("--language:"))
                {
                    language = arg.Substring(11);
                }
                else if (arg.StartsWith("-l:"))
                {
                    language = arg.Substring(3);
                }
                else if (arg.StartsWith("-lib:"))
                {
                    libraries.Add(arg.Substring(5));
                }
                else if (arg.StartsWith("--library:"))
                {
                    libraries.Add(arg.Substring(10));
                }
                else if (arg == "--generate" || arg == "-g")
                {
                    break;
                }
                else if (arg == "--noisolation")
                {
                    mode = IsolationMode.None;
                }
                else if (arg == "--gen-partial")
                {
                    usePartial = true;
                }
                else if (arg == "--gen-gettext")
                {
                    useGettext = true;
                }
                else if (arg == "--gen-multifile")
                {
                    useMultifile = true;
                }
                else if (arg == "--gen-empty")
                {
                    genEmpty = true;
                }
                else
                {
                    break;
                }
                n++;
            }

            if (args.Length == 1 && args [0] == "--help")
            {
                Console.WriteLine(Catalog.GetString("Stetic - A GTK User Interface Builder"));
                Console.WriteLine(Catalog.GetString("Usage:"));
                Console.WriteLine("\tstetic [<file>]");
                Console.WriteLine("\tstetic [--language:<language>] [-lib:<library>...] --generate <sourceFile> <projectFile> ...");
                return(0);
            }

            Program = new Gnome.Program("Stetic", "0.0", Gnome.Modules.UI, args);

            int ret;

            if (args.Length - n > 2 && ((args [n] == "--generate" || args [n] == "-g")))
            {
                SteticApp = Stetic.ApplicationFactory.CreateApplication(IsolationMode.None);
                GenerationOptions ops = new GenerationOptions();
                ops.UsePartialClasses        = usePartial;
                ops.GenerateEmptyBuildMethod = genEmpty;
                ops.UseGettext         = useGettext;
                ops.GenerateSingleFile = !useMultifile;
                ret = GenerateCode(args [n + 1], args, n + 2, ops);
            }
            else
            {
                SteticApp = Stetic.ApplicationFactory.CreateApplication(mode);
                SteticApp.AllowInProcLibraries = false;
                ret = RunApp(args, n);
            }

            SteticApp.Dispose();
            return(ret);
        }
예제 #19
0
        public static void Main(string[] args)
        {
            bool dbus_enabled = true;

            try {
                // Init DBus
                BusG.Init();
            } catch (Exception e) {
                // Lack of specific exception
                Log.Error(e, "Failed to access dbus session bus. Make sure dbus session bus is running and the environment variable DBUS_SESSION_BUS_ADDRESS is set.");
                dbus_enabled = false;
            }

            string query = ParseArgs(args);

            // If there is already an instance of beagle-search running
            // request our search proxy object and open up a query in
            // that instance.

            if (dbus_enabled && Bus.Session.RequestName(BUS_NAME) != RequestNameReply.PrimaryOwner)
            {
                if (icon_enabled)
                {
                    Console.WriteLine("There is already an instance of beagle-search running.");
                    Console.WriteLine("Cannot run in --icon mode! Exiting...");
                    Environment.Exit(1);
                }

                ISearch s = Bus.Session.GetObject <ISearch> (BUS_NAME, new ObjectPath(PATH_NAME));
                s.Query(query);

                return;
            }

            SystemInformation.SetProcessName("beagle-search");
            Catalog.Init("beagle", ExternalStringsHack.LocaleDir);

            Gnome.Program program = new Gnome.Program("search", "0.0", Gnome.Modules.UI, args);
            Gtk.IconTheme.Default.AppendSearchPath(System.IO.Path.Combine(ExternalStringsHack.PkgDataDir, "icons"));

            if (icon_enabled && !dbus_enabled)
            {
                HigMessageDialog.RunHigMessageDialog(null,
                                                     Gtk.DialogFlags.Modal,
                                                     Gtk.MessageType.Error,
                                                     Gtk.ButtonsType.Close,
                                                     Catalog.GetString("Session D-Bus not accessible"),
                                                     Catalog.GetString("Cannot run with parameter '--icon' when session D-Bus is not accessible."));
                Environment.Exit(1);
            }

            Gnome.Vfs.Vfs.Initialize();

            // FIXME: Passing these icon and docs enabled properties
            // sucks. We really need to do something about them.
            Search search = new Search(icon_enabled, docs_enabled);

            if (!String.IsNullOrEmpty(query) || !icon_enabled)
            {
                search.Query(query);
            }

            if (dbus_enabled)
            {
                Bus.Session.Register(BUS_NAME, new ObjectPath(PATH_NAME), search);
            }

            program.Run();
        }
예제 #20
0
		public static void Main (string[] args)
		{
			bool dbus_enabled = true;

			try {
				// Init DBus
				BusG.Init ();
			} catch (Exception e) {
				// Lack of specific exception
				Log.Error (e, "Failed to access dbus session bus. Make sure dbus session bus is running and the environment variable DBUS_SESSION_BUS_ADDRESS is set.");
				dbus_enabled = false;
			}

			string query = ParseArgs (args);

			// If there is already an instance of beagle-search running
			// request our search proxy object and open up a query in
			// that instance.

			if (dbus_enabled && Bus.Session.RequestName (BUS_NAME) != RequestNameReply.PrimaryOwner) {
				if (icon_enabled) {
					Console.WriteLine ("There is already an instance of beagle-search running.");
					Console.WriteLine ("Cannot run in --icon mode! Exiting...");
					Environment.Exit (1);
				}

				ISearch s = Bus.Session.GetObject<ISearch> (BUS_NAME, new ObjectPath (PATH_NAME));
				s.Query (query);

				return;
			}

			SystemInformation.SetProcessName ("beagle-search");
			Catalog.Init ("beagle", ExternalStringsHack.LocaleDir);

			Gnome.Program program = new Gnome.Program ("search", "0.0", Gnome.Modules.UI, args);
			Gtk.IconTheme.Default.AppendSearchPath (System.IO.Path.Combine (ExternalStringsHack.PkgDataDir, "icons"));

			if (icon_enabled && ! dbus_enabled) {
				HigMessageDialog.RunHigMessageDialog (null,
								      Gtk.DialogFlags.Modal,
								      Gtk.MessageType.Error, 
								      Gtk.ButtonsType.Close, 
								      Catalog.GetString ("Session D-Bus not accessible"), 
								      Catalog.GetString ("Cannot run with parameter '--icon' when session D-Bus is not accessible."));
				Environment.Exit (1);
			}

			Gnome.Vfs.Vfs.Initialize ();

			// FIXME: Passing these icon and docs enabled properties
			// sucks. We really need to do something about them.
			Search search = new Search (icon_enabled, docs_enabled);

			if (!String.IsNullOrEmpty (query) || !icon_enabled)
				search.Query (query);

			if (dbus_enabled)
				Bus.Session.Register (BUS_NAME, new ObjectPath (PATH_NAME), search);

			program.Run ();
		}