1
/* $Id: exo-private.c 22884 2006-08-26 12:40:43Z benny $ */
3
* Copyright (c) 2004-2006 os-cillation e.K.
5
* Written by Benedikt Meurer <benny@xfce.org>.
7
* This library is free software; you can redistribute it and/or
8
* modify it under the terms of the GNU Library General Public
9
* License as published by the Free Software Foundation; either
10
* version 2 of the License, or (at your option) any later version.
12
* This library is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* Library General Public License for more details.
17
* You should have received a copy of the GNU Library General Public
18
* License along with this library; if not, write to the
19
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20
* Boston, MA 02111-1307, USA.
34
#include "exo-private.h"
35
#include "exo-string.h"
37
#define I_(string) g_intern_static_string(string)
43
static gboolean inited = FALSE;
45
if (G_UNLIKELY (!inited))
49
bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
50
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
51
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
59
_exo_gtk_widget_send_focus_change (GtkWidget *widget,
64
g_object_ref (G_OBJECT (widget));
67
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
69
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
71
fevent = gdk_event_new (GDK_FOCUS_CHANGE);
72
fevent->focus_change.type = GDK_FOCUS_CHANGE;
73
fevent->focus_change.window = g_object_ref (widget->window);
74
fevent->focus_change.in = in;
76
gtk_widget_event (widget, fevent);
78
g_object_notify (G_OBJECT (widget), "has-focus");
80
g_object_unref (G_OBJECT (widget));
81
gdk_event_free (fevent);
87
* _exo_g_type_register_simple:
88
* @type_parent : the parent #GType.
89
* @type_name_static : the name of the new #GType, must reside in static
90
* storage and remain unchanged during the lifetime
92
* @class_size : the size of the class structure in bytes.
93
* @class_init : the class init function or %NULL.
94
* @instance_size : the size of the instance structure in bytes.
95
* @instance_init : the constructor function or %NULL.
97
* Simple wrapper for g_type_register_static(), which takes the most
98
* important aspects of the type as parameters to avoid relocations
99
* when using static constant #GTypeInfo<!---->s.
101
* Return value: the newly registered #GType.
104
_exo_g_type_register_simple (GType type_parent,
105
const gchar *type_name_static,
109
gpointer instance_init)
111
/* generate the type info (on the stack) */
126
/* register the static type */
127
return g_type_register_static (type_parent, I_(type_name_static), &info, 0);
133
* _exo_g_type_add_interface_simple:
134
* @instance_type : the #GType which should implement the @interface_type.
135
* @interface_type : the #GType of the interface.
136
* @interface_init_func : initialization function for the interface.
138
* Simple wrapper for g_type_add_interface_static(), which helps to avoid unnecessary
139
* relocations for the #GInterfaceInfo<!---->s.
142
_exo_g_type_add_interface_simple (GType instance_type,
143
GType interface_type,
144
GInterfaceInitFunc interface_init_func)
146
GInterfaceInfo info =
153
g_type_add_interface_static (instance_type, interface_type, &info);