~canonical-dx-team/ubuntu/maverick/gtk+2.0/menuproxy

« back to all changes in this revision

Viewing changes to gtk/gtkeditable.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-05-04 12:24:25 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20070504122425-0m8midgzrp40y8w2
Tags: 2.10.12-1ubuntu1
* Sync with Debian
* New upstream version:
  Fixed bugs:
  - 379414 file chooser warnings when changing path in the entry
  - 418585 GtkFileChooserDefault sizing code is not DPI independent
  - 419568 Crash in search if start with special letter
  - 435062 build dies with icon cache validation
  - 379399 Segfault to call gtk_print_operation_run twice.
  - 387889 cups backend has problems when there are too many printers
  - 418531 invalid read to gtkicontheme.c gtk_icon_theme_lookup_icon...
  - 423916 crash in color scheme code
  - 424042 Segmentation fault while quickly pressing Alt+arrows
  - 415260 Protect against negative indices when setting values in G...
  - 419171 XGetVisualInfo() may not set nxvisuals
  - 128852 Gdk cursors don't look good on win32
  - 344657 Ctrl-H doesn't toggle "Show Hidden Files" setting
  - 345345 PrintOperation::paginate is not emitted for class handler
  - 347567 GtkPrintOperation::end-print is not emitted if it's cance...
  - 369112 gtk_ui_manager_add_ui should accept unnamed separator
  - 392015 Selected menu item invisible on Windows Vista
  - 399253 MS-Windows Theme Bottom Tab placement rendering glitches
  - 399425 gtk_input_dialog_fill_axes() adds child to gtkscrolledwin...
  - 403251 [patch] little memory leak in GtkPrintJob
  - 403267 [patch] memory leak in GtkPageSetupUnixDialog
  - 403470 MS-Windows Theme tab placement other than on top leaks a ...
  - 404506 Windows system fonts that have multi-byte font names cann...
  - 405089 Incorrect window placement for GtkEventBox private window
  - 405515 Minor leak in gtkfilesystemmodel.c
  - 405539 gdk_pixbuf_save() for PNG saver can return FALSE without ...
  - 415681 gdk_window_clear_area includes an extra line and column o...
  - 418219 GtkRecentChooser should apply filter before sorting and c...
  - 418403 Scroll to printer after selecting it from settings
  - 421985 _gtk_print_operation_platform_backend_launch_preview
  - 421990 gtk_print_job_get_surface
  - 421993 gtk_print_operation_init
  - 423064 Conditional jump or move depends on uninitialised value(s...
  - 423722 Fix printing header in gtk-demo
  - 424168 gtk_print_operation_run on async preview
  - 425655 Don't install gtk+-unix-print-2.0.pc on non-UNIX platforms
  - 425786 GDK segfaults if XineramaQueryScreens fails
  - 428665 Lpr Backend gets stuck in infinite loop during gtk_enumer...
  - 429902 GtkPrintOperation leaks cairo contextes
  - 431997 First delay of GdkPixbufAnimationIter is wrong
  - 433242 Inconsistent scroll arrow position calculations
  - 433972 Placing gtk.Expander inside a gtk.TextView() changes gtk....
  - 434261 _gtk_toolbar_elide_underscores incorrectly handles some s...
  - 383354 ctrl-L should make 'Location' entry disappear
  - 418673 gtk_recent_manager_add_item
  - 429732 gtk_accel_group_finalize accesses invalid memory
  - 435028 WM_CLIENT_LEADER is wrong on the leader_window
  - 431067 Background of the header window is not updated
  - 338843 add recent files support inside the ui manager
  - 148535 add drop shadow to menus, tooltips, etc. under Windows XP
* debian/control.in:
  - Conflicts on ubuntulooks (<= 0.9.11-1)
* debian/patches/15_default-fallback-icon-theme.patch:
  - patch from Debian, fallback on gnome icon theme

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GTK - The GIMP Toolkit
 
2
 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Lesser General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Lesser General Public
 
15
 * License along with this library; if not, write to the
 
16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
 * Boston, MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
/*
 
21
 * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS
 
22
 * file for a list of people on the GTK+ Team.  See the ChangeLog
 
23
 * files for a list of changes.  These files are distributed with
 
24
 * GTK+ at ftp://ftp.gtk.org/pub/gtk/. 
 
25
 */
 
26
 
 
27
#include <config.h>
 
28
#include <string.h>
 
29
 
 
30
#include "gtkeditable.h"
 
31
#include "gtkmarshalers.h"
 
32
#include "gtkintl.h"
 
33
#include "gtkalias.h"
 
34
 
 
35
 
 
36
static void gtk_editable_base_init (gpointer g_class);
 
37
 
 
38
 
 
39
GType
 
40
gtk_editable_get_type (void)
 
41
{
 
42
  static GType editable_type = 0;
 
43
 
 
44
  if (!editable_type)
 
45
    {
 
46
      const GTypeInfo editable_info =
 
47
      {
 
48
        sizeof (GtkEditableClass),  /* class_size */
 
49
        gtk_editable_base_init,     /* base_init */
 
50
        NULL,                       /* base_finalize */
 
51
      };
 
52
 
 
53
      editable_type = g_type_register_static (G_TYPE_INTERFACE, I_("GtkEditable"),
 
54
                                              &editable_info, 0);
 
55
    }
 
56
 
 
57
  return editable_type;
 
58
}
 
59
 
 
60
static void
 
61
gtk_editable_base_init (gpointer g_class)
 
62
{
 
63
  static gboolean initialized = FALSE;
 
64
 
 
65
  if (! initialized)
 
66
    {
 
67
      g_signal_new (I_("insert_text"),
 
68
                    GTK_TYPE_EDITABLE,
 
69
                    G_SIGNAL_RUN_LAST,
 
70
                    G_STRUCT_OFFSET (GtkEditableClass, insert_text),
 
71
                    NULL, NULL,
 
72
                    _gtk_marshal_VOID__STRING_INT_POINTER,
 
73
                    G_TYPE_NONE, 3,
 
74
                    G_TYPE_STRING,
 
75
                    G_TYPE_INT,
 
76
                    G_TYPE_POINTER);
 
77
      g_signal_new (I_("delete_text"),
 
78
                    GTK_TYPE_EDITABLE,
 
79
                    G_SIGNAL_RUN_LAST,
 
80
                    G_STRUCT_OFFSET (GtkEditableClass, delete_text),
 
81
                    NULL, NULL,
 
82
                    _gtk_marshal_VOID__INT_INT,
 
83
                    G_TYPE_NONE, 2,
 
84
                    G_TYPE_INT,
 
85
                    G_TYPE_INT);
 
86
      g_signal_new (I_("changed"),
 
87
                    GTK_TYPE_EDITABLE,
 
88
                    G_SIGNAL_RUN_LAST,
 
89
                    G_STRUCT_OFFSET (GtkEditableClass, changed),
 
90
                    NULL, NULL,
 
91
                    _gtk_marshal_VOID__VOID,
 
92
                    G_TYPE_NONE, 0);
 
93
 
 
94
      initialized = TRUE;
 
95
    }
 
96
}
 
97
 
 
98
void
 
99
gtk_editable_insert_text (GtkEditable *editable,
 
100
                          const gchar *new_text,
 
101
                          gint         new_text_length,
 
102
                          gint        *position)
 
103
{
 
104
  g_return_if_fail (GTK_IS_EDITABLE (editable));
 
105
  g_return_if_fail (position != NULL);
 
106
 
 
107
  if (new_text_length < 0)
 
108
    new_text_length = strlen (new_text);
 
109
  
 
110
  GTK_EDITABLE_GET_CLASS (editable)->do_insert_text (editable, new_text, new_text_length, position);
 
111
}
 
112
 
 
113
void
 
114
gtk_editable_delete_text (GtkEditable *editable,
 
115
                          gint         start_pos,
 
116
                          gint         end_pos)
 
117
{
 
118
  g_return_if_fail (GTK_IS_EDITABLE (editable));
 
119
 
 
120
  GTK_EDITABLE_GET_CLASS (editable)->do_delete_text (editable, start_pos, end_pos);
 
121
}
 
122
 
 
123
gchar *    
 
124
gtk_editable_get_chars (GtkEditable *editable,
 
125
                        gint         start,
 
126
                        gint         end)
 
127
{
 
128
  g_return_val_if_fail (GTK_IS_EDITABLE (editable), NULL);
 
129
 
 
130
  return GTK_EDITABLE_GET_CLASS (editable)->get_chars (editable, start, end);
 
131
}
 
132
 
 
133
void
 
134
gtk_editable_set_position (GtkEditable      *editable,
 
135
                           gint              position)
 
136
{
 
137
  g_return_if_fail (GTK_IS_EDITABLE (editable));
 
138
 
 
139
  GTK_EDITABLE_GET_CLASS (editable)->set_position (editable, position);
 
140
}
 
141
 
 
142
gint
 
143
gtk_editable_get_position (GtkEditable      *editable)
 
144
{
 
145
  g_return_val_if_fail (GTK_IS_EDITABLE (editable), 0);
 
146
 
 
147
  return GTK_EDITABLE_GET_CLASS (editable)->get_position (editable);
 
148
}
 
149
 
 
150
gboolean
 
151
gtk_editable_get_selection_bounds (GtkEditable *editable,
 
152
                                   gint        *start_pos,
 
153
                                   gint        *end_pos)
 
154
{
 
155
  gint tmp_start, tmp_end;
 
156
  gboolean result;
 
157
  
 
158
  g_return_val_if_fail (GTK_IS_EDITABLE (editable), FALSE);
 
159
 
 
160
  result = GTK_EDITABLE_GET_CLASS (editable)->get_selection_bounds (editable, &tmp_start, &tmp_end);
 
161
 
 
162
  if (start_pos)
 
163
    *start_pos = MIN (tmp_start, tmp_end);
 
164
  if (end_pos)
 
165
    *end_pos = MAX (tmp_start, tmp_end);
 
166
 
 
167
  return result;
 
168
}
 
169
 
 
170
void
 
171
gtk_editable_delete_selection (GtkEditable *editable)
 
172
{
 
173
  gint start, end;
 
174
 
 
175
  g_return_if_fail (GTK_IS_EDITABLE (editable));
 
176
 
 
177
  if (gtk_editable_get_selection_bounds (editable, &start, &end))
 
178
    gtk_editable_delete_text (editable, start, end);
 
179
}
 
180
 
 
181
void
 
182
gtk_editable_select_region (GtkEditable *editable,
 
183
                            gint         start,
 
184
                            gint         end)
 
185
{
 
186
  g_return_if_fail (GTK_IS_EDITABLE (editable));
 
187
  
 
188
  GTK_EDITABLE_GET_CLASS (editable)->set_selection_bounds (editable,  start, end);
 
189
}
 
190
 
 
191
void
 
192
gtk_editable_cut_clipboard (GtkEditable *editable)
 
193
{
 
194
  g_return_if_fail (GTK_IS_EDITABLE (editable));
 
195
  
 
196
  g_signal_emit_by_name (editable, "cut_clipboard");
 
197
}
 
198
 
 
199
void
 
200
gtk_editable_copy_clipboard (GtkEditable *editable)
 
201
{
 
202
  g_return_if_fail (GTK_IS_EDITABLE (editable));
 
203
  
 
204
  g_signal_emit_by_name (editable, "copy_clipboard");
 
205
}
 
206
 
 
207
void
 
208
gtk_editable_paste_clipboard (GtkEditable *editable)
 
209
{
 
210
  g_return_if_fail (GTK_IS_EDITABLE (editable));
 
211
  
 
212
  g_signal_emit_by_name (editable, "paste_clipboard");
 
213
}
 
214
 
 
215
void
 
216
gtk_editable_set_editable (GtkEditable    *editable,
 
217
                           gboolean        is_editable)
 
218
{
 
219
  g_return_if_fail (GTK_IS_EDITABLE (editable));
 
220
 
 
221
  g_object_set (editable,
 
222
                "editable", is_editable != FALSE,
 
223
                NULL);
 
224
}
 
225
 
 
226
/**
 
227
 * gtk_editable_get_editable:
 
228
 * @editable: a #GtkEditable
 
229
 *
 
230
 * Retrieves whether @editable is editable. See
 
231
 * gtk_editable_set_editable().
 
232
 *
 
233
 * Return value: %TRUE if @editable is editable.
 
234
 **/
 
235
gboolean
 
236
gtk_editable_get_editable (GtkEditable *editable)
 
237
{
 
238
  gboolean value;
 
239
 
 
240
  g_return_val_if_fail (GTK_IS_EDITABLE (editable), FALSE);
 
241
 
 
242
  g_object_get (editable, "editable", &value, NULL);
 
243
 
 
244
  return value;
 
245
}
 
246
 
 
247
#define __GTK_EDITABLE_C__
 
248
#include "gtkaliasdef.c"