~ubuntu-branches/ubuntu/trusty/contact-lookup-applet/trusty

« back to all changes in this revision

Viewing changes to src/test-entry.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2006-05-16 22:53:39 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20060516225339-crccuipnqqw39n4u
Tags: 0.14-0ubuntu1
* New upstream version:
  - Translate the .server files 
  - Don't set sensitivity ourself 
  - Correctly handle contacts with no email

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
        g_object_unref (source_list);
26
26
}
27
27
 
 
28
static void
 
29
sources_changed_cb (GConfClient *client, guint cnxn_id,
 
30
                GConfEntry *entry, EContactEntry *entry_widget)
 
31
{
 
32
        add_sources (entry_widget);
 
33
}
 
34
 
 
35
static void
 
36
setup_source_changes (EContactEntry *entry)
 
37
{
 
38
        GConfClient *gc;
 
39
 
 
40
        gc = gconf_client_get_default ();
 
41
        gconf_client_add_dir (gc, GCONF_COMPLETION,
 
42
                        GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
 
43
        gconf_client_notify_add (gc, GCONF_COMPLETION,
 
44
                        (GConfClientNotifyFunc) sources_changed_cb,
 
45
                        entry, NULL, NULL);
 
46
}
 
47
 
28
48
static char *
29
49
remove_spaces (const char *str)
30
50
{
127
147
        return FALSE;
128
148
}
129
149
 
 
150
static void
 
151
state_change_cb (GtkWidget *entry, gboolean state, gpointer data)
 
152
{
 
153
        g_print ("State of the entry changed: %s\n", state ? "Enabled" : "Disabled");
 
154
        gtk_widget_set_sensitive (entry, state);
 
155
}
 
156
 
130
157
int main (int argc, char **argv)
131
158
{
132
159
        GtkWidget *window, *entry;
138
165
        activate = gtk_dialog_add_button (GTK_DIALOG (window), GTK_STOCK_OK, GTK_RESPONSE_OK);
139
166
        gtk_widget_set_sensitive (activate, FALSE);
140
167
        entry = e_contact_entry_new ();
 
168
        gtk_widget_set_sensitive (entry, FALSE);
141
169
        add_sources (E_CONTACT_ENTRY (entry));
 
170
        setup_source_changes (E_CONTACT_ENTRY (entry));
142
171
        e_contact_entry_set_search_fields (E_CONTACT_ENTRY (entry), (const EContactField *)fields);
143
172
        e_contact_entry_set_display_func (E_CONTACT_ENTRY (entry), test_display_func, NULL, NULL);
144
173
        g_signal_connect (G_OBJECT (entry), "contact_selected",
147
176
                        G_CALLBACK (window_closed), NULL);
148
177
        g_signal_connect (G_OBJECT (entry), "changed",
149
178
                        G_CALLBACK (text_changed), NULL);
 
179
        g_signal_connect (G_OBJECT (entry), "state-change",
 
180
                        G_CALLBACK (state_change_cb), NULL);
150
181
 
151
182
        gtk_container_add (GTK_CONTAINER (GTK_DIALOG (window)->vbox), entry);
152
183