cosmetic changes: nothing important
[simple-launcher] / applet-wrapper.cc
1 // This file is a part of Simple Launcher
2 //
3 // Copyright (C) 2006, 2007, Mikhail Sobolev
4 //
5 // Simple Launcher is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License version 2 as published by
7 // the Free Software Foundation.
8 //
9 // This program is distributed in the hope that it will be useful, but WITHOUT
10 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12 // more details.
13 //
14 // You should have received a copy of the GNU General Public License along with
15 // this program; if not, write to the Free Software Foundation, Inc., 51
16 // Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
17
18 #include <cairo/cairo.h>
19
20 #include <libhildondesktop/libhildondesktop.h>
21 #include "applet-wrapper.h"
22
23 #include "simple-launcher.h"
24
25 struct _SLAWrapperPrivate {
26   void *applet;
27 };
28
29   static void sla_wrapper_init(SLAWrapper *self);
30   static void sla_wrapper_class_init(SLAWrapperClass *klass);
31   static void sla_wrapper_finalize(GObject *object);
32   static gboolean sla_wrapper_expose(GtkWidget *widget, GdkEventExpose *event);
33   static void sla_wrapper_size_allocate(GtkWidget *widget, GtkAllocation *alloc);
34   static void sla_wrapper_size_request(GtkWidget *widget, GtkRequisition *requisition);
35
36 HD_DEFINE_PLUGIN(SLAWrapper, sla_wrapper, HILDON_DESKTOP_TYPE_HOME_ITEM)
37
38 static void sla_wrapper_init(SLAWrapper *self) {
39   GdkColormap *colormap = NULL;
40
41   if ((colormap = gdk_screen_get_rgba_colormap(gdk_screen_get_default())) != NULL) {
42     gtk_widget_set_colormap(GTK_WIDGET(self), colormap);
43   }
44 }
45
46 static void sla_wrapper_class_init(SLAWrapperClass *klass) {
47   GtkWidgetClass *widget_class;
48   GObjectClass *object_class;
49
50   widget_class = GTK_WIDGET_CLASS(klass);
51   object_class = G_OBJECT_CLASS(klass);
52
53   object_class->finalize = sla_wrapper_finalize;
54
55   widget_class->expose_event = sla_wrapper_expose;
56   widget_class->size_allocate = sla_wrapper_size_allocate;
57   widget_class->size_request = sla_wrapper_size_request;
58
59   g_type_class_add_private(klass, sizeof(SLAWrapperPrivate));   // Do I need this?
60 }
61
62 static void sla_wrapper_finalize(GObject *object) {
63 #if 0
64   _SLAWrapperPrivate *priv = SLA_WRAPPER(object)->priv;
65
66   free(priv->applet);
67 #endif
68 }
69
70 static gboolean sla_wrapper_expose(GtkWidget *widget, GdkEventExpose *event) {
71   if (GTK_WIDGET_DRAWABLE(widget)) {
72     return GTK_WIDGET_CLASS(sla_wrapper_parent_class)->expose_event(widget, event);
73   } else {
74     return FALSE;
75   }
76 }
77
78 static void sla_wrapper_size_allocate(GtkWidget *widget, GtkAllocation *alloc) {
79   GTK_WIDGET_CLASS(sla_wrapper_parent_class)->size_allocate(widget, alloc);
80 }
81
82 static void sla_wrapper_size_request(GtkWidget *widget, GtkRequisition *requisition) {
83 #if 0
84   requisition->width = our_desired_width;
85   requisition->height = our_desired_height;
86 #endif
87 }
88
89 // vim:ts=2:sw=2:et