2
* Copyright © 2013 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
6
* published 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 along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
21
#include "app-list-dummy.h"
23
typedef struct _AppListDummyPrivate AppListDummyPrivate;
25
struct _AppListDummyPrivate {
26
HudSource * focused_source;
29
#define APP_LIST_DUMMY_GET_PRIVATE(o) \
30
(G_TYPE_INSTANCE_GET_PRIVATE ((o), APP_LIST_DUMMY_TYPE, AppListDummyPrivate))
32
static void app_list_dummy_class_init (AppListDummyClass *klass);
33
static void app_list_dummy_init (AppListDummy *self);
34
static void app_list_dummy_dispose (GObject *object);
35
static void app_list_dummy_finalize (GObject *object);
36
static HudSource * get_focused_app (HudApplicationList * list);
37
static void matching_setup (HudApplicationList * list);
39
G_DEFINE_TYPE (AppListDummy, app_list_dummy, HUD_TYPE_APPLICATION_LIST);
42
app_list_dummy_class_init (AppListDummyClass *klass)
44
GObjectClass *object_class = G_OBJECT_CLASS (klass);
46
g_type_class_add_private (klass, sizeof (AppListDummyPrivate));
48
object_class->dispose = app_list_dummy_dispose;
49
object_class->finalize = app_list_dummy_finalize;
51
HudApplicationListClass * appclass = HUD_APPLICATION_LIST_CLASS(klass);
52
appclass->get_focused_app = get_focused_app;
54
appclass->matching_setup = matching_setup;
60
app_list_dummy_init (AppListDummy *self)
66
app_list_dummy_dispose (GObject *object)
68
AppListDummyPrivate * priv = APP_LIST_DUMMY_GET_PRIVATE(object);
70
g_clear_object(&priv->focused_source);
72
G_OBJECT_CLASS (app_list_dummy_parent_class)->dispose (object);
77
app_list_dummy_finalize (GObject *object)
80
G_OBJECT_CLASS (app_list_dummy_parent_class)->finalize (object);
85
app_list_dummy_new (HudSource * focused_source)
87
g_return_val_if_fail(HUD_IS_SOURCE(focused_source), NULL);
89
AppListDummy * dummy = g_object_new(APP_LIST_DUMMY_TYPE, NULL);
90
AppListDummyPrivate * priv = APP_LIST_DUMMY_GET_PRIVATE(dummy);
92
priv->focused_source = g_object_ref(focused_source);
97
get_focused_app (HudApplicationList * list)
99
g_return_val_if_fail(IS_APP_LIST_DUMMY(list), NULL);
101
AppListDummyPrivate * priv = APP_LIST_DUMMY_GET_PRIVATE(list);
103
return priv->focused_source;
107
matching_setup (HudApplicationList * list)
109
/* Wow, this is super-performant! */
110
g_debug("Setting up matching");
115
app_list_dummy_set_focus (AppListDummy * dummy, HudSource * focused_source)
117
g_return_if_fail(IS_APP_LIST_DUMMY(dummy));
119
AppListDummyPrivate * priv = APP_LIST_DUMMY_GET_PRIVATE(dummy);
120
g_clear_object(&priv->focused_source);
121
priv->focused_source = g_object_ref(focused_source);
123
hud_source_changed(HUD_SOURCE(dummy));