public PreferencesDialog(ItemShelf itemShelf)
        : base()
    {
        this.itemShelf = itemShelf;

        this.Title = Mono.Posix.Catalog.GetString ("Preferences");
        this.HasSeparator = false;
        this.SetDefaultSize (300, 200);

        Notebook notebook = new Notebook ();

        Glade.XML gxml = new Glade.XML (null, "themeselection.glade", "hbox1", null);
        HBox hBox = (HBox)gxml["hbox1"];
        ScrolledWindow scrolledwindow = (ScrolledWindow)gxml["scrolledwindow1"];
        TreeView themeTreeview = CreateThemeTreeView ();
        themeTreeview.Selection.Changed += OnThemeTreeViewSelectionChanged;

        scrolledwindow.Add (themeTreeview);

        notebook.AppendPage (hBox, new Label (Mono.Posix.Catalog.GetString ("Theme")));

        this.VBox.Add (notebook);

        Button closeButton = (Button)this.AddButton (Gtk.Stock.Close, 1);
        closeButton.Clicked += OnCloseButtonClicked;

        this.ShowAll();
    }
Exemple #2
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();
    }