summaryrefslogtreecommitdiff
path: root/engines/balou/engine.c
blob: 6a18a2782b2843fff05a71354e1ac8d8a56734dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/* $Id$ */
/*-
 * Copyright (c) 2003-2004 Benedikt Meurer <benny@xfce.org>
 * All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 * MA 02110-1301 USA.
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <gmodule.h>

#include <libxfsm/xfsm-splash-engine.h>

#include <engines/balou/balou.h>


#define DEFAULT_THEME   "Default"


G_MODULE_EXPORT void engine_init (XfsmSplashEngine *engine);


static void
engine_setup (XfsmSplashEngine *engine,
              XfsmSplashRc     *rc)
{
  gchar      *theme_name;
  BalouTheme *theme;

  theme_name = xfsm_splash_rc_read_entry (rc, "Theme", DEFAULT_THEME);
  theme = balou_theme_load (theme_name);
  g_free (theme_name);

  balou_init (BALOU (engine->user_data),
              engine->display,
              engine->primary_screen,
              engine->primary_monitor,
              theme);
}


static void
engine_next (XfsmSplashEngine *engine,
             const gchar      *text)
{
  Balou *balou = BALOU (engine->user_data);

  balou_fadeout (balou);
  balou_fadein (balou, text);
}


static int
engine_run (XfsmSplashEngine *engine,
            GtkWidget        *dialog)
{
  return balou_run (BALOU (engine->user_data), dialog);
}


static void
engine_destroy (XfsmSplashEngine *engine)
{
  Balou *balou = BALOU (engine->user_data);

  if (G_LIKELY (balou != NULL))
    {
      balou_destroy (balou);
      g_free (balou);
    }
}


G_MODULE_EXPORT void
engine_init (XfsmSplashEngine *engine)
{
  engine->user_data   = g_new0 (Balou, 1);
  engine->setup       = engine_setup;
  engine->next        = engine_next;
  engine->run         = engine_run;
  engine->destroy     = engine_destroy;
}