public MainWindow(bool reindex, bool hidden) : base("") { try { OSSpecific.SetProcessName ("nemo"); } catch (Exception e) { Console.Error.WriteLine ("Failed to set process name: {0}", e.Message); } // gettext Mono.Unix.Catalog.Init("nemo", "/usr/share/locale"); if (Environment.GetEnvironmentVariable("MONO_MANAGED_WATCHER") == "1") { System.Console.WriteLine(Mono.Unix.Catalog.GetString("MONO_MANAGED_WATCHER is buggy, please don't use that.")); throw new Exception("die"); } Build(); if (hidden) hide(); // restore the position on screen Move(Singleton<Configuration>.Instance.data.main_window_x, Singleton<Configuration>.Instance.data.main_window_y); this.SetSizeRequest(640, 480); // min size this.Resize(Singleton<Configuration>.Instance.data.main_window_width, Singleton<Configuration>.Instance.data.main_window_height); this.AddMnemonic('s', this.search_input); // hide while moving this.FocusOutEvent += delegate(object sender, Gtk.FocusOutEventArgs args) { Nemo.Singleton<Nemo.OverlayTracker>.Instance.hide_all(); }; this.FocusInEvent += delegate(object sender, Gtk.FocusInEventArgs args) { Nemo.Singleton<Nemo.OverlayTracker>.Instance.show_all(); }; this.DeleteEvent += on_close; GtkCommon.tooltip = new Gtk.Tooltips(); if (Singleton<Configuration>.Instance.data.search_tool == "tracker") broker = new Tracker(reindex); else if (Singleton<Configuration>.Instance.data.search_tool == "xesam") broker = new Xesam(reindex); else { System.Console.WriteLine("Unknown search tool token found in configuration: {0}, falling back to tracker", Singleton<Configuration>.Instance.data.search_tool); broker = new Tracker(reindex); } Singleton<SingletonWrapper<Broker>>.Instance.wrapped = broker; System.Console.WriteLine("search tool is: {0}", Singleton<Configuration>.Instance.data.search_tool); // tray tray = new Tray(this); tray.main_quit = delegate { broker.stop(); }; // helpers starred_button_active = false; Singleton<Categories>.Instance.set_drawer(new CategoriesDrawer(categories_event_box)); calendar_driver = new CalendarDriver(new CalendarDrawer(calendar_event_box, day_button, week_button, month_button, year_button, today_button, current_date)); // gnome vfs Gnome.Vfs.Vfs.Initialize(); search_input.AddEvents((int)Gdk.EventMask.KeyReleaseMask); // update callbacks Singleton<Categories>.Instance.set_search_func(do_search); Singleton<TypeLabels>.Instance.update_func = update_type_labels; Singleton<TypeLabels>.Instance.search_func = do_search; calendar_driver.search_func = do_search; calendar_driver.set_active_view = set_active_view; System.Console.WriteLine("doing initial search"); // register result types DocumentItem.set_fields_index(broker.RegisterItemTypes(DocumentItem.ItemTypes())); PictureItem.set_fields_index(broker.RegisterItemTypes(PictureItem.ItemTypes())); }
protected void set_active_view(CalendarDriver.View view) { if (view == CalendarDriver.View.Month) month_button.Active = true; else if (view == CalendarDriver.View.Week) week_button.Active = true; else if (view == CalendarDriver.View.Day) day_button.Active = true; }
private void add_link(string text, CalendarDriver.View view, System.DateTime item_modified_date, Gtk.HBox links) { Gtk.EventBox link_wrapper = new Gtk.EventBox(); Gtk.Label link = new Gtk.Label(); link.Markup = "<u><small>" + text + "</small></u>"; GtkCommon.show_hand_and_tooltip(link_wrapper, text); link_wrapper.Add(link); link_wrapper.ButtonPressEvent += delegate(object sender, Gtk.ButtonPressEventArgs args) { set_view_callback(view, item_modified_date); }; GtkCommon.set_background_color(link_wrapper, "white"); links.PackStart(link_wrapper, false, false, 5); }