Esempio n. 1
0
        public static Gnome.Client MasterClient()
        {
            IntPtr raw_ret = gnome_master_client();

            Gnome.Client ret = GLib.Object.GetObject(raw_ret) as Gnome.Client;
            return(ret);
        }
Esempio n. 2
0
    public static void Main(string[] args)
    {
        Catalog.Init ("monopod", Defines.GNOME_LOCALE_DIR);

        new Gnome.Program ("monopod", Defines.VERSION, Gnome.Modules.UI, args);
        // Application.Init ();
        session_client = Gnome.Global.MasterClient ();
        session_client.Die += new EventHandler (OnDieEvent);
        session_client.SaveYourself += new Gnome.SaveYourselfHandler (OnSaveYourselfEvent);

        // LogFunc logFunc = new LogFunc (Log.PrintTraceLogFunction);
        // Log.SetLogHandler ("GLib-GObject", LogLevelFlags.Critical, logFunc);

        program_pixbuf = new Gdk.Pixbuf (null, "podcast.png");
        program_pixbuf16 = program_pixbuf.ScaleSimple (16, 16, Gdk.InterpType.Hyper);
        program_pixbuf48 = program_pixbuf.ScaleSimple (48, 48, Gdk.InterpType.Hyper);
        new MainClass ();
        Application.Run ();
    }
Esempio n. 3
0
        // Main
        /// <summary>
        ///	The main method.
        /// </summary>
        /// <param name="args">
        ///	An array of <see cref="String">strings</see>,
        ///	representing command-line arguments.
        /// </param>
        public static void Main(string [] args)
        {
            try {
                NDesk.DBus.BusG.Init();
            } catch {}

            try {
                Global.SetProcessName("muine");
            } catch {}

            Application.Init();
            Gnome.Vfs.Vfs.Initialize();

            // Try to find a running Muine
            try {
                dbus_object = DBusLib.Player.FindInstance();
            } catch {
            }

            // Check if an instance of Muine is already running
            if (dbus_object != null)
            {
                // Handle command line args and exit.
                if (args.Length > 0)
                {
                    ProcessCommandLine(args);
                }
                else
                {
                    dbus_object.SetWindowVisible(true, 0);
                }

                Gdk.Global.NotifyStartupComplete();
                return;
            }

            Catalog.Init("muine", Defines.GNOME_LOCALE_DIR);

            new Gnome.Program
                ("muine", Defines.VERSION, Gnome.Modules.UI, args);

            // Initialize D-Bus
            //   We initialize here but don't connect to it until later.
            try {
                dbus_object = new DBusLib.Player();

                DBusService.Instance.RegisterObject(dbus_object,
                                                    "/org/gnome/Muine/Player");
            } catch (Exception e) {
                Console.WriteLine(string_dbus_failed, e.Message);
            }

            // Init GConf
            Config.Init();

            // Init files
            try {
                FileUtils.Init();
            } catch (Exception e) {
                Error(e.Message);
            }

            // Register stock icons
            StockIcons.Initialize();

            // Set default window icon
            SetDefaultWindowIcon();

            // Open cover database
            try {
                cover_db = new CoverDatabase(3);
            } catch (Exception e) {
                Error(String.Format(string_coverdb_failed, e.Message));
            }

            cover_db.DoneLoading += OnCoversDoneLoading;

            // Load song database
            try {
                db = new SongDatabase(6);
            } catch (Exception e) {
                Error(String.Format(string_songdb_failed, e.Message));
            }

            db.Load();

            // Setup Actions
            actions = new Actions();

            // Create playlist window
            try {
                playlist = new PlaylistWindow();
            } catch (PlayerException e) {
                Error(e.Message);
            }

            // D-Bus
            //  Hook up D-Bus object before loading any songs into the
            //	playlist, to make sure that the song change gets emitted
            //	to the bus
            Muine.DBusLib.Player exported_dbus_object = dbus_object as Muine.DBusLib.Player;
            if (exported_dbus_object != null)
            {
                exported_dbus_object.HookUp(playlist);
            }

            // PluginManager
            //	Initialize plug-ins (also before loading any songs, to make
            //	sure that the song change gets through to all the plug-ins)
            new PluginManager(playlist);

            // Hook up multimedia keys
            if (!GnomeMMKeys.Initialize())
            {
                new MmKeys(playlist);
            }

            // Process command line options
            bool opened_file = ProcessCommandLine(args);

            // Load playlist
            if (!opened_file)
            {
                playlist.RestorePlaylist();
            }

            // Show UI
            playlist.Run();

            while (MainContext.Pending())
            {
                Gtk.Main.Iteration();
            }

            // Load Covers
            cover_db.Load();

            // Hook up to the session manager
            session_client               = Gnome.Global.MasterClient();
            session_client.Die          += OnDieEvent;
            session_client.SaveYourself += OnSaveYourselfEvent;

            // Run!
            Application.Run();
        }
Esempio n. 4
0
 void InvokeNative(Gnome.Client client, int key, Gnome.DialogType dialog_type)
 {
     native_cb(client == null ? IntPtr.Zero : client.Handle, key, (int)dialog_type, __data);
 }