Mercurial > pidgin
comparison pidgin/gtkaccount.c @ 23102:f3dc7ef7385b
propagate from branch 'im.pidgin.pidgin' (head 48a880a9d212aec86b08bab7bec6296ac8c826ea)
to branch 'im.pidgin.pidgin.next.minor' (head 5e447824679704a8bd7b52cb006b419195db6cae)
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Wed, 30 Apr 2008 05:56:53 +0000 |
parents | 7eabc4ef27ed 424037c8a343 |
children | 133798922e2d |
comparison
equal
deleted
inserted
replaced
22792:7eabc4ef27ed | 23102:f3dc7ef7385b |
---|---|
253 } | 253 } |
254 gtk_widget_show(dialog->register_button); | 254 gtk_widget_show(dialog->register_button); |
255 } | 255 } |
256 } | 256 } |
257 | 257 |
258 static gboolean | |
259 screenname_focus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog) | |
260 { | |
261 GHashTable *table; | |
262 const char *label; | |
263 | |
264 table = dialog->prpl_info->get_account_text_table(NULL); | |
265 label = g_hash_table_lookup(table, "login_label"); | |
266 | |
267 if(!strcmp(gtk_entry_get_text(GTK_ENTRY(widget)), label)) { | |
268 gtk_entry_set_text(GTK_ENTRY(widget), ""); | |
269 gtk_widget_modify_text(widget, GTK_STATE_NORMAL,NULL); | |
270 } | |
271 | |
272 g_hash_table_unref(table); | |
273 | |
274 return FALSE; | |
275 } | |
276 | |
258 static void | 277 static void |
259 screenname_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) | 278 screenname_changed_cb(GtkEntry *entry, AccountPrefsDialog *dialog) |
260 { | 279 { |
261 if (dialog->ok_button) | 280 if (dialog->ok_button) |
262 gtk_widget_set_sensitive(dialog->ok_button, | 281 gtk_widget_set_sensitive(dialog->ok_button, |
268 gtk_widget_set_sensitive(dialog->register_button, | 287 gtk_widget_set_sensitive(dialog->register_button, |
269 *gtk_entry_get_text(entry) != '\0'); | 288 *gtk_entry_get_text(entry) != '\0'); |
270 } | 289 } |
271 } | 290 } |
272 | 291 |
292 static gboolean | |
293 screenname_nofocus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog) | |
294 { | |
295 GdkColor color = {0, 34952, 35466, 34181}; | |
296 GHashTable *table; | |
297 const char *label; | |
298 | |
299 table = dialog->prpl_info->get_account_text_table(NULL); | |
300 label = g_hash_table_lookup(table, "login_label"); | |
301 | |
302 if (*gtk_entry_get_text(GTK_ENTRY(widget)) == '\0') { | |
303 /* We have to avoid hitting the screenname_changed_cb function | |
304 * because it enables buttons we don't want enabled yet ;) | |
305 */ | |
306 g_signal_handlers_block_by_func(widget, G_CALLBACK(screenname_changed_cb), dialog); | |
307 gtk_entry_set_text(GTK_ENTRY(widget), label); | |
308 /* Make sure we can hit it again */ | |
309 g_signal_handlers_unblock_by_func(widget, G_CALLBACK(screenname_changed_cb), dialog); | |
310 gtk_widget_modify_text(widget, GTK_STATE_NORMAL, &color); | |
311 } | |
312 | |
313 g_hash_table_unref(table); | |
314 | |
315 return FALSE; | |
316 } | |
317 | |
273 static void | 318 static void |
274 icon_filesel_choose_cb(const char *filename, gpointer data) | 319 icon_filesel_choose_cb(const char *filename, gpointer data) |
275 { | 320 { |
276 AccountPrefsDialog *dialog = data; | 321 AccountPrefsDialog *dialog = data; |
277 | 322 |
362 GtkWidget *menu; | 407 GtkWidget *menu; |
363 GtkWidget *item; | 408 GtkWidget *item; |
364 GList *user_splits; | 409 GList *user_splits; |
365 GList *l, *l2; | 410 GList *l, *l2; |
366 char *username = NULL; | 411 char *username = NULL; |
412 GdkColor color = {0, 34952, 35466, 34181}; | |
413 GHashTable *table; | |
414 const char *label; | |
367 | 415 |
368 if (dialog->protocol_menu != NULL) | 416 if (dialog->protocol_menu != NULL) |
369 { | 417 { |
370 gtk_widget_ref(dialog->protocol_menu); | 418 gtk_widget_ref(dialog->protocol_menu); |
371 hbox = g_object_get_data(G_OBJECT(dialog->protocol_menu), "container"); | 419 hbox = g_object_get_data(G_OBJECT(dialog->protocol_menu), "container"); |
407 #if GTK_CHECK_VERSION(2,10,0) | 455 #if GTK_CHECK_VERSION(2,10,0) |
408 g_object_set(G_OBJECT(dialog->screenname_entry), "truncate-multiline", TRUE, NULL); | 456 g_object_set(G_OBJECT(dialog->screenname_entry), "truncate-multiline", TRUE, NULL); |
409 #endif | 457 #endif |
410 | 458 |
411 add_pref_box(dialog, vbox, _("Screen _name:"), dialog->screenname_entry); | 459 add_pref_box(dialog, vbox, _("Screen _name:"), dialog->screenname_entry); |
460 | |
461 if (dialog->prpl_info->get_account_text_table) { | |
462 table = dialog->prpl_info->get_account_text_table(NULL); | |
463 label = g_hash_table_lookup(table, "login_label"); | |
464 | |
465 gtk_entry_set_text(GTK_ENTRY(dialog->screenname_entry), label); | |
466 g_signal_connect(G_OBJECT(dialog->screenname_entry), "focus-in-event", | |
467 G_CALLBACK(screenname_focus_cb), dialog); | |
468 g_signal_connect(G_OBJECT(dialog->screenname_entry), "focus-out-event", | |
469 G_CALLBACK(screenname_nofocus_cb), dialog); | |
470 gtk_widget_modify_text(dialog->screenname_entry, GTK_STATE_NORMAL, &color); | |
471 | |
472 g_hash_table_unref(table); | |
473 } | |
412 | 474 |
413 g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed", | 475 g_signal_connect(G_OBJECT(dialog->screenname_entry), "changed", |
414 G_CALLBACK(screenname_changed_cb), dialog); | 476 G_CALLBACK(screenname_changed_cb), dialog); |
415 | 477 |
416 /* Do the user split thang */ | 478 /* Do the user split thang */ |