Mercurial > pidgin.yaz
changeset 27343:d2d796aed2c7
merge of '42ff94691667fa47b66d698b59f9eca2326c3660'
and '90b0bd90767d8c909b65e673e4112c798e3af479'
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Fri, 03 Jul 2009 04:27:02 +0000 |
parents | 988e8ee76731 (diff) 8796eaaca38a (current diff) |
children | 975a29213f35 |
files | |
diffstat | 16 files changed, 242 insertions(+), 128 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/account.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/account.c Fri Jul 03 04:27:02 2009 +0000 @@ -2660,7 +2660,7 @@ /* If we're not connected to the Internet right now, we bail on this */ if (!purple_network_is_available()) { - purple_debug_info("account", "Network not connected; skipping reconnect\n"); + purple_debug_warning("account", "Network not connected; skipping reconnect\n"); return; }
--- a/libpurple/blist.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/blist.c Fri Jul 03 04:27:02 2009 +0000 @@ -1909,7 +1909,6 @@ void purple_blist_merge_contact(PurpleContact *source, PurpleBlistNode *node) { PurpleBlistNode *sourcenode = (PurpleBlistNode*)source; - PurpleBlistNode *targetnode; PurpleBlistNode *prev, *cur, *next; PurpleContact *target; @@ -1929,7 +1928,6 @@ if (source == target || !target) return; - targetnode = (PurpleBlistNode *)target; next = sourcenode->child; while (next) {
--- a/libpurple/certificate.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/certificate.c Fri Jul 03 04:27:02 2009 +0000 @@ -93,14 +93,11 @@ "Successfully verified certificate for %s\n", vrq->subject_name); } else { - purple_debug_info("certificate", + purple_debug_error("certificate", "Failed to verify certificate for %s\n", vrq->subject_name); } - - - /* Pass the results on to the request's callback */ (vrq->cb)(st, vrq->cb_data); @@ -224,7 +221,7 @@ /* Check the signature for this link */ if (! purple_certificate_signed_by(crt, issuer) ) { uid = purple_certificate_get_unique_id(issuer); - purple_debug_info("certificate", + purple_debug_error("certificate", "...Bad or missing signature by %s\nChain is INVALID\n", uid); g_free(uid); @@ -681,7 +678,7 @@ /* Check that X.509 is registered */ x509 = purple_certificate_find_scheme(x509_ca.scheme_name); if ( !x509 ) { - purple_debug_info("certificate/x509/ca", + purple_debug_warning("certificate/x509/ca", "Lazy init failed because an X.509 Scheme " "is not yet registered. Maybe it will be " "better later.\n"); @@ -1162,7 +1159,7 @@ purple_certificate_verify_complete(vrq, PURPLE_CERTIFICATE_VALID); } else { - purple_debug_info("certificate/x509/tls_cached", + purple_debug_warning("certificate/x509/tls_cached", "User REJECTED cert\n"); purple_certificate_verify_complete(vrq, PURPLE_CERTIFICATE_INVALID); @@ -1273,7 +1270,7 @@ purple_certificate_verify_complete(vrq, PURPLE_CERTIFICATE_VALID); } else { - purple_debug_info("certificate/x509/tls_cached", + purple_debug_error("certificate/x509/tls_cached", "Peer cert did NOT match cached\n"); /* vrq now becomes the problem of the user */ x509_tls_cached_unknown_peer(vrq); @@ -1377,7 +1374,7 @@ ca_id); ca_crt = purple_certificate_pool_retrieve(ca, ca_id); if ( NULL == ca_crt ) { - purple_debug_info("certificate/x509/tls_cached", + purple_debug_warning("certificate/x509/tls_cached", "Certificate Authority with DN='%s' not " "found. I'll prompt the user, I guess.\n", ca_id); @@ -1426,7 +1423,7 @@ gchar *sn = purple_certificate_get_subject_name(peer_crt); gchar *msg; - purple_debug_info("certificate/x509/tls_cached", + purple_debug_error("certificate/x509/tls_cached", "Name mismatch: Certificate given for %s " "has a name of %s\n", vrq->subject_name, sn); @@ -1504,7 +1501,7 @@ /* vrq is now the responsibility of cert_in_cache */ x509_tls_cached_cert_in_cache(vrq); } else { - purple_debug_info("certificate/x509/tls_cached", + purple_debug_warning("certificate/x509/tls_cached", "...Not in cache\n"); /* vrq now becomes the problem of unknown_peer */ x509_tls_cached_unknown_peer(vrq);
--- a/libpurple/cipher.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/cipher.c Fri Jul 03 04:27:02 2009 +0000 @@ -2379,7 +2379,7 @@ g_return_val_if_fail(cipher, FALSE); if(!cipher->ops->append || !cipher->ops->digest) { - purple_debug_info("cipher", "purple_cipher_region failed: " + purple_debug_warning("cipher", "purple_cipher_region failed: " "the %s cipher does not support appending and or " "digesting.", cipher->name); return FALSE; @@ -2527,7 +2527,7 @@ if(cipher->ops && cipher->ops->set_option) cipher->ops->set_option(context, name, value); else - purple_debug_info("cipher", "the %s cipher does not support the " + purple_debug_warning("cipher", "the %s cipher does not support the " "set_option operation\n", cipher->name); } @@ -2544,7 +2544,7 @@ if(cipher->ops && cipher->ops->get_option) return cipher->ops->get_option(context, name); else { - purple_debug_info("cipher", "the %s cipher does not support the " + purple_debug_warning("cipher", "the %s cipher does not support the " "get_option operation\n", cipher->name); return NULL; @@ -2627,7 +2627,7 @@ if(cipher->ops && cipher->ops->set_iv) cipher->ops->set_iv(context, iv, len); else - purple_debug_info("cipher", "the %s cipher does not support the set" + purple_debug_warning("cipher", "the %s cipher does not support the set" "initialization vector operation\n", cipher->name); } @@ -2645,7 +2645,7 @@ if(cipher->ops && cipher->ops->append) cipher->ops->append(context, data, len); else - purple_debug_info("cipher", "the %s cipher does not support the append " + purple_debug_warning("cipher", "the %s cipher does not support the append " "operation\n", cipher->name); } @@ -2662,7 +2662,7 @@ if(cipher->ops && cipher->ops->digest) return cipher->ops->digest(context, in_len, digest, out_len); else { - purple_debug_info("cipher", "the %s cipher does not support the digest " + purple_debug_warning("cipher", "the %s cipher does not support the digest " "operation\n", cipher->name); return FALSE; } @@ -2712,7 +2712,7 @@ if(cipher->ops && cipher->ops->encrypt) return cipher->ops->encrypt(context, data, len, output, outlen); else { - purple_debug_info("cipher", "the %s cipher does not support the encrypt" + purple_debug_warning("cipher", "the %s cipher does not support the encrypt" "operation\n", cipher->name); if(outlen) @@ -2736,7 +2736,7 @@ if(cipher->ops && cipher->ops->decrypt) return cipher->ops->decrypt(context, data, len, output, outlen); else { - purple_debug_info("cipher", "the %s cipher does not support the decrypt" + purple_debug_warning("cipher", "the %s cipher does not support the decrypt" "operation\n", cipher->name); if(outlen) @@ -2758,7 +2758,7 @@ if(cipher->ops && cipher->ops->set_salt) cipher->ops->set_salt(context, salt); else - purple_debug_info("cipher", "the %s cipher does not support the " + purple_debug_warning("cipher", "the %s cipher does not support the " "set_salt operation\n", cipher->name); } @@ -2774,7 +2774,7 @@ if(cipher->ops && cipher->ops->get_salt_size) return cipher->ops->get_salt_size(context); else { - purple_debug_info("cipher", "the %s cipher does not support the " + purple_debug_warning("cipher", "the %s cipher does not support the " "get_salt_size operation\n", cipher->name); return -1; @@ -2793,7 +2793,7 @@ if(cipher->ops && cipher->ops->set_key) cipher->ops->set_key(context, key); else - purple_debug_info("cipher", "the %s cipher does not support the " + purple_debug_warning("cipher", "the %s cipher does not support the " "set_key operation\n", cipher->name); } @@ -2809,7 +2809,7 @@ if(cipher->ops && cipher->ops->get_key_size) return cipher->ops->get_key_size(context); else { - purple_debug_info("cipher", "the %s cipher does not support the " + purple_debug_warning("cipher", "the %s cipher does not support the " "get_key_size operation\n", cipher->name); return -1; @@ -2830,7 +2830,7 @@ if(cipher->ops && cipher->ops->set_batch_mode) cipher->ops->set_batch_mode(context, mode); else - purple_debug_info("cipher", "The %s cipher does not support the " + purple_debug_warning("cipher", "The %s cipher does not support the " "set_batch_mode operation\n", cipher->name); } @@ -2847,7 +2847,7 @@ if(cipher->ops && cipher->ops->get_batch_mode) return cipher->ops->get_batch_mode(context); else { - purple_debug_info("cipher", "The %s cipher does not support the " + purple_debug_warning("cipher", "The %s cipher does not support the " "get_batch_mode operation\n", cipher->name); return -1; } @@ -2866,7 +2866,7 @@ if(cipher->ops && cipher->ops->get_block_size) return cipher->ops->get_block_size(context); else { - purple_debug_info("cipher", "The %s cipher does not support the " + purple_debug_warning("cipher", "The %s cipher does not support the " "get_block_size operation\n", cipher->name); return -1; } @@ -2886,7 +2886,7 @@ if(cipher->ops && cipher->ops->set_key_with_len) cipher->ops->set_key_with_len(context, key, len); else - purple_debug_info("cipher", "The %s cipher does not support the " + purple_debug_warning("cipher", "The %s cipher does not support the " "set_key_with_len operation\n", cipher->name); }
--- a/libpurple/dnsquery.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/dnsquery.c Fri Jul 03 04:27:02 2009 +0000 @@ -127,7 +127,7 @@ static void purple_dnsquery_failed(PurpleDnsQueryData *query_data, const gchar *error_message) { - purple_debug_info("dnsquery", "%s\n", error_message); + purple_debug_error("dnsquery", "%s\n", error_message); if (query_data->callback != NULL) query_data->callback(NULL, query_data->data, error_message); purple_dnsquery_destroy(query_data);
--- a/libpurple/network.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/network.c Fri Jul 03 04:27:02 2009 +0000 @@ -240,7 +240,7 @@ /* listen_data->pnp_data = NULL; */ if (!success) { - purple_debug_info("network", "Couldn't create UPnP mapping\n"); + purple_debug_warning("network", "Couldn't create UPnP mapping\n"); if (listen_data->retry) { listen_data->retry = FALSE; listen_data->adding = FALSE;
--- a/libpurple/plugin.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/plugin.c Fri Jul 03 04:27:02 2009 +0000 @@ -222,7 +222,7 @@ return plugin; else if (!purple_plugin_is_unloadable(plugin)) { - purple_debug_info("plugins", "Not loading %s. " + purple_debug_warning("plugins", "Not loading %s. " "Another plugin with the same name (%s) has already been loaded.\n", filename, plugin->path); return plugin;
--- a/libpurple/pluginpref.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/pluginpref.c Fri Jul 03 04:27:02 2009 +0000 @@ -196,7 +196,7 @@ if (purple_prefs_get_type(pref->name) != PURPLE_PREF_INT) { - purple_debug_info("pluginpref", + purple_debug_warning("pluginpref", "purple_plugin_pref_set_bounds: %s is not an integer pref\n", pref->name); return; @@ -220,7 +220,7 @@ if (purple_prefs_get_type(pref->name) != PURPLE_PREF_INT) { - purple_debug(PURPLE_DEBUG_INFO, "pluginpref", + purple_debug_warning("pluginpref", "purple_plugin_pref_get_bounds: %s is not an integer pref\n", pref->name); return;
--- a/libpurple/protocols/msn/state.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/protocols/msn/state.c Fri Jul 03 04:27:02 2009 +0000 @@ -249,7 +249,7 @@ void msn_set_psm(MsnSession *session) { - PurpleAccount *account = session->account; + PurpleAccount *account; PurplePresence *presence; PurpleStatus *status; MsnCmdProc *cmdproc; @@ -261,6 +261,7 @@ g_return_if_fail(session != NULL); g_return_if_fail(session->notification != NULL); + account = session->account; cmdproc = session->notification->cmdproc; /* Get the PSM string from Purple's Status Line */
--- a/libpurple/proxy.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/proxy.c Fri Jul 03 04:27:02 2009 +0000 @@ -403,7 +403,7 @@ MyWinHttpGetIEProxyConfig = (LPFNWINHTTPGETIEPROXYCONFIG) wpurple_find_and_loadproc("winhttp.dll", "WinHttpGetIEProxyConfigForCurrentUser"); if (!MyWinHttpGetIEProxyConfig) - purple_debug_info("proxy", "Unable to read Windows Proxy Settings.\n"); + purple_debug_warning("proxy", "Unable to read Windows Proxy Settings.\n"); } if (!MyWinHttpGetIEProxyConfig) @@ -572,7 +572,7 @@ if (error_message != NULL) { - purple_debug_info("proxy", "Connection attempt failed: %s\n", + purple_debug_error("proxy", "Connection attempt failed: %s\n", error_message); if (connect_data->hosts != NULL) try_connect(connect_data); @@ -658,7 +658,7 @@ if (ret != 0 || error != 0) { if (ret != 0) error = errno; - purple_debug_info("proxy", "Error connecting to %s:%d (%s).\n", + purple_debug_error("proxy", "Error connecting to %s:%d (%s).\n", connect_data->host, connect_data->port, g_strerror(error)); purple_proxy_connect_data_disconnect(connect_data, g_strerror(error));
--- a/libpurple/stun.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/stun.c Fri Jul 03 04:27:02 2009 +0000 @@ -116,7 +116,7 @@ static gboolean timeoutfunc(gpointer data) { struct stun_conn *sc = data; if(sc->retry >= 2) { - purple_debug_info("stun", "request timed out, giving up.\n"); + purple_debug_warning("stun", "request timed out, giving up.\n"); if(sc->test == 2) nattype.type = PURPLE_STUN_NAT_TYPE_SYMMETRIC; @@ -176,19 +176,19 @@ len = recv(source, buffer, sizeof(buffer) - 1, 0); if (!len) { - purple_debug_info("stun", "unable to read stun response\n"); + purple_debug_warning("stun", "unable to read stun response\n"); return; } buffer[len] = '\0'; if (len < sizeof(struct stun_header)) { - purple_debug_info("stun", "got invalid response\n"); + purple_debug_warning("stun", "got invalid response\n"); return; } hdr = (struct stun_header*) buffer; if (len != (ntohs(hdr->len) + sizeof(struct stun_header))) { - purple_debug_info("stun", "got incomplete response\n"); + purple_debug_warning("stun", "got incomplete response\n"); return; } @@ -197,13 +197,13 @@ || hdr->transid[1] != sc->packet->transid[1] || hdr->transid[2] != sc->packet->transid[2] || hdr->transid[3] != sc->packet->transid[3]) { - purple_debug_info("stun", "got wrong transid\n"); + purple_debug_warning("stun", "got wrong transid\n"); return; } if(sc->test==1) { if (hdr->type != MSGTYPE_BINDINGRESPONSE) { - purple_debug_info("stun", + purple_debug_warning("stun", "Expected Binding Response, got %d\n", hdr->type); return;
--- a/libpurple/upnp.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/upnp.c Fri Jul 03 04:27:02 2009 +0000 @@ -807,7 +807,7 @@ control_info.internalip); close(source); } else - purple_debug_info("upnp", "Unable to look up local IP\n"); + purple_debug_error("upnp", "Unable to look up local IP\n"); }
--- a/libpurple/win32/win32dep.c Fri Jul 03 04:25:45 2009 +0000 +++ b/libpurple/win32/win32dep.c Fri Jul 03 04:27:02 2009 +0000 @@ -326,7 +326,7 @@ if (rv != ERROR_SUCCESS) { char *errmsg = g_win32_error_message(rv); - purple_debug_info("wpurple", "Could not open reg key '%s' subkey '%s'.\nMessage: (%ld) %s\n", + purple_debug_error("wpurple", "Could not open reg key '%s' subkey '%s'.\nMessage: (%ld) %s\n", ((rootkey == HKEY_LOCAL_MACHINE) ? "HKLM" : (rootkey == HKEY_CURRENT_USER) ? "HKCU" : (rootkey == HKEY_CLASSES_ROOT) ? "HKCR" : "???"), @@ -356,7 +356,7 @@ if (rv != ERROR_SUCCESS) { char *errmsg = g_win32_error_message(rv); - purple_debug_info("wpurple", "Could not read from reg key value '%s'.\nMessage: (%ld) %s\n", + purple_debug_error("wpurple", "Could not read from reg key value '%s'.\nMessage: (%ld) %s\n", valname, rv, errmsg); g_free(errmsg); }
--- a/pidgin/gtkprefs.c Fri Jul 03 04:25:45 2009 +0000 +++ b/pidgin/gtkprefs.c Fri Jul 03 04:27:02 2009 +0000 @@ -129,7 +129,8 @@ } static void -entry_set(GtkEntry *entry, gpointer data) { +entry_set(GtkEntry *entry, gpointer data) +{ const char *key = (const char*)data; purple_prefs_set_string(key, gtk_entry_get_text(entry)); @@ -341,7 +342,9 @@ } -static void smiley_sel(GtkTreeSelection *sel, GtkTreeModel *model) { +static void +smiley_sel(GtkTreeSelection *sel, GtkTreeModel *model) +{ GtkTreeIter iter; const char *themename; char *description; @@ -392,7 +395,8 @@ gtk_tree_path_free(path); } -static GtkTreeRowReference *theme_refresh_theme_list(void) +static GtkTreeRowReference * +theme_refresh_theme_list(void) { GdkPixbuf *pixbuf; GSList *themes; @@ -452,7 +456,7 @@ /* Rebuild the markup for the sound theme selection for "(Custom)" themes */ static void -pref_sound_generate_markup() +pref_sound_generate_markup(void) { gboolean print_custom, customized; const gchar *name, *author, *description, *current_theme; @@ -567,7 +571,7 @@ } static void -prefs_themes_refresh() +prefs_themes_refresh(void) { GdkPixbuf *pixbuf = NULL; gchar *filename; @@ -611,7 +615,7 @@ /* init all the theme variables so that the themes can be sorted later and used by pref pages */ static void -prefs_themes_init() +prefs_themes_init(void) { prefs_sound_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); @@ -645,29 +649,30 @@ static gboolean purple_theme_file_copy(const gchar *source, const gchar *destination) { - FILE *src, *dest; - gint chr = EOF; - - if(!(src = g_fopen(source, "rb"))) - return FALSE; - if(!(dest = g_fopen(destination, "wb"))) { + FILE *src, *dest; + gint chr = EOF; + + if(!(src = g_fopen(source, "rb"))) + return FALSE; + if(!(dest = g_fopen(destination, "wb"))) { fclose(src); - return FALSE; + return FALSE; } - while((chr = fgetc(src)) != EOF) { - fputc(chr, dest); - } - - fclose(dest); - fclose(src); - - return TRUE; + while((chr = fgetc(src)) != EOF) { + fputc(chr, dest); + } + + fclose(dest); + fclose(src); + + return TRUE; } /* installs a theme, info is freed by function */ static void -theme_install_theme(char *path, struct theme_info *info) { +theme_install_theme(char *path, struct theme_info *info) +{ #ifndef _WIN32 gchar *command; #endif @@ -1023,7 +1028,7 @@ info->extension = NULL; info->original_name = NULL; - theme_install_theme(theme_file_name, info) ; + theme_install_theme(theme_file_name, info); g_free(info); } @@ -1031,7 +1036,7 @@ static void add_theme_button_clicked_cb(GtkWidget *widget, gpointer user_data) { - purple_request_file(NULL, _("Install Theme"), NULL, FALSE, (GCallback)request_theme_file_name_cb, NULL, NULL, NULL, NULL, NULL) ; + purple_request_file(NULL, _("Install Theme"), NULL, FALSE, (GCallback)request_theme_file_name_cb, NULL, NULL, NULL, NULL, NULL); } static void @@ -1447,7 +1452,7 @@ _("Never"), "never", NULL); gtk_size_group_add_widget(sg, label); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); vbox = pidgin_make_frame(ret, _("Conversation Window Hiding")); label = pidgin_prefs_dropdown(vbox, _("_Hide new IM conversations:"), @@ -1457,7 +1462,7 @@ _("Always"), "always", NULL); gtk_size_group_add_widget(sg, label); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); /* All the tab options! */ @@ -1475,7 +1480,7 @@ purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/conversations/tabs", conversation_usetabs_cb, vbox2); if (!purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/conversations/tabs")) - gtk_widget_set_sensitive(vbox2, FALSE); + gtk_widget_set_sensitive(vbox2, FALSE); pidgin_prefs_checkbox(_("Show close b_utton on tabs"), PIDGIN_PREFS_ROOT "/conversations/close_on_tabs", vbox2); @@ -1492,7 +1497,7 @@ #endif NULL); gtk_size_group_add_widget(sg, label); - gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); + gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); names = pidgin_conv_placement_get_options(); label = pidgin_prefs_dropdown_from_list(vbox2, _("N_ew conversations:"), @@ -1503,10 +1508,8 @@ g_list_free(names); - keyboard_shortcuts(ret); - gtk_widget_show_all(ret); g_object_unref(sg); return ret; @@ -1633,18 +1636,87 @@ return ret; } -static void network_ip_changed(GtkEntry *entry, gpointer data) +/* This isn't a very strict check, but should give the user a clue. */ +static gboolean +verify_ip_address(const gchar *text) { - /* - * TODO: It would be nice if we could validate this and show a - * red background in the box when the IP address is invalid - * and a green background when the IP address is valid. - */ - purple_network_set_public_ip(gtk_entry_get_text(entry)); + char *tmp; + long octet; + + if (!text && !isdigit(*text)) + return FALSE; + + tmp = NULL; + octet = strtol(text, &tmp, 10); + if (octet < 0 || octet > 255) + return FALSE; + + if (!tmp || *tmp != '.') + return FALSE; + + text = tmp + 1; + if (!isdigit(*text)) + return FALSE; + + tmp = NULL; + octet = strtol(text, &tmp, 10); + if (octet < 0 || octet > 255) + return FALSE; + + if (!tmp || *tmp != '.') + return FALSE; + + text = tmp + 1; + if (!isdigit(*text)) + return FALSE; + + tmp = NULL; + octet = strtol(text, &tmp, 10); + if (octet < 0 || octet > 255) + return FALSE; + + text = tmp + 1; + if (!isdigit(*text)) + return FALSE; + + tmp = NULL; + octet = strtol(text, &tmp, 10); + if (octet < 0 || octet > 255) + return FALSE; + + if (!tmp || *tmp != '\0') + return FALSE; + + return TRUE; } -static gboolean network_stun_server_changed_cb(GtkWidget *widget, - GdkEventFocus *event, gpointer data) +static void +network_ip_changed(GtkEntry *entry, gpointer data) +{ + const gchar *text = gtk_entry_get_text(entry); + GdkColor color; + + if (verify_ip_address(text)) + { + color.red = 0xAFFF; + color.green = 0xFFFF; + color.blue = 0xAFFF; + + purple_network_set_public_ip(text); + } + else + { + color.red = 0xFFFF; + color.green = 0xAFFF; + color.blue = 0xAFFF; + } + + gtk_widget_modify_base(GTK_WIDGET(entry), GTK_STATE_NORMAL, &color); +} + +static gboolean +network_stun_server_changed_cb(GtkWidget *widget, + GdkEventFocus *event, gpointer data) { GtkEntry *entry = GTK_ENTRY(widget); purple_prefs_set_string("/purple/network/stun_server", @@ -1654,8 +1726,9 @@ return FALSE; } -static gboolean network_turn_server_changed_cb(GtkWidget *widget, - GdkEventFocus *event, gpointer data) +static gboolean +network_turn_server_changed_cb(GtkWidget *widget, + GdkEventFocus *event, gpointer data) { GtkEntry *entry = GTK_ENTRY(widget); purple_prefs_set_string("/purple/network/turn_server", @@ -1678,7 +1751,8 @@ gtk_widget_hide(frame); } -static void proxy_print_option(GtkEntry *entry, int entrynum) +static void +proxy_print_option(GtkEntry *entry, int entrynum) { if (entrynum == PROXYHOST) purple_prefs_set_string("/purple/proxy/host", gtk_entry_get_text(entry)); @@ -2017,7 +2091,9 @@ } #ifndef _WIN32 -static gboolean manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) { +static gboolean +manual_browser_set(GtkWidget *entry, GdkEventFocus *event, gpointer data) +{ const char *program = gtk_entry_get_text(GTK_ENTRY(entry)); purple_prefs_set_path(PIDGIN_PREFS_ROOT "/browsers/command", program); @@ -2026,7 +2102,8 @@ return FALSE; } -static GList *get_available_browsers(void) +static GList * +get_available_browsers(void) { struct browser { char *name; @@ -2193,7 +2270,8 @@ } #ifndef _WIN32 -static gint sound_cmd_yeah(GtkEntry *entry, gpointer d) +static gint +sound_cmd_yeah(GtkEntry *entry, gpointer d) { purple_prefs_set_path(PIDGIN_PREFS_ROOT "/sound/command", gtk_entry_get_text(GTK_ENTRY(entry))); @@ -2325,7 +2403,8 @@ pref_sound_generate_markup(); } -static void select_sound(GtkWidget *button, gpointer being_NULL_is_fun) +static void +select_sound(GtkWidget *button, gpointer being_NULL_is_fun) { gchar *pref; const char *filename; @@ -2345,7 +2424,8 @@ } #ifdef USE_GSTREAMER -static gchar* prefs_sound_volume_format(GtkScale *scale, gdouble val) +static gchar * +prefs_sound_volume_format(GtkScale *scale, gdouble val) { if(val < 15) { return g_strdup_printf(_("Quietest")); @@ -2364,14 +2444,17 @@ } } -static void prefs_sound_volume_changed(GtkRange *range) +static void +prefs_sound_volume_changed(GtkRange *range) { int val = (int)gtk_range_get_value(GTK_RANGE(range)); purple_prefs_set_int(PIDGIN_PREFS_ROOT "/sound/volume", val); } #endif -static void prefs_sound_sel(GtkTreeSelection *sel, GtkTreeModel *model) { +static void +prefs_sound_sel(GtkTreeSelection *sel, GtkTreeModel *model) +{ GtkTreeIter iter; GValue val; const char *file; @@ -2725,9 +2808,9 @@ static int prefs_notebook_add_page(const char *text, - GtkWidget *page, - int ind) { - + GtkWidget *page, + int ind) +{ #if GTK_CHECK_VERSION(2,4,0) return gtk_notebook_append_page(GTK_NOTEBOOK(prefsnotebook), page, gtk_label_new(text)); #else @@ -2736,7 +2819,9 @@ #endif } -static void prefs_notebook_init(void) { +static void +prefs_notebook_init(void) +{ prefs_notebook_add_page(_("Interface"), interface_page(), notebook_page++); prefs_notebook_add_page(_("Conversations"), conv_page(), notebook_page++); prefs_notebook_add_page(_("Smiley Themes"), theme_page(), notebook_page++); @@ -2753,7 +2838,8 @@ prefs_notebook_add_page(_("Status / Idle"), away_page(), notebook_page++); } -void pidgin_prefs_show(void) +void +pidgin_prefs_show(void) { GtkWidget *vbox; GtkWidget *notebook; @@ -2875,7 +2961,8 @@ pidgin_prefs_update_old(); } -void pidgin_prefs_update_old() +void +pidgin_prefs_update_old(void) { const char *str;
--- a/pidgin/gtksmiley.c Fri Jul 03 04:25:45 2009 +0000 +++ b/pidgin/gtksmiley.c Fri Jul 03 04:27:02 2009 +0000 @@ -49,6 +49,7 @@ GdkPixbuf *custom_pixbuf; gpointer data; /** @since 2.6.0 */ gsize datasize; /** @since 2.6.0 */ + gint entry_len; /** @since 2.6.0 */ }; typedef struct @@ -226,18 +227,6 @@ PurpleSmiley *emoticon; entry = gtk_entry_get_text(GTK_ENTRY(s->smile)); - if (!entry || !*entry) { - /* - * TODO: We should enable/disable the add button based on - * whether the user has entered all required data. That - * would eliminate the need for this check and provide a - * better user experience. - */ - purple_notify_error(s->parent, _("Custom Smiley"), - _("More Data needed"), - _("Please provide a shortcut to associate with the smiley.")); - return; - } emoticon = purple_smileys_find_by_shortcut(entry); if (emoticon && emoticon != s->smiley) { @@ -267,15 +256,6 @@ } purple_smiley_set_shortcut(s->smiley, entry); } else { - if ((s->filename == NULL && s->custom_pixbuf == NULL) - || *entry == 0) { - purple_notify_error(s->parent, _("Custom Smiley"), - _("More Data needed"), - s->filename ? _("Please provide a shortcut to associate with the smiley.") - : _("Please select an image for the smiley.")); - return; - } - purple_debug_info("gtksmiley", "adding a new smiley\n"); if (s->filename == NULL) { @@ -355,6 +335,9 @@ if (pixbuf) g_object_unref(G_OBJECT(pixbuf)); gtk_widget_grab_focus(s->smile); + + if (s->entry_len > 0) + gtk_dialog_set_response_sensitive(GTK_DIALOG(s->parent), GTK_RESPONSE_ACCEPT, TRUE); } static void @@ -368,6 +351,36 @@ gtk_widget_show_all(file_chooser); } +static void +smiley_name_insert_cb(GtkEditable *editable, + gchar *new_text, + gint new_text_length, + gint *position, + gpointer user_data) +{ + PidginSmiley *s = user_data; + if (new_text_length != -1) + s->entry_len += new_text_length; + else + s->entry_len += strlen(new_text); + + if (s->filename != NULL || s->custom_pixbuf != NULL || s->smiley != NULL) + gtk_dialog_set_response_sensitive(GTK_DIALOG(s->parent), GTK_RESPONSE_ACCEPT, TRUE); +} + +static void +smiley_name_delete_cb(GtkEditable *editable, + gint start_pos, + gint end_pos, + gpointer user_data) +{ + PidginSmiley *s = user_data; + s->entry_len -= end_pos - start_pos; + + if (s->entry_len <= 0) + gtk_dialog_set_response_sensitive(GTK_DIALOG(s->parent), GTK_RESPONSE_ACCEPT, FALSE); +} + PidginSmiley * pidgin_smiley_edit(GtkWidget *widget, PurpleSmiley *smiley) { @@ -392,6 +405,7 @@ gtk_container_set_border_width(GTK_CONTAINER(window), PIDGIN_HIG_BORDER); + gtk_dialog_set_default_response(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT); g_signal_connect(window, "response", G_CALLBACK(do_add_select_cb), s); /* The vbox */ @@ -441,10 +455,17 @@ s->smile = gtk_entry_new(); gtk_entry_set_activates_default(GTK_ENTRY(s->smile), TRUE); pidgin_set_accessible_label(s->smile, label); - if (smiley) - gtk_entry_set_text(GTK_ENTRY(s->smile), purple_smiley_get_shortcut(smiley)); + if (smiley) { + const char *shortcut = purple_smiley_get_shortcut(smiley); + gtk_entry_set_text(GTK_ENTRY(s->smile), shortcut); + s->entry_len = strlen(shortcut); + } + else + gtk_dialog_set_response_sensitive(GTK_DIALOG(window), GTK_RESPONSE_ACCEPT, FALSE); - g_signal_connect(s->smile, "activate", G_CALLBACK(do_add), s); + /* gtk_entry_get_text_length is 2.14+, so we'll just keep track ourselves */ + g_signal_connect(G_OBJECT(s->smile), "insert-text", G_CALLBACK(smiley_name_insert_cb), s); + g_signal_connect(G_OBJECT(s->smile), "delete-text", G_CALLBACK(smiley_name_delete_cb), s); gtk_box_pack_end(GTK_BOX(hbox), s->smile, FALSE, FALSE, 0); gtk_widget_show(s->smile); @@ -470,8 +491,15 @@ if (editor->custom_pixbuf) g_object_unref(G_OBJECT(editor->custom_pixbuf)); editor->custom_pixbuf = image ? g_object_ref(G_OBJECT(image)) : NULL; - if (image) + if (image) { gtk_image_set_from_pixbuf(GTK_IMAGE(editor->smiley_image), image); + if (editor->entry_len > 0) + gtk_dialog_set_response_sensitive(GTK_DIALOG(editor->parent), + GTK_RESPONSE_ACCEPT, TRUE); + } + else + gtk_dialog_set_response_sensitive(GTK_DIALOG(editor->parent), + GTK_RESPONSE_ACCEPT, FALSE); } void
--- a/pidgin/plugins/themeedit-icon.c Fri Jul 03 04:25:45 2009 +0000 +++ b/pidgin/plugins/themeedit-icon.c Fri Jul 03 04:27:02 2009 +0000 @@ -237,6 +237,8 @@ { GtkWidget *win = pidgin_buddy_icon_chooser_new(GTK_WINDOW(gtk_widget_get_toplevel(widget)), stock_icon_selected, image); + gtk_window_set_title(GTK_WINDOW(win), + g_object_get_data(G_OBJECT(image), "localized-name")); gtk_widget_show_all(win); return TRUE; @@ -279,6 +281,7 @@ g_signal_connect(G_OBJECT(ebox), "button-press-event", G_CALLBACK(change_stock_image), image); g_object_set_data(G_OBJECT(image), "property-name", (gpointer)id); + g_object_set_data(G_OBJECT(image), "localized-name", (gpointer)text); gtk_size_group_add_widget(sizegroup, label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);