~ubuntu-branches/ubuntu/quantal/glade-3/quantal

« back to all changes in this revision

Viewing changes to gladeui/glade-editor-table.c

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Trudel-Lapierre, Michael Terry
  • Date: 2010-12-17 16:08:20 UTC
  • mfrom: (1.2.16 upstream)
  • Revision ID: james.westby@ubuntu.com-20101217160820-h4q6yt3wre8c669k
Tags: 3.7.2-0ubuntu1
* New upstream release 3.7.2.
* debian/control: libgladeui-1-10 becomes libgladeui-1-11 due to soname
  change.
* debian/libgladeui-1-11.install: renamed from libgladeui-1-10.install.
* debian/rules: update DH_MAKESHLIBS for libgladeui soname change.
* debian/control: libgladeui-1-dev should be Arch: any and strictly Depends
  on the binary version of libglade-1-11. This also corrects the lintian
  warnings about being binNMUable and a weak library dev dependency.
* debian/control: drop Build-Depends-Indep requirements, they are no longer
  necessary, plus there is no Arch-Indep package left.

[ Michael Terry ]
* debian/watch: Fix pattern so that it works

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
                         G_IMPLEMENT_INTERFACE (GLADE_TYPE_EDITABLE,
38
38
                                                glade_editor_table_editable_init));
39
39
 
 
40
 
 
41
#define BLOCK_NAME_ENTRY_CB(table)                                      \
 
42
        do { if (table->name_entry)                                     \
 
43
                        g_signal_handlers_block_by_func (G_OBJECT (table->name_entry), \
 
44
                                                         G_CALLBACK (widget_name_edited), table); \
 
45
        } while (0);
 
46
 
 
47
#define UNBLOCK_NAME_ENTRY_CB(table)                                    \
 
48
        do { if (table->name_entry)                                     \
 
49
                        g_signal_handlers_unblock_by_func (G_OBJECT (table->name_entry), \
 
50
                                                           G_CALLBACK (widget_name_edited), table); \
 
51
        } while (0);
 
52
 
 
53
 
40
54
static void
41
55
glade_editor_table_class_init (GladeEditorTableClass *klass)
42
56
{
107
121
                GTK_WIDGET_CLASS (glade_editor_table_parent_class)->grab_focus (widget);
108
122
}
109
123
 
 
124
static void
 
125
widget_name_edited (GtkWidget *editable, GladeEditorTable *table)
 
126
{
 
127
        GladeWidget *widget;
 
128
        gchar *new_name;
 
129
        
 
130
        g_return_if_fail (GTK_IS_EDITABLE (editable));
 
131
        g_return_if_fail (GLADE_IS_EDITOR_TABLE (table));
 
132
 
 
133
        if (table->loaded_widget == NULL)
 
134
        {
 
135
                g_warning ("Name entry edited with no loaded widget in editor %p!\n",
 
136
                           table);
 
137
                return;
 
138
        }
 
139
 
 
140
        widget = table->loaded_widget;
 
141
        new_name = gtk_editable_get_chars (GTK_EDITABLE (editable), 0, -1);
 
142
 
 
143
        if (glade_project_available_widget_name (widget->project, widget, new_name))
 
144
                glade_command_set_name (widget, new_name);
 
145
        g_free (new_name);
 
146
}
110
147
 
111
148
static void
112
149
widget_name_changed (GladeWidget      *widget,
116
153
        if (!gtk_widget_get_mapped (GTK_WIDGET (table)))
117
154
                return;
118
155
 
119
 
        table->loading = TRUE;
120
156
        if (table->name_entry)
 
157
        {       
 
158
                BLOCK_NAME_ENTRY_CB (table);
121
159
                gtk_entry_set_text (GTK_ENTRY (table->name_entry), table->loaded_widget->name);
122
 
        table->loading = FALSE;
 
160
                UNBLOCK_NAME_ENTRY_CB (table);
 
161
        }
123
162
 
124
163
}       
125
164
 
142
181
        GList               *list;
143
182
 
144
183
        /* abort mission */
145
 
        if ((!table->loaded_widget && !widget) ||
146
 
            (table->loaded_widget && table->loaded_widget == widget))
 
184
        if (table->loaded_widget == widget)
147
185
                return;
148
186
 
149
 
        table->loading = TRUE;
150
 
 
151
187
        if (table->loaded_widget)
152
188
        {
153
189
                g_signal_handlers_disconnect_by_func (G_OBJECT (table->loaded_widget),
161
197
 
162
198
        table->loaded_widget = widget;
163
199
 
 
200
        BLOCK_NAME_ENTRY_CB (table);
 
201
 
164
202
        if (table->loaded_widget)
165
203
        {
166
204
                g_signal_connect (G_OBJECT (table->loaded_widget), "notify::name",
178
216
        else if (table->name_entry)
179
217
                gtk_entry_set_text (GTK_ENTRY (table->name_entry), "");
180
218
 
 
219
        UNBLOCK_NAME_ENTRY_CB (table);
 
220
 
181
221
        /* Sync up properties, even if widget is NULL */
182
222
        for (list = table->properties; list; list = list->next)
183
223
        {
184
224
                property = list->data;
185
225
                glade_editor_property_load_by_widget (property, widget);
186
226
        }
187
 
 
188
 
        table->loading = FALSE;
189
227
}
190
228
 
191
229
static void
331
369
}
332
370
 
333
371
static void
334
 
widget_name_edited (GtkWidget *editable, GladeEditorTable *table)
335
 
{
336
 
        GladeWidget *widget;
337
 
        gchar *new_name;
338
 
        
339
 
        g_return_if_fail (GTK_IS_EDITABLE (editable));
340
 
        g_return_if_fail (GLADE_IS_EDITOR_TABLE (table));
341
 
        
342
 
        if (table->loading) return;
343
 
 
344
 
        widget = table->loaded_widget;
345
 
        new_name = gtk_editable_get_chars (GTK_EDITABLE (editable), 0, -1);
346
 
 
347
 
        if (glade_project_available_widget_name (widget->project, widget, new_name))
348
 
                glade_command_set_name (widget, new_name);
349
 
        g_free (new_name);
350
 
}
351
 
 
352
 
 
353
 
static void
354
372
append_name_field (GladeEditorTable *table)
355
373
{
356
374
        gchar     *text = _("The Object's name");