Removed stupid WindowManager singleton

This commit is contained in:
Joel Holdsworth 2009-01-31 19:30:58 +00:00
parent 852377c1f1
commit 9e585ab591
5 changed files with 29 additions and 21 deletions

View file

@ -66,14 +66,18 @@ GtkLumiera::main(int argc, char *argv[])
Project project;
Controller controller(project);
WindowManager *manager = WindowManager::instance();
REQUIRE(manager);
manager->set_theme("lumiera_ui.rc");
manager->new_window(project, controller);
windowManager.init();
windowManager.set_theme("lumiera_ui.rc");
windowManager.new_window(project, controller);
kit.run();
}
WindowManager&
GtkLumiera::get_window_manager()
{
return windowManager;
}
Glib::ustring
GtkLumiera::get_home_data_path()

View file

@ -39,6 +39,8 @@
#include <boost/enable_shared_from_this.hpp>
#include "lib/util.hpp"
#include "window-manager.hpp"
extern "C" {
#include <gavl/gavltime.h>
}
@ -72,6 +74,8 @@ class GtkLumiera : private boost::noncopyable
public:
void main(int argc, char *argv[]);
WindowManager& get_window_manager();
static Glib::ustring get_home_data_path();
/**
@ -98,6 +102,12 @@ public:
* Returns tn alphabetical list of the application's authors
**/
static const std::vector<Glib::ustring> get_app_authors();
protected:
/**
* The application window manager object
**/
WindowManager windowManager;
};
/**

View file

@ -22,6 +22,7 @@
#include "window-manager.hpp"
#include "include/logging.h"
#include "workspace/workspace-window.hpp"
using namespace Gtk;
using namespace Glib;
@ -34,7 +35,8 @@ namespace gui {
IconSize WindowManager::GiantIconSize = ICON_SIZE_INVALID;
IconSize WindowManager::MenuIconSize = ICON_SIZE_INVALID;
WindowManager::WindowManager()
void
WindowManager::init()
{
register_app_icon_sizes();
register_stock_items();
@ -73,14 +75,6 @@ WindowManager::set_theme(Glib::ustring path)
return true;
}
WindowManager*
WindowManager::instance()
{
// Initialized during first access
static WindowManager manager;
return &manager;
}
bool
WindowManager::on_window_closed(GdkEventAny* event)
{

View file

@ -26,7 +26,7 @@
*/
#include "gtk-lumiera.hpp"
#include "workspace/workspace-window.hpp"
//#include "workspace/workspace-window.hpp"
#ifndef WINDOW_MANAGER_HPP
#define WINDOW_MANAGER_HPP
@ -41,6 +41,10 @@ namespace controller {
class Controller;
} // model
namespace workspace {
class WorkspaceWindow;
}
/**
* The centralised manager of all lumiera-gui's windows.
**/
@ -48,9 +52,9 @@ class WindowManager : private boost::noncopyable
{
public:
/**
* Default constructor
* Initializes the window manager object
**/
WindowManager();
void init();
/**
* Creates a new window connected to a specified project and
@ -68,10 +72,6 @@ public:
**/
bool set_theme(Glib::ustring path);
public:
static WindowManager* instance();
/**
* A utility function which reads a colour style from the GTK Style.
* @param widget The widget to load the style out of.

View file

@ -190,7 +190,7 @@ Actions::on_menu_view_viewer()
void
Actions::on_menu_view_new_window()
{
WindowManager::instance()->new_window(workspaceWindow.project,
application().get_window_manager().new_window(workspaceWindow.project,
workspaceWindow.controller);
}