private void RunBanshee() { try { Gtk.Application.Init(); ThreadAssist.InitializeMainThread(); ThreadAssist.ProxyToMainHandler = Banshee.ServiceStack.Application.Invoke; Application.PushClient(client); Application.Run(); music_library = ServiceManager.SourceManager.MusicLibrary; var provider = DatabaseTrackInfo.Provider; select_single_command = String.Format( "SELECT {0} FROM {1} WHERE {2}{3}{4} = ?", provider.Select, provider.From, provider.Where, (String.IsNullOrEmpty(provider.Where) ? String.Empty : " AND "), provider.PrimaryKey ); client.Start(); } catch (Exception e) { Console.WriteLine(e); throw; } }
protected void Initialize(bool registerCommonServices) { // Set the process name so system process listings and commands are pretty ApplicationContext.TrySetProcessName(Application.InternalName); PreInitializeGtk(); InitializeGtk(); Application.Initialize(); PostInitializeGtk(); Gtk.Window.DefaultIconName = default_icon_name; ThreadAssist.InitializeMainThread(); ThreadAssist.ProxyToMainHandler = Banshee.ServiceStack.Application.Invoke; Gdk.Global.ProgramClass = Application.InternalName; GLib.Global.ApplicationName = "Banshee"; // TODO: Set this to "video" when we're playing a video. PulseAudio doesn't treat it differently // than "music" for now, but it would be more correct. Environment.SetEnvironmentVariable("PULSE_PROP_media.role", "music"); if (ApplicationContext.Debugging) { GLib.Log.SetLogHandler("Gtk", GLib.LogLevelFlags.Critical, GLib.Log.PrintTraceLogFunction); Gdk.Window.DebugUpdates = !String.IsNullOrEmpty(Environment.GetEnvironmentVariable("GDK_DEBUG_UPDATES")); } ServiceManager.ServiceStarted += OnServiceStarted; // Register specific services this client will care about if (registerCommonServices) { Banshee.Gui.CommonServices.Register(); } OnRegisterServices(); Application.ShutdownPromptHandler = OnShutdownPrompt; Application.TimeoutHandler = RunTimeout; Application.IdleHandler = RunIdle; Application.IdleTimeoutRemoveHandler = IdleTimeoutRemove; BansheeMetrics.Started += OnMetricsStarted; // Start the core boot process Application.PushClient(this); Application.Run(); if (!Banshee.Configuration.DefaultApplicationHelper.NeverAsk && Banshee.Configuration.DefaultApplicationHelper.HaveHelper) { Application.ClientStarted += delegate { Banshee.Gui.Dialogs.DefaultApplicationHelperDialog.RunIfAppropriate(); }; } Log.Notify += OnLogNotify; }
protected void Initialize(bool registerCommonServices) { // Set the process name so system process listings and commands are pretty PlatformHacks.TrySetProcessName(Application.InternalName); Application.Initialize(); InitializeGtk(); Gtk.Window.DefaultIconName = default_icon_name; ThreadAssist.InitializeMainThread(); Gdk.Global.ProgramClass = Application.InternalName; GLib.Global.ApplicationName = "Banshee"; if (ApplicationContext.Debugging) { GLib.Log.SetLogHandler("Gtk", GLib.LogLevelFlags.Critical, GLib.Log.PrintTraceLogFunction); } ServiceManager.ServiceStarted += OnServiceStarted; // Register specific services this client will care about if (registerCommonServices) { Banshee.Gui.CommonServices.Register(); } OnRegisterServices(); Application.ShutdownPromptHandler = OnShutdownPrompt; Application.TimeoutHandler = RunTimeout; Application.IdleHandler = RunIdle; Application.IdleTimeoutRemoveHandler = IdleTimeoutRemove; // Start the core boot process Application.PushClient(this); Application.Run(); if (!Banshee.Configuration.DefaultApplicationHelper.NeverAsk && Banshee.Configuration.DefaultApplicationHelper.HaveHelper) { Application.ClientStarted += delegate { Banshee.Gui.Dialogs.DefaultApplicationHelperDialog.RunIfAppropriate(); }; } Log.Notify += OnLogNotify; }
private static void Startup() { ThreadAssist.InitializeMainThread(); ServiceManager.Initialize(); ServiceManager.RegisterService <DBusServiceManager> (); ServiceManager.RegisterService <BansheeDbConnection> (); ServiceManager.RegisterService <SourceManager> (); ServiceManager.RegisterService <PreferenceService> (); ServiceManager.RegisterService <CollectionIndexerService> (); ServiceManager.RegisterService <IndexerClient> (); ServiceManager.Run(); ServiceManager.Get <IndexerClient> ().Run(); }
static Client() { Gtk.Application.Init(); ThreadAssist.InitializeMainThread(); ThreadAssist.ProxyToMainHandler = RunIdle; Hyena.Log.Notify += OnLogNotify; Gtk.Window.DefaultIconName = "pdfmod"; try { if (System.IO.File.Exists(accel_map_file)) { Gtk.AccelMap.Load(accel_map_file); Hyena.Log.DebugFormat("Loaded custom AccelMap from {0}", accel_map_file); } } catch (Exception e) { Hyena.Log.Exception("Failed to load custom AccelMap", e); } }
private void RunMainLoop() { ThreadAssist.InitializeMainThread(); ThreadAssist.ProxyToMainHandler = Banshee.ServiceStack.Application.Invoke; service = new PlayerEngineService(); service.PlayWhenIdleRequest += delegate { play_when_idles++; }; service.TrackIntercept += delegate { track_intercepts++; return(false); }; // TODO call each test w/ permutations of Gapless enabled/disabled, RG enabled/disabled try { ServiceManager.RegisterService(service); } catch {} ((IInitializeService)service).Initialize(); ((IDelayedInitializeService)service).DelayedInitialize(); main_loop = new GLib.MainLoop(); started = true; main_loop.Run(); }
static int Main(string [] args) { args = FixArgs(args); ApplicationContext.ApplicationName = "F-Spot"; ApplicationContext.TrySetProcessName(Defines.PACKAGE); Paths.ApplicationName = "f-spot"; SynchronizationContext.SetSynchronizationContext(new GtkSynchronizationContext()); ThreadAssist.InitializeMainThread(); ThreadAssist.ProxyToMainHandler = RunIdle; // Options and Option parsing bool shutdown = false; bool view = false; bool slideshow = false; bool import = false; GLib.GType.Init(); Catalog.Init("f-spot", Defines.LOCALE_DIR); Global.PhotoUri = new SafeUri(Preferences.Get <string> (Preferences.STORAGE_PATH)); ApplicationContext.CommandLine = new CommandLineParser(args, 0); if (ApplicationContext.CommandLine.ContainsStart("help")) { ShowHelp(); return(0); } if (ApplicationContext.CommandLine.Contains("version")) { ShowVersion(); return(0); } if (ApplicationContext.CommandLine.Contains("versions")) { ShowAssemblyVersions(); return(0); } if (ApplicationContext.CommandLine.Contains("shutdown")) { Log.Information("Shutting down existing F-Spot server..."); shutdown = true; } if (ApplicationContext.CommandLine.Contains("slideshow")) { Log.Information("Running F-Spot in slideshow mode."); slideshow = true; } if (ApplicationContext.CommandLine.Contains("basedir")) { string dir = ApplicationContext.CommandLine ["basedir"]; if (!string.IsNullOrEmpty(dir)) { Global.BaseDirectory = dir; Log.InformationFormat("BaseDirectory is now {0}", dir); } else { Log.Error("f-spot: -basedir option takes one argument"); return(1); } } if (ApplicationContext.CommandLine.Contains("photodir")) { string dir = ApplicationContext.CommandLine ["photodir"]; if (!string.IsNullOrEmpty(dir)) { Global.PhotoUri = new SafeUri(dir); Log.InformationFormat("PhotoDirectory is now {0}", dir); } else { Log.Error("f-spot: -photodir option takes one argument"); return(1); } } if (ApplicationContext.CommandLine.Contains("import")) { import = true; } if (ApplicationContext.CommandLine.Contains("view")) { view = true; } if (ApplicationContext.CommandLine.Contains("debug")) { Log.Debugging = true; // Debug GdkPixbuf critical warnings var logFunc = new GLib.LogFunc(GLib.Log.PrintTraceLogFunction); GLib.Log.SetLogHandler("GdkPixbuf", GLib.LogLevelFlags.Critical, logFunc); // Debug Gtk critical warnings GLib.Log.SetLogHandler("Gtk", GLib.LogLevelFlags.Critical, logFunc); // Debug GLib critical warnings GLib.Log.SetLogHandler("GLib", GLib.LogLevelFlags.Critical, logFunc); //Debug GLib-GObject critical warnings GLib.Log.SetLogHandler("GLib-GObject", GLib.LogLevelFlags.Critical, logFunc); GLib.Log.SetLogHandler("GLib-GIO", GLib.LogLevelFlags.Critical, logFunc); } // Validate command line options if ((import && (view || shutdown || slideshow)) || (view && (shutdown || slideshow)) || (shutdown && slideshow)) { Log.Error("Can't mix -import, -view, -shutdown or -slideshow"); return(1); } InitializeAddins(); // Gtk initialization Gtk.Application.Init(Defines.PACKAGE, ref args); // Maybe we'll add this at a future date //Xwt.Application.InitializeAsGuest (Xwt.ToolkitType.Gtk); // init web proxy globally Platform.WebProxy.Init(); if (File.Exists(Preferences.Get <string> (Preferences.GTK_RC))) { if (File.Exists(Path.Combine(Global.BaseDirectory, "gtkrc"))) { Gtk.Rc.AddDefaultFile(Path.Combine(Global.BaseDirectory, "gtkrc")); } Global.DefaultRcFiles = Gtk.Rc.DefaultFiles; Gtk.Rc.AddDefaultFile(Preferences.Get <string> (Preferences.GTK_RC)); Gtk.Rc.ReparseAllForSettings(Gtk.Settings.Default, true); } try { Gtk.Window.DefaultIconList = new Gdk.Pixbuf [] { GtkUtil.TryLoadIcon(Global.IconTheme, "f-spot", 16, 0), GtkUtil.TryLoadIcon(Global.IconTheme, "f-spot", 22, 0), GtkUtil.TryLoadIcon(Global.IconTheme, "f-spot", 32, 0), GtkUtil.TryLoadIcon(Global.IconTheme, "f-spot", 48, 0) }; } catch (Exception ex) { Log.Exception("Loading default f-spot icons", ex); } GLib.ExceptionManager.UnhandledException += exceptionArgs => { Console.WriteLine("Unhandeled exception handler:"); var exception = exceptionArgs.ExceptionObject as Exception; if (exception != null) { Console.WriteLine("Message: " + exception.Message); Console.WriteLine("Stack trace: " + exception.StackTrace); } else { Console.WriteLine("Unknown exception type: " + exceptionArgs.ExceptionObject.GetType().ToString()); } }; CleanRoomStartup.Startup(Startup); // Running threads are preventing the application from quitting // we force it for now until this is fixed Environment.Exit(0); return(0); }
public void Setup() { ThreadAssist.InitializeMainThread(); }
static int Main(string [] args) { args = FixArgs(args); ApplicationContext.ApplicationName = "F-Spot"; ApplicationContext.TrySetProcessName(Defines.PACKAGE); Paths.ApplicationName = "f-spot"; ThreadAssist.InitializeMainThread(); ThreadAssist.ProxyToMainHandler = RunIdle; XdgThumbnailSpec.DefaultLoader = (uri) => { using (var file = ImageFile.Create(uri)) return(file.Load()); }; // Options and Option parsing bool shutdown = false; bool view = false; bool slideshow = false; bool import = false; GLib.GType.Init(); Catalog.Init("f-spot", Defines.LOCALE_DIR); FSpot.Core.Global.PhotoUri = new SafeUri(Preferences.Get <string> (Preferences.STORAGE_PATH)); ApplicationContext.CommandLine = new CommandLineParser(args, 0); if (ApplicationContext.CommandLine.ContainsStart("help")) { ShowHelp(); return(0); } if (ApplicationContext.CommandLine.Contains("version")) { ShowVersion(); return(0); } if (ApplicationContext.CommandLine.Contains("versions")) { ShowAssemblyVersions(); return(0); } if (ApplicationContext.CommandLine.Contains("shutdown")) { Log.Information("Shutting down existing F-Spot server..."); shutdown = true; } if (ApplicationContext.CommandLine.Contains("slideshow")) { Log.Information("Running F-Spot in slideshow mode."); slideshow = true; } if (ApplicationContext.CommandLine.Contains("basedir")) { string dir = ApplicationContext.CommandLine ["basedir"]; if (!string.IsNullOrEmpty(dir)) { FSpot.Core.Global.BaseDirectory = dir; Log.InformationFormat("BaseDirectory is now {0}", dir); } else { Log.Error("f-spot: -basedir option takes one argument"); return(1); } } if (ApplicationContext.CommandLine.Contains("photodir")) { string dir = ApplicationContext.CommandLine ["photodir"]; if (!string.IsNullOrEmpty(dir)) { FSpot.Core.Global.PhotoUri = new SafeUri(dir); Log.InformationFormat("PhotoDirectory is now {0}", dir); } else { Log.Error("f-spot: -photodir option takes one argument"); return(1); } } if (ApplicationContext.CommandLine.Contains("import")) { import = true; } if (ApplicationContext.CommandLine.Contains("view")) { view = true; } if (ApplicationContext.CommandLine.Contains("debug")) { Log.Debugging = true; // Debug GdkPixbuf critical warnings GLib.LogFunc logFunc = new GLib.LogFunc(GLib.Log.PrintTraceLogFunction); GLib.Log.SetLogHandler("GdkPixbuf", GLib.LogLevelFlags.Critical, logFunc); // Debug Gtk critical warnings GLib.Log.SetLogHandler("Gtk", GLib.LogLevelFlags.Critical, logFunc); // Debug GLib critical warnings GLib.Log.SetLogHandler("GLib", GLib.LogLevelFlags.Critical, logFunc); //Debug GLib-GObject critical warnings GLib.Log.SetLogHandler("GLib-GObject", GLib.LogLevelFlags.Critical, logFunc); GLib.Log.SetLogHandler("GLib-GIO", GLib.LogLevelFlags.Critical, logFunc); } // Validate command line options if ((import && (view || shutdown || slideshow)) || (view && (shutdown || slideshow)) || (shutdown && slideshow)) { Log.Error("Can't mix -import, -view, -shutdown or -slideshow"); return(1); } InitializeAddins(); // Gtk initialization Gtk.Application.Init(Defines.PACKAGE, ref args); // init web proxy globally Platform.WebProxy.Init(); if (File.Exists(Preferences.Get <string> (Preferences.GTK_RC))) { if (File.Exists(Path.Combine(FSpot.Core.Global.BaseDirectory, "gtkrc"))) { Gtk.Rc.AddDefaultFile(Path.Combine(FSpot.Core.Global.BaseDirectory, "gtkrc")); } FSpot.Core.Global.DefaultRcFiles = Gtk.Rc.DefaultFiles; Gtk.Rc.AddDefaultFile(Preferences.Get <string> (Preferences.GTK_RC)); Gtk.Rc.ReparseAllForSettings(Gtk.Settings.Default, true); } try { Gtk.Window.DefaultIconList = new Gdk.Pixbuf [] { GtkUtil.TryLoadIcon(FSpot.Core.Global.IconTheme, "f-spot", 16, (Gtk.IconLookupFlags) 0), GtkUtil.TryLoadIcon(FSpot.Core.Global.IconTheme, "f-spot", 22, (Gtk.IconLookupFlags) 0), GtkUtil.TryLoadIcon(FSpot.Core.Global.IconTheme, "f-spot", 32, (Gtk.IconLookupFlags) 0), GtkUtil.TryLoadIcon(FSpot.Core.Global.IconTheme, "f-spot", 48, (Gtk.IconLookupFlags) 0) }; } catch {} CleanRoomStartup.Startup(Startup); return(0); }