~ubuntu-branches/ubuntu/hardy/pidgin/hardy

« back to all changes in this revision

Viewing changes to finch/libgnt/gntlabel.c

  • Committer: Bazaar Package Importer
  • Author(s): Pedro Fragoso
  • Date: 2007-12-21 02:48:06 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20071221024806-pd44a5k9tiyh12mp
Tags: 1:2.3.1-2ubuntu1
* Sync with Debian, remaining Ubuntu changes; (LP: #177811)
  - Set Maintainer to Ubuntu Core Developers.
  - Add build-deps on liblaunchpad-integration-dev, intltool,
    libnm-glib-dev (for --enable-nm) (Ubuntu #112720).
  - Drop build-deps on libsilc-1.1-2-dev | libsilc-dev (>= 1.1.1) as 
    this library is in universe.
  - Drop the libpurple0 recommends on libpurple-bin.
  - Add a gaim transitionnal package for upgrades.
  - Ship compatibility symlinks via debian/gaim.links.
  - Pass --enable-nm to configure to enable NetworkManager support.
  - Pass --disable-silc to configure to disable silc support even if 
    it's installed in the build environment.
  - Add X-Ubuntu-Gettext-Domain to the desktop file and update the
    translation templates in common-install-impl::.
   - Update debian/prefs.xml to set the notify plugin prefs
    /plugins/gtk/X11/notify/* and set /pidgin/plugins/loaded to load 
    the notify plugin; Ubuntu: #13389.
  - Add LPI integration patch, 02_lpi.
  - Add patch 04_let_crasher_for_apport to stop catching the SIGSEGV signal
    and let apport handle it.
  - Add patch 05_default_to_irc_ubuntu_com to set the default IRC 
    server to irc.ubuntu.com.
  - Add autoconf patch, 70_autoconf.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
enum
29
29
{
 
30
        PROP_0,
 
31
        PROP_TEXT,
 
32
        PROP_TEXT_FLAG
 
33
};
 
34
 
 
35
enum
 
36
{
30
37
        SIGS = 1,
31
38
};
32
39
 
61
68
}
62
69
 
63
70
static void
 
71
gnt_label_set_property(GObject *obj, guint prop_id, const GValue *value,
 
72
                GParamSpec *spec)
 
73
{
 
74
        GntLabel *label = GNT_LABEL(obj);
 
75
        switch (prop_id) {
 
76
                case PROP_TEXT:
 
77
                        g_free(label->text);
 
78
                        label->text = gnt_util_onscreen_fit_string(g_value_get_string(value), -1);
 
79
                        break;
 
80
                case PROP_TEXT_FLAG:
 
81
                        label->flags = g_value_get_int(value);
 
82
                        break;
 
83
                default:
 
84
                        g_return_if_reached();
 
85
                        break;
 
86
        }
 
87
}
 
88
 
 
89
static void
 
90
gnt_label_get_property(GObject *obj, guint prop_id, GValue *value,
 
91
                GParamSpec *spec)
 
92
{
 
93
        GntLabel *label = GNT_LABEL(obj);
 
94
        switch (prop_id) {
 
95
                case PROP_TEXT:
 
96
                        g_value_set_string(value, label->text);
 
97
                        break;
 
98
                case PROP_TEXT_FLAG:
 
99
                        g_value_set_int(value, label->flags);
 
100
                        break;
 
101
                default:
 
102
                        break;
 
103
        }
 
104
}
 
105
 
 
106
static void
64
107
gnt_label_class_init(GntLabelClass *klass)
65
108
{
 
109
        GObjectClass *gclass = G_OBJECT_CLASS(klass);
 
110
 
66
111
        parent_class = GNT_WIDGET_CLASS(klass);
67
112
        parent_class->destroy = gnt_label_destroy;
68
113
        parent_class->draw = gnt_label_draw;
69
114
        parent_class->map = NULL;
70
115
        parent_class->size_request = gnt_label_size_request;
71
116
 
 
117
        gclass->set_property = gnt_label_set_property;
 
118
        gclass->get_property = gnt_label_get_property;
 
119
 
 
120
        g_object_class_install_property(gclass,
 
121
                        PROP_TEXT,
 
122
                        g_param_spec_string("text", "Text",
 
123
                                "The text for the label.",
 
124
                                NULL,
 
125
                                G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
 
126
                        )
 
127
                );
 
128
 
 
129
        g_object_class_install_property(gclass,
 
130
                        PROP_TEXT_FLAG,
 
131
                        g_param_spec_int("text-flag", "Text flag",
 
132
                                "Text attribute to use when displaying the text in the label.",
 
133
                                GNT_TEXT_FLAG_NORMAL,
 
134
                                GNT_TEXT_FLAG_NORMAL|GNT_TEXT_FLAG_BOLD|GNT_TEXT_FLAG_UNDERLINE|
 
135
                                GNT_TEXT_FLAG_BLINK|GNT_TEXT_FLAG_DIM|GNT_TEXT_FLAG_HIGHLIGHT,
 
136
                                GNT_TEXT_FLAG_NORMAL,
 
137
                                G_PARAM_READWRITE|G_PARAM_STATIC_NAME|G_PARAM_STATIC_NICK|G_PARAM_STATIC_BLURB
 
138
                        )
 
139
                );
72
140
        GNTDEBUG;
73
141
}
74
142
 
76
144
gnt_label_init(GTypeInstance *instance, gpointer class)
77
145
{
78
146
        GntWidget *widget = GNT_WIDGET(instance);
 
147
        gnt_widget_set_take_focus(widget, FALSE);
 
148
        GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW);
79
149
        GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_X);
80
150
        widget->priv.minw = 3;
81
151
        widget->priv.minh = 1;
120
190
 
121
191
GntWidget *gnt_label_new_with_format(const char *text, GntTextFormatFlags flags)
122
192
{
123
 
        GntWidget *widget = g_object_new(GNT_TYPE_LABEL, NULL);
124
 
        GntLabel *label = GNT_LABEL(widget);
125
 
 
126
 
        label->text = gnt_util_onscreen_fit_string(text, -1);
127
 
        label->flags = flags;
128
 
        gnt_widget_set_take_focus(widget, FALSE);
129
 
        GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW);
130
 
 
 
193
        GntWidget *widget = g_object_new(GNT_TYPE_LABEL, "text-flag", flags, "text", text, NULL);
131
194
        return widget;
132
195
}
133
196
 
134
197
void gnt_label_set_text(GntLabel *label, const char *text)
135
198
{
136
 
        g_free(label->text);
137
 
        label->text = gnt_util_onscreen_fit_string(text, -1);
 
199
        g_object_set(label, "text", text, NULL);
138
200
 
139
201
        if (GNT_WIDGET(label)->window)
140
202
        {