2
* Copyright 2010 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as published
6
* by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* version 3 along with this program. If not, see
15
* <http://www.gnu.org/licenses/>
17
* Authored by: Gordon Allott <gord.allott@canonical.com>
18
* Neil Jagdish Patel <neil.patel@canonical.com>
24
#include "Nux/VLayout.h"
25
#include "Nux/WindowThread.h"
26
#include "NuxGraphics/GraphicsEngine.h"
27
#include <NuxCore/Logger.h>
29
#include "unity-shared/BGHash.h"
30
#include "unity-shared/FontSettings.h"
31
#include "dash/DashView.h"
32
#include "dash/DashController.h"
33
#include "panel/PanelView.h"
34
#include "panel/PanelController.h"
35
#include "unity-shared/BackgroundEffectHelper.h"
36
#include "launcher/FavoriteStoreGSettings.h"
37
#include "launcher/LauncherController.h"
38
#include "launcher/Launcher.h"
39
#include "unity-shared/DashSettings.h"
40
#include "unity-shared/DashStyle.h"
41
#include "unity-shared/PanelStyle.h"
42
#include "unity-shared/UBusWrapper.h"
43
#include "unity-shared/UBusMessages.h"
47
static int display_width = 1280;
48
static int display_height = 720;
49
static gboolean no_window_decorations = FALSE;
51
static GOptionEntry entries[] =
53
{"width", 'w', 0, G_OPTION_ARG_INT, &display_width, "Display width", NULL},
54
{"height", 'h', 0, G_OPTION_ARG_INT, &display_height, "Display height", NULL},
55
{"no-window-decorations", 'd', 0, G_OPTION_ARG_NONE, &no_window_decorations, "Disables the window decorations", NULL},
60
using namespace unity;
68
static void InitWindowThread (nux::NThread* thread, void* InitData);
71
launcher::Controller::Ptr launcher_controller;
72
dash::Controller::Ptr dash_controller;
73
panel::Controller::Ptr panel_controller;
76
UnityStandalone::UnityStandalone ()
80
UnityStandalone::~UnityStandalone ()
84
void UnityStandalone::Init ()
86
launcher_controller.reset(new launcher::Controller(0));
87
dash_controller.reset(new dash::Controller());
88
panel_controller.reset(new panel::Controller());
90
dash_controller->launcher_width = launcher_controller->launcher().GetAbsoluteWidth() - 1;
92
UBusManager().SendMessage(UBUS_DASH_EXTERNAL_ACTIVATION, nullptr);
95
void UnityStandalone::InitWindowThread(nux::NThread* thread, void* InitData)
97
UnityStandalone *self = static_cast<UnityStandalone*>(InitData);
101
int main(int argc, char **argv)
103
nux::WindowThread* wt = NULL;
104
GError *error = NULL;
105
GOptionContext *context;
107
nux::NuxInitialize(0);
108
nux::logging::configure_logging(::getenv("UNITY_LOG_SEVERITY"));
110
context = g_option_context_new("- Unity standalone");
111
g_option_context_add_main_entries(context, entries, GETTEXT_PACKAGE);
112
g_option_context_add_group(context, gtk_get_option_group(TRUE));
113
g_option_context_parse(context, &argc, &argv, &error);
116
g_print("Option parsiong failed: %s\n", error->message);
121
gtk_init(&argc, &argv);
124
FontSettings font_settings;
126
// The instances for the pseudo-singletons.
127
dash::Style dash_style;
128
dash::Settings dash_settings;
129
dash_settings.SetFormFactor(dash::FormFactor::NETBOOK);
130
panel::Style panel_style;
132
GeisAdapter geis_adapter;
133
internal::FavoriteStoreGSettings favorite_store;
134
BackgroundEffectHelper::blur_type = BLUR_NONE;
136
UnityStandalone *standalone_runner = new UnityStandalone();
137
wt = nux::CreateNuxWindow("standalone-unity",
138
display_width, display_height,
139
(no_window_decorations) ? nux::WINDOWSTYLE_NOBORDER : nux::WINDOWSTYLE_NORMAL,
142
&UnityStandalone::InitWindowThread,