~ubuntu-branches/ubuntu/saucy/gnome-control-center/saucy-proposed

« back to all changes in this revision

Viewing changes to .pc/git_fix_big_editable_labels.patch/shell/cc-editable-entry.c

  • Committer: Package Import Robot
  • Author(s): Sebastien Bacher, Sebastien Bacher, Robert Ancell, Iain Lane, Edward Donovan, Rico Tzschichholz, Jeremy Bicha, David Henningsson
  • Date: 2012-11-21 19:32:45 UTC
  • mfrom: (1.1.63)
  • Revision ID: package-import@ubuntu.com-20121121193245-mj61nzz1z4fk3z25
Tags: 1:3.6.3-0ubuntu1
[ Sebastien Bacher ]
* New upstream version
* debian/control.in: recommends libcanberra-pulse (lp: #1004973)
* debian/patches/58_ubuntu_icon_views_redesign.patch:
  - drop most of the changes, keep the different grid size though
    to fit on screen with our extra icons
* debian/patches/91_dont_show_in_unity.patch:
  - dropped, show the upstream printer panel and the layout tab
* debian/patches/revert_git_keyboard_gsettings.patch,
  debian/patches/revert_git_stop_using_gconf.patch:
  - dropped the gconf->gsettings reverts

[ Robert Ancell ]
* New upstream release (LP: #1010317)
* debian/control:
  - Bump build-depends on libgnome-desktop-3-dev, libwacom-dev
  - Add build-depends on libclutter-1.0-dev, libclutter-gtk-1.0-dev,
    libpwquality-dev
  - Drop build-depends on libgnomekbd-dev
* debian/patches/60_ubuntu_nav_bar.patch:
  - Disabled for now, doesn't apply
* debian/patches/revert_ua_gsettings.patch:
  - We can use GSettings for universal access now
* debian/patches/00git_online_accounts_gtkgrid.patch:
* debian/patches/00git_online_accounts_layout.part:
* debian/patches/git_wacom_translations.patch:
  - Applied upstream

[ Iain Lane ]
* Add Build-Depends on libxkbfile-dev
* New upstream release.
* Refresh all patches to apply cleanly.

[ Edward Donovan ]
* debian/source_gnome-control-center.py: Fix for Python 3. (LP: #1013171)

[ Rico Tzschichholz ]
* debian/control.in:
  - Build-depend on gtk-doc-tools instead of docbook directly
  - Bump minimum glib-2.0, gnome-desktop3, gnome-settings-daemon
     and gsettings-desktop-schemas

[ Jeremy Bicha ]
* Dropped more patches applied in new version:
  - git_unmute_sound_event.patch
  - git_fix_big_editable_labels.patch
  - 96_sound_nua_panel.patch
* debian/patches/04_new_appearance_settings.patch:
  - Dropped, this is now packaged separately as gnome-control-center-unity
* debian/patches/10_keyboard_layout_on_unity.patch:
  - Don't change the keyboard panel name when not running Unity
* debian/patches/52_ubuntu_language_list_mods.patch:
  - Don't disable adding current language to the list. While this
    fix shows the current language twice, at least it avoids the
    "Ubuntu suddenly in Chinese" bug (LP: #1035219)
* debian/patches/53_use_ubuntu_help.patch:
  - Only show Ubuntu help when running Unity
* debian/patches/58_hide_gdm_notifications.patch:
  - Hide "Show notifications when locked" settings when running Unity
    since it's a GNOME Shell-specific feature
* debian/patches/63_normal_scrollbar_in_a11y.patch:
  - Drop, overlay-scrollbars should handle this instead
* debian/patches/91_dont_show_in_unity.patch:
  - Hide Printers & Region panels in Unity until we're ready to switch
    to them.
* debian/patches/fix-crash-on-user-panel.patch:
  - Dropped, GNOME says it's obsolete
* debian/rules:
  - Build with -z,defs again
  - Explicitly disable ibus support since ibus 1.4 isn't supported in
    this version
* debian/control.in:
  - Drop ubuntu-docs and gnome-user-guide from recommends to suggests
  - Don't recommend indicators; let's leave that to Unity

[ David Henningsson ]
* sound_nua_panel.patch: Rebase to gnome 3.6 

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2
 
 *
3
 
 * Copyright 2009-2010  Red Hat, Inc,
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 3 of the License, or
8
 
 * (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
 
 *
19
 
 * Written by: Matthias Clasen <mclasen@redhat.com>
20
 
 */
21
 
 
22
 
#include <gdk/gdkkeysyms.h>
23
 
#include "cc-editable-entry.h"
24
 
 
25
 
#define EMPTY_TEXT "\xe2\x80\x94"
26
 
 
27
 
struct _CcEditableEntryPrivate {
28
 
        GtkNotebook *notebook;
29
 
        GtkLabel    *label;
30
 
        GtkButton   *button;
31
 
        GtkEntry    *entry;
32
 
 
33
 
        gchar *text;
34
 
        gboolean editable;
35
 
        gboolean selectable;
36
 
        gint weight;
37
 
        gboolean weight_set;
38
 
        gdouble scale;
39
 
        gboolean scale_set;
40
 
 
41
 
        gboolean in_stop_editing;
42
 
};
43
 
 
44
 
#define CC_EDITABLE_ENTRY_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CC_TYPE_EDITABLE_ENTRY, CcEditableEntryPrivate))
45
 
 
46
 
enum {
47
 
        PROP_0,
48
 
        PROP_TEXT,
49
 
        PROP_EDITABLE,
50
 
        PROP_SELECTABLE,
51
 
        PROP_SCALE,
52
 
        PROP_SCALE_SET,
53
 
        PROP_WEIGHT,
54
 
        PROP_WEIGHT_SET
55
 
};
56
 
 
57
 
enum {
58
 
        EDITING_DONE,
59
 
        LAST_SIGNAL
60
 
};
61
 
 
62
 
enum {
63
 
        PAGE_LABEL,
64
 
        PAGE_BUTTON,
65
 
        PAGE_ENTRY
66
 
};
67
 
 
68
 
static guint signals [LAST_SIGNAL] = { 0, };
69
 
 
70
 
G_DEFINE_TYPE (CcEditableEntry, cc_editable_entry, GTK_TYPE_ALIGNMENT);
71
 
 
72
 
void
73
 
cc_editable_entry_set_text (CcEditableEntry *e,
74
 
                             const gchar    *text)
75
 
{
76
 
        CcEditableEntryPrivate *priv;
77
 
        gchar *tmp;
78
 
        GtkWidget *label;
79
 
 
80
 
        priv = e->priv;
81
 
 
82
 
        tmp = g_strdup (text);
83
 
        g_free (priv->text);
84
 
        priv->text = tmp;
85
 
 
86
 
        gtk_entry_set_text (priv->entry, tmp);
87
 
 
88
 
        if (tmp == NULL || tmp[0] == '\0')
89
 
                tmp = EMPTY_TEXT;
90
 
 
91
 
        gtk_label_set_text (priv->label, tmp);
92
 
        label = gtk_bin_get_child (GTK_BIN (priv->button));
93
 
        gtk_label_set_text (GTK_LABEL (label), tmp);
94
 
 
95
 
        g_object_notify (G_OBJECT (e), "text");
96
 
}
97
 
 
98
 
const gchar *
99
 
cc_editable_entry_get_text (CcEditableEntry *e)
100
 
{
101
 
        return e->priv->text;
102
 
}
103
 
 
104
 
void
105
 
cc_editable_entry_set_editable (CcEditableEntry *e,
106
 
                                 gboolean        editable)
107
 
{
108
 
        CcEditableEntryPrivate *priv;
109
 
 
110
 
        priv = e->priv;
111
 
 
112
 
        if (priv->editable != editable) {
113
 
                priv->editable = editable;
114
 
 
115
 
                gtk_notebook_set_current_page (priv->notebook, editable ? PAGE_BUTTON : PAGE_LABEL);
116
 
 
117
 
                g_object_notify (G_OBJECT (e), "editable");
118
 
        }
119
 
}
120
 
 
121
 
gboolean
122
 
cc_editable_entry_get_editable (CcEditableEntry *e)
123
 
{
124
 
        return e->priv->editable;
125
 
}
126
 
 
127
 
void
128
 
cc_editable_entry_set_selectable (CcEditableEntry *e,
129
 
                                  gboolean         selectable)
130
 
{
131
 
        CcEditableEntryPrivate *priv;
132
 
 
133
 
        priv = e->priv;
134
 
 
135
 
        if (priv->selectable != selectable) {
136
 
                priv->selectable = selectable;
137
 
 
138
 
                gtk_label_set_selectable (priv->label, selectable);
139
 
 
140
 
                g_object_notify (G_OBJECT (e), "selectable");
141
 
        }
142
 
}
143
 
 
144
 
gboolean
145
 
cc_editable_entry_get_selectable (CcEditableEntry *e)
146
 
{
147
 
        return e->priv->selectable;
148
 
}
149
 
 
150
 
static void
151
 
update_entry_font (GtkWidget        *widget,
152
 
                   CcEditableEntry *e)
153
 
{
154
 
        CcEditableEntryPrivate *priv = e->priv;
155
 
        PangoFontDescription *desc;
156
 
        GtkStyleContext *style;
157
 
        gint size;
158
 
 
159
 
        if (!priv->weight_set && !priv->scale_set)
160
 
                return;
161
 
 
162
 
        g_signal_handlers_block_by_func (widget, update_entry_font, e);
163
 
 
164
 
        gtk_widget_override_font (widget, NULL);        
165
 
 
166
 
        style = gtk_widget_get_style_context (widget);
167
 
        desc = pango_font_description_copy 
168
 
                (gtk_style_context_get_font (style, gtk_widget_get_state_flags (widget)));
169
 
 
170
 
        if (priv->weight_set)
171
 
                pango_font_description_set_weight (desc, priv->weight);
172
 
        if (priv->scale_set) {
173
 
                size = pango_font_description_get_size (desc);
174
 
                pango_font_description_set_size (desc, priv->scale * size);
175
 
        }
176
 
        gtk_widget_override_font (widget, desc);
177
 
 
178
 
        pango_font_description_free (desc);
179
 
 
180
 
        g_signal_handlers_unblock_by_func (widget, update_entry_font, e);
181
 
}
182
 
 
183
 
static void
184
 
update_fonts (CcEditableEntry *e)
185
 
{
186
 
        PangoAttrList *attrs;
187
 
        PangoAttribute *attr;
188
 
        GtkWidget *label;
189
 
 
190
 
        CcEditableEntryPrivate *priv = e->priv;
191
 
 
192
 
        attrs = pango_attr_list_new ();
193
 
        if (priv->scale_set) {
194
 
                attr = pango_attr_scale_new (priv->scale);
195
 
                pango_attr_list_insert (attrs, attr);
196
 
        }
197
 
        if (priv->weight_set) {
198
 
                attr = pango_attr_weight_new (priv->weight);
199
 
                pango_attr_list_insert (attrs, attr);
200
 
        }
201
 
 
202
 
        gtk_label_set_attributes (priv->label, attrs);
203
 
 
204
 
        label = gtk_bin_get_child (GTK_BIN (priv->button));
205
 
        gtk_label_set_attributes (GTK_LABEL (label), attrs);
206
 
 
207
 
        pango_attr_list_unref (attrs);
208
 
 
209
 
        update_entry_font ((GtkWidget *)priv->entry, e);
210
 
}
211
 
 
212
 
void
213
 
cc_editable_entry_set_weight (CcEditableEntry *e,
214
 
                               gint            weight)
215
 
{
216
 
        CcEditableEntryPrivate *priv = e->priv;
217
 
 
218
 
        if (priv->weight == weight && priv->weight_set)
219
 
                return;
220
 
 
221
 
        priv->weight = weight;
222
 
        priv->weight_set = TRUE;
223
 
 
224
 
        update_fonts (e);
225
 
 
226
 
        g_object_notify (G_OBJECT (e), "weight");
227
 
        g_object_notify (G_OBJECT (e), "weight-set");
228
 
}
229
 
 
230
 
gint
231
 
cc_editable_entry_get_weight (CcEditableEntry *e)
232
 
{
233
 
        return e->priv->weight;
234
 
}
235
 
 
236
 
void
237
 
cc_editable_entry_set_scale (CcEditableEntry *e,
238
 
                              gdouble         scale)
239
 
{
240
 
        CcEditableEntryPrivate *priv = e->priv;
241
 
 
242
 
        if (priv->scale == scale && priv->scale_set)
243
 
                return;
244
 
 
245
 
        priv->scale = scale;
246
 
        priv->scale_set = TRUE;
247
 
 
248
 
        update_fonts (e);
249
 
 
250
 
        g_object_notify (G_OBJECT (e), "scale");
251
 
        g_object_notify (G_OBJECT (e), "scale-set");
252
 
}
253
 
 
254
 
gdouble
255
 
cc_editable_entry_get_scale (CcEditableEntry *e)
256
 
{
257
 
        return e->priv->scale;
258
 
}
259
 
 
260
 
static void
261
 
cc_editable_entry_set_property (GObject      *object,
262
 
                                guint         prop_id,
263
 
                                const GValue *value,
264
 
                                GParamSpec   *pspec)
265
 
{
266
 
        CcEditableEntry *e = CC_EDITABLE_ENTRY (object);
267
 
 
268
 
        switch (prop_id) {
269
 
        case PROP_TEXT:
270
 
                cc_editable_entry_set_text (e, g_value_get_string (value));
271
 
                break;
272
 
        case PROP_EDITABLE:
273
 
                cc_editable_entry_set_editable (e, g_value_get_boolean (value));
274
 
                break;
275
 
        case PROP_SELECTABLE:
276
 
                cc_editable_entry_set_selectable (e, g_value_get_boolean (value));
277
 
                break;
278
 
        case PROP_WEIGHT:
279
 
                cc_editable_entry_set_weight (e, g_value_get_int (value));
280
 
                break;
281
 
        case PROP_WEIGHT_SET:
282
 
                e->priv->weight_set = g_value_get_boolean (value);
283
 
                break;
284
 
        case PROP_SCALE:
285
 
                cc_editable_entry_set_scale (e, g_value_get_double (value));
286
 
                break;
287
 
        case PROP_SCALE_SET:
288
 
                e->priv->scale_set = g_value_get_boolean (value);
289
 
                break;
290
 
        default:
291
 
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
292
 
                break;
293
 
        }
294
 
}
295
 
 
296
 
static void
297
 
cc_editable_entry_get_property (GObject    *object,
298
 
                                guint       prop_id,
299
 
                                GValue     *value,
300
 
                                GParamSpec *pspec)
301
 
{
302
 
        CcEditableEntry *e = CC_EDITABLE_ENTRY (object);
303
 
 
304
 
        switch (prop_id) {
305
 
        case PROP_TEXT:
306
 
                g_value_set_string (value,
307
 
                                    cc_editable_entry_get_text (e));
308
 
                break;
309
 
        case PROP_EDITABLE:
310
 
                g_value_set_boolean (value,
311
 
                                     cc_editable_entry_get_editable (e));
312
 
                break;
313
 
        case PROP_SELECTABLE:
314
 
                g_value_set_boolean (value,
315
 
                                     cc_editable_entry_get_selectable (e));
316
 
                break;
317
 
        case PROP_WEIGHT:
318
 
                g_value_set_int (value,
319
 
                                 cc_editable_entry_get_weight (e));
320
 
                break;
321
 
        case PROP_WEIGHT_SET:
322
 
                g_value_set_boolean (value, e->priv->weight_set);
323
 
                break;
324
 
        case PROP_SCALE:
325
 
                g_value_set_double (value,
326
 
                                    cc_editable_entry_get_scale (e));
327
 
                break;
328
 
        case PROP_SCALE_SET:
329
 
                g_value_set_boolean (value, e->priv->scale_set);
330
 
                break;
331
 
        default:
332
 
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
333
 
                break;
334
 
        }
335
 
}
336
 
 
337
 
static void
338
 
cc_editable_entry_finalize (GObject *object)
339
 
{
340
 
        CcEditableEntry *e = (CcEditableEntry*)object;
341
 
 
342
 
        g_free (e->priv->text);
343
 
 
344
 
        G_OBJECT_CLASS (cc_editable_entry_parent_class)->finalize (object);
345
 
}
346
 
 
347
 
static void
348
 
cc_editable_entry_class_init (CcEditableEntryClass *class)
349
 
{
350
 
        GObjectClass *object_class;
351
 
 
352
 
        object_class = G_OBJECT_CLASS (class);
353
 
 
354
 
        object_class->set_property = cc_editable_entry_set_property;
355
 
        object_class->get_property = cc_editable_entry_get_property;
356
 
        object_class->finalize = cc_editable_entry_finalize;
357
 
 
358
 
        signals[EDITING_DONE] =
359
 
                g_signal_new ("editing-done",
360
 
                              G_TYPE_FROM_CLASS (class),
361
 
                              G_SIGNAL_RUN_LAST,
362
 
                              G_STRUCT_OFFSET (CcEditableEntryClass, editing_done),
363
 
                              NULL, NULL,
364
 
                              g_cclosure_marshal_VOID__VOID,
365
 
                              G_TYPE_NONE, 0);
366
 
 
367
 
        g_object_class_install_property (object_class, PROP_TEXT,
368
 
                g_param_spec_string ("text",
369
 
                                     "Text", "The text of the button",
370
 
                                     NULL,
371
 
                                     G_PARAM_READWRITE));
372
 
 
373
 
        g_object_class_install_property (object_class, PROP_EDITABLE,
374
 
                g_param_spec_boolean ("editable",
375
 
                                      "Editable", "Whether the text can be edited",
376
 
                                      FALSE,
377
 
                                      G_PARAM_READWRITE));
378
 
 
379
 
        g_object_class_install_property (object_class, PROP_SELECTABLE,
380
 
                g_param_spec_boolean ("selectable",
381
 
                                      "Selectable", "Whether the text can be selected by mouse",
382
 
                                      FALSE,
383
 
                                      G_PARAM_READWRITE));
384
 
 
385
 
        g_object_class_install_property (object_class, PROP_WEIGHT,
386
 
                g_param_spec_int ("weight",
387
 
                                  "Font Weight", "The font weight to use",
388
 
                                  0, G_MAXINT, PANGO_WEIGHT_NORMAL,
389
 
                                  G_PARAM_READWRITE));
390
 
 
391
 
        g_object_class_install_property (object_class, PROP_WEIGHT_SET,
392
 
                g_param_spec_boolean ("weight-set",
393
 
                                      "Font Weight Set", "Whether a font weight is set",
394
 
                                      FALSE,
395
 
                                      G_PARAM_READWRITE));
396
 
 
397
 
        g_object_class_install_property (object_class, PROP_SCALE,
398
 
                g_param_spec_double ("scale",
399
 
                                     "Font Scale", "The font scale to use",
400
 
                                     0.0, G_MAXDOUBLE, 1.0,
401
 
                                     G_PARAM_READWRITE));
402
 
 
403
 
        g_object_class_install_property (object_class, PROP_SCALE_SET,
404
 
                g_param_spec_boolean ("scale-set",
405
 
                                      "Font Scale Set", "Whether a font scale is set",
406
 
                                      FALSE,
407
 
                                      G_PARAM_READWRITE));
408
 
 
409
 
        g_type_class_add_private (class, sizeof (CcEditableEntryPrivate));
410
 
}
411
 
 
412
 
static void
413
 
start_editing (CcEditableEntry *e)
414
 
{
415
 
        gtk_notebook_set_current_page (e->priv->notebook, PAGE_ENTRY);
416
 
}
417
 
 
418
 
static void
419
 
stop_editing (CcEditableEntry *e)
420
 
{
421
 
        /* Avoid launching another "editing-done" signal
422
 
         * caused by the notebook page change */
423
 
        if (e->priv->in_stop_editing)
424
 
                return;
425
 
 
426
 
        e->priv->in_stop_editing = TRUE;
427
 
        gtk_notebook_set_current_page (e->priv->notebook, PAGE_BUTTON);
428
 
        cc_editable_entry_set_text (e, gtk_entry_get_text (e->priv->entry));
429
 
        g_signal_emit (e, signals[EDITING_DONE], 0);
430
 
        e->priv->in_stop_editing = FALSE;
431
 
}
432
 
 
433
 
static void
434
 
cancel_editing (CcEditableEntry *e)
435
 
{
436
 
        gtk_entry_set_text (e->priv->entry, cc_editable_entry_get_text (e));
437
 
        gtk_notebook_set_current_page (e->priv->notebook, PAGE_BUTTON);
438
 
}
439
 
 
440
 
static void
441
 
button_clicked (GtkWidget       *widget,
442
 
                CcEditableEntry *e)
443
 
{
444
 
        start_editing (e);
445
 
}
446
 
 
447
 
static void
448
 
entry_activated (GtkWidget       *widget,
449
 
                 CcEditableEntry *e)
450
 
{
451
 
        stop_editing (e);
452
 
}
453
 
 
454
 
static gboolean
455
 
entry_focus_out (GtkWidget       *widget,
456
 
                 GdkEventFocus   *event,
457
 
                 CcEditableEntry *e)
458
 
{
459
 
        stop_editing (e);
460
 
        return FALSE;
461
 
}
462
 
 
463
 
static gboolean
464
 
entry_key_press (GtkWidget       *widget,
465
 
                 GdkEventKey     *event,
466
 
                 CcEditableEntry *e)
467
 
{
468
 
        if (event->keyval == GDK_KEY_Escape) {
469
 
                cancel_editing (e);
470
 
        }
471
 
        return FALSE;
472
 
}
473
 
 
474
 
static void
475
 
update_button_padding (GtkWidget       *widget,
476
 
                       GtkAllocation   *allocation,
477
 
                       CcEditableEntry *e)
478
 
{
479
 
        CcEditableEntryPrivate *priv = e->priv;
480
 
        GtkAllocation alloc;
481
 
        gint offset;
482
 
        gint pad;
483
 
 
484
 
        gtk_widget_get_allocation (gtk_widget_get_parent (widget), &alloc);
485
 
 
486
 
        offset = allocation->x - alloc.x;
487
 
 
488
 
        gtk_misc_get_padding  (GTK_MISC (priv->label), &pad, NULL);
489
 
        if (offset != pad)
490
 
                gtk_misc_set_padding (GTK_MISC (priv->label), offset, 0);
491
 
}
492
 
 
493
 
static void
494
 
cc_editable_entry_init (CcEditableEntry *e)
495
 
{
496
 
        CcEditableEntryPrivate *priv;
497
 
 
498
 
        priv = e->priv = CC_EDITABLE_ENTRY_GET_PRIVATE (e);
499
 
 
500
 
        priv->weight = PANGO_WEIGHT_NORMAL;
501
 
        priv->weight_set = FALSE;
502
 
        priv->scale = 1.0;
503
 
        priv->scale_set = FALSE;
504
 
 
505
 
        priv->notebook = (GtkNotebook*)gtk_notebook_new ();
506
 
        gtk_notebook_set_show_tabs (priv->notebook, FALSE);
507
 
        gtk_notebook_set_show_border (priv->notebook, FALSE);
508
 
 
509
 
        /* Label */
510
 
        priv->label = (GtkLabel*)gtk_label_new (EMPTY_TEXT);
511
 
        gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5);
512
 
        gtk_notebook_append_page (priv->notebook, (GtkWidget*)priv->label, NULL);
513
 
 
514
 
        /* Button */
515
 
        priv->button = (GtkButton*)gtk_button_new_with_label (EMPTY_TEXT);
516
 
        gtk_widget_set_receives_default ((GtkWidget*)priv->button, TRUE);
517
 
        gtk_button_set_relief (priv->button, GTK_RELIEF_NONE);
518
 
        gtk_button_set_alignment (priv->button, 0.0, 0.5);
519
 
        gtk_notebook_append_page (priv->notebook, (GtkWidget*)priv->button, NULL);
520
 
        g_signal_connect (priv->button, "clicked", G_CALLBACK (button_clicked), e);
521
 
 
522
 
        /* Entry */
523
 
        priv->entry = (GtkEntry*)gtk_entry_new ();
524
 
        gtk_notebook_append_page (priv->notebook, (GtkWidget*)priv->entry, NULL);
525
 
 
526
 
        g_signal_connect (priv->entry, "activate", G_CALLBACK (entry_activated), e);
527
 
        g_signal_connect (priv->entry, "focus-out-event", G_CALLBACK (entry_focus_out), e);
528
 
        g_signal_connect (priv->entry, "key-press-event", G_CALLBACK (entry_key_press), e);
529
 
        g_signal_connect (priv->entry, "style-updated", G_CALLBACK (update_entry_font), e);
530
 
        g_signal_connect (gtk_bin_get_child (GTK_BIN (priv->button)), "size-allocate", G_CALLBACK (update_button_padding), e);
531
 
 
532
 
        gtk_container_add (GTK_CONTAINER (e), (GtkWidget*)priv->notebook);
533
 
 
534
 
        gtk_widget_show ((GtkWidget*)priv->notebook);
535
 
        gtk_widget_show ((GtkWidget*)priv->label);
536
 
        gtk_widget_show ((GtkWidget*)priv->button);
537
 
        gtk_widget_show ((GtkWidget*)priv->entry);
538
 
 
539
 
        gtk_notebook_set_current_page (priv->notebook, PAGE_LABEL);
540
 
}
541
 
 
542
 
GtkWidget *
543
 
cc_editable_entry_new (void)
544
 
{
545
 
        return (GtkWidget *) g_object_new (CC_TYPE_EDITABLE_ENTRY, NULL);
546
 
}