~ubuntu-branches/ubuntu/trusty/pcmanfm/trusty-proposed

« back to all changes in this revision

Viewing changes to src/exo/exo-private.c

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Lee
  • Date: 2008-09-26 10:19:20 UTC
  • mfrom: (4.1.5 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080926101920-cfldybkmwgwrtv9u
Tags: 0.5-3
* Correct spellings,  03_correct_spelling.dpatch (Closes:498794) 
* Code in some files are taken from other projects, added these
  informations into copyright file. (Closes:499678)
* Applied 04_defaut_terminal.dpatch to support x-terminal-emulator
  alternative. (Closes:497494) 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Id: exo-private.c 22884 2006-08-26 12:40:43Z benny $ */
 
2
/*-
 
3
 * Copyright (c) 2004-2006 os-cillation e.K.
 
4
 *
 
5
 * Written by Benedikt Meurer <benny@xfce.org>.
 
6
 *
 
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.
 
11
 *
 
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.
 
16
 *
 
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.
 
21
 */
 
22
 
 
23
#ifdef HAVE_CONFIG_H
 
24
#include <config.h>
 
25
#endif
 
26
 
 
27
#ifdef HAVE_LIBINTL_H
 
28
#include <libintl.h>
 
29
#endif
 
30
#ifdef HAVE_LOCALE_H
 
31
#include <locale.h>
 
32
#endif
 
33
 
 
34
#include "exo-private.h"
 
35
#include "exo-string.h"
 
36
 
 
37
#define             I_(string)  g_intern_static_string(string)
 
38
 
 
39
/*
 
40
void
 
41
_exo_i18n_init (void)
 
42
{
 
43
  static gboolean inited = FALSE;
 
44
 
 
45
  if (G_UNLIKELY (!inited))
 
46
    {
 
47
      inited = TRUE;
 
48
 
 
49
      bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
 
50
#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
 
51
      bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
 
52
#endif
 
53
    }
 
54
}
 
55
*/
 
56
 
 
57
 
 
58
void
 
59
_exo_gtk_widget_send_focus_change (GtkWidget *widget,
 
60
                                   gboolean   in)
 
61
{
 
62
  GdkEvent *fevent;
 
63
 
 
64
  g_object_ref (G_OBJECT (widget));
 
65
 
 
66
 if (in)
 
67
    GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
 
68
  else
 
69
    GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
 
70
 
 
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;
 
75
 
 
76
  gtk_widget_event (widget, fevent);
 
77
 
 
78
  g_object_notify (G_OBJECT (widget), "has-focus");
 
79
 
 
80
  g_object_unref (G_OBJECT (widget));
 
81
  gdk_event_free (fevent);
 
82
}
 
83
 
 
84
 
 
85
 
 
86
/**
 
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
 
91
 *                     of the process.
 
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.
 
96
 *
 
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.
 
100
 *
 
101
 * Return value: the newly registered #GType.
 
102
 **/
 
103
GType
 
104
_exo_g_type_register_simple (GType        type_parent,
 
105
                             const gchar *type_name_static,
 
106
                             guint        class_size,
 
107
                             gpointer     class_init,
 
108
                             guint        instance_size,
 
109
                             gpointer     instance_init)
 
110
{
 
111
  /* generate the type info (on the stack) */
 
112
  GTypeInfo info =
 
113
  {
 
114
    class_size,
 
115
    NULL,
 
116
    NULL,
 
117
    class_init,
 
118
    NULL,
 
119
    NULL,
 
120
    instance_size,
 
121
    0,
 
122
    instance_init,
 
123
    NULL,
 
124
  };
 
125
 
 
126
  /* register the static type */
 
127
  return g_type_register_static (type_parent, I_(type_name_static), &info, 0);
 
128
}
 
129
 
 
130
 
 
131
 
 
132
/**
 
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.
 
137
 *
 
138
 * Simple wrapper for g_type_add_interface_static(), which helps to avoid unnecessary
 
139
 * relocations for the #GInterfaceInfo<!---->s.
 
140
 **/
 
141
void
 
142
_exo_g_type_add_interface_simple (GType              instance_type,
 
143
                                  GType              interface_type,
 
144
                                  GInterfaceInitFunc interface_init_func)
 
145
{
 
146
  GInterfaceInfo info =
 
147
  {
 
148
    interface_init_func,
 
149
    NULL,
 
150
    NULL,
 
151
  };
 
152
 
 
153
  g_type_add_interface_static (instance_type, interface_type, &info);
 
154
}