~ubuntu-branches/debian/squeeze/tasks/squeeze

« back to all changes in this revision

Viewing changes to libkoto/koto-entry.c

  • Committer: Bazaar Package Importer
  • Author(s): Ross Burton, Ross Burton, Loïc Minier, Emilio Pozuelo Monfort
  • Date: 2009-08-10 10:08:52 UTC
  • mfrom: (1.1.11 upstream)
  • Revision ID: james.westby@ubuntu.com-20090810100852-6gp4pydhwflg4vnb
Tags: 0.16-1
[ Ross Burton ]
* New upstream release (Closes: #539510)
* Fix debug package section and depends
* Bump Standards

[ Loïc Minier ]
* Set LDFLAGS directly; bump cdbs bdep to >= 0.4.41.
* Create tasks.pot during build: Add a common-build-arch:: snippet to call
  langpack.mk's langpack-mk-update-pot target with
  DEB_BUILDDIR=$(DEB_SRCDIR); intltool-update can't be called in builddir as
  it needs POTFILES.in and even with it wont lookup files listed there in
  srcdir; add a clean:: snippet to remove the pot file; LP: #188690.

[ Emilio Pozuelo Monfort ]
* Wrap build-deps and deps.

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
  if (priv->user_edit) {
95
95
    KotoUndoContext *context;
96
96
    InsertState *state;
97
 
    
 
97
 
98
98
    context = koto_undo_manager_context_begin (priv->manager, _("Insert"));
99
 
    
 
99
 
100
100
    state = g_slice_new0 (InsertState);
101
101
    state->editable = editable;
102
102
    state->text = g_strdup (text);
103
103
    state->length = strlen (text);
104
104
    state->position = *position;
105
 
    
 
105
 
106
106
    koto_undo_context_add
107
107
      (context, koto_undoable_new (insert_undo, insert_redo, insert_destroy, state));
108
108
 
112
112
  parent_editable_interface->insert_text (editable, text, length, position);
113
113
}
114
114
 
115
 
static void 
 
115
static void
116
116
koto_entry_delete_text (GtkEditable *editable, int start_pos, int end_pos)
117
117
{
118
118
  KotoEntry *entry = KOTO_ENTRY (editable);
121
121
  if (priv->user_edit) {
122
122
    KotoUndoContext *context;
123
123
    InsertState *state;
124
 
    
 
124
 
125
125
    context = koto_undo_manager_context_begin (priv->manager, _("Delete"));
126
 
    
 
126
 
127
127
    state = g_slice_new0 (InsertState);
128
128
    state->editable = editable;
129
129
    state->text = gtk_editable_get_chars (editable, start_pos, end_pos);
130
130
    state->length = strlen (state->text);
131
131
    state->position = start_pos;
132
 
    
 
132
 
133
133
    koto_undo_context_add
134
134
      (context, koto_undoable_new (insert_redo, insert_undo, insert_destroy, state));
135
135
 
136
136
    koto_undo_manager_context_end (priv->manager, context);
137
137
  }
138
 
  
 
138
 
139
139
  parent_editable_interface->delete_text (editable, start_pos, end_pos);
140
140
}
141
141
 
143
143
koto_entry_dispose (GObject *object)
144
144
{
145
145
  KotoEntryPrivate *priv = ENTRY_PRIVATE (object);
146
 
  
 
146
 
147
147
  if (priv->manager) {
148
148
    g_object_unref (priv->manager);
149
149
    priv->manager = NULL;
150
150
  }
151
 
  
 
151
 
152
152
  G_OBJECT_CLASS (koto_entry_parent_class)->dispose (object);
153
153
}
154
154
 
157
157
koto_entry_editable_init (GtkEditableClass *iface)
158
158
{
159
159
  parent_editable_interface = g_type_interface_peek_parent (iface);
160
 
  
 
160
 
161
161
  iface->insert_text = koto_entry_insert_text;
162
162
  iface->delete_text = koto_entry_delete_text;
163
163
}
176
176
on_key_press_event (GtkWidget *widget, GdkEventKey *event)
177
177
{
178
178
  gboolean control;
179
 
  
 
179
 
180
180
  control = event->state & GDK_CONTROL_MASK;
181
 
  
 
181
 
182
182
  if (control && event->keyval == 'z') {
183
 
    KotoEntryPrivate *priv = ENTRY_PRIVATE (widget); 
 
183
    KotoEntryPrivate *priv = ENTRY_PRIVATE (widget);
184
184
    koto_undo_manager_undo (priv->manager);
185
185
    return TRUE;
186
186
  } else if (control && event->keyval == 'Z') {
187
 
    KotoEntryPrivate *priv = ENTRY_PRIVATE (widget); 
 
187
    KotoEntryPrivate *priv = ENTRY_PRIVATE (widget);
188
188
    koto_undo_manager_redo (priv->manager);
189
189
    return TRUE;
190
190
  }
212
212
koto_entry_set_text (KotoEntry *entry, const char *text)
213
213
{
214
214
  KotoEntryPrivate *priv;
215
 
  
 
215
 
216
216
  g_return_if_fail (KOTO_IS_ENTRY (entry));
217
 
  
 
217
 
218
218
  priv = ENTRY_PRIVATE (entry);
219
219
 
220
220
  priv->user_edit = FALSE;