3 // Bleeding Edge Search Tool: Beagle search GUI
5 // Nat Friedman <nat@novell.com>
7 // Copyright (C) 2004 Novell, Inc.
25 static public string DefaultWindowTitle
= "Beagle Search (beta)";
27 static void PrintUsageAndExit ()
30 "best: GUI interface to the Beagle search system.\n" +
31 "Web page: http://www.gnome.org/projects/beagle\n" +
32 "Copyright (C) 2004-2005 Novell, Inc.\n\n";
35 "Usage: best [OPTIONS] [<query string>]\n\n" +
37 " --no-tray\t\t\tDo not create a notification area applet.\n" +
38 " --show-window\t\t\tDisplay a search window.\n" +
39 " --help\t\t\tPrint this usage message.\n";
41 Console
.WriteLine (usage
);
43 System
.Environment
.Exit (0);
46 static string query
= "";
47 static bool doTray
= true;
48 static bool showWindow
= false;
49 static bool autostarted
= false;
51 static void ParseArgs (String
[] args
)
54 while (i
< args
.Length
) {
69 // Ignore session management
70 case "--sm-config-prefix":
71 case "--sm-client-id":
73 // These all take an argument, so
79 if (! Conf
.Searching
.Autostart
){
80 Console
.WriteLine ("Autostarting is disabled, not starting");
87 if (args
[i
].Length
< 2 || args
[i
].Substring (0, 2) != "--") {
88 if (query
.Length
!= 0)
99 static void NoTrayWindowDeleteEvent (object o
, Gtk
.DeleteEventArgs args
)
101 BestWindow win
= (BestWindow
) o
;
102 win
.StoreSettingsInConf (false);
106 static void Main (String
[] args
)
110 Program best
= new Program ("best", "0.0", Modules
.UI
, args
);
114 } catch (DllNotFoundException
) {
115 // We might get this exception if there are
116 // missing symbols from the Mozilla runtime if
117 // the user did a Firefox 1.0 -> 1.5 upgrade.
118 // There's nothing we can do about this, it's
119 // an ABI change, so tell the user this is
120 // probably what's wrong.
121 Console
.WriteLine (Catalog
.GetString ("Best cannot initialize Mozilla's Gecko runtime environment.\n" +
122 "Have you upgraded Mozilla or Firefox recently? If so, you\n" +
123 "probably need to rebuild beagle against this new version.\n" +
124 "See http://bugzilla.gnome.org/show_bug.cgi?id=326503 for\n" +
125 "more information."));
126 Environment
.Exit (1);
129 GeckoUtils
.SetSystemFonts ();
132 Catalog
.Init ("beagle", ExternalStringsHack
.LocaleDir
);
134 // Create the window.
137 win
= new BestWindow (query
);
140 win
= new BestWindow ();
145 // Create the tray icon.
148 icon
= new BestTray (win
, autostarted
);
150 Console
.WriteLine (Catalog
.GetString ("If you're wondering whether Best is working check " +
151 "your notification area (system tray)"));
156 win
.DeleteEvent
+= new Gtk
.DeleteEventHandler (NoTrayWindowDeleteEvent
);