Mercurial > pidgin.yaz
changeset 25208:447f3c24cbc9
propagate from branch 'im.pidgin.pidgin' (head b14102a6c681b35084d2c3f7726de34d4f859fe1)
to branch 'im.pidgin.cpw.malu.xmpp.ibb_ft' (head 1004ee62a91cd7c1f39c9d5aafdbe4de761879b0)
author | Marcus Lundblad <ml@update.uu.se> |
---|---|
date | Sat, 13 Sep 2008 23:25:34 +0000 |
parents | b4ec5481a67a (current diff) 3b4dfbcabbf9 (diff) |
children | 4d6d7aeb3150 |
files | |
diffstat | 2 files changed, 46 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/plugins/autoaccept.c Sat Sep 06 07:49:05 2008 +0000 +++ b/libpurple/plugins/autoaccept.c Sat Sep 13 23:25:34 2008 +0000 @@ -117,6 +117,9 @@ { int count = 1; const char *escape; + gchar **name_and_ext; + const gchar *name; + gchar *ext; if (purple_prefs_get_bool(PREF_NEWDIR)) dirname = g_build_filename(pref, purple_normalize(account, xfer->who), NULL); @@ -132,9 +135,24 @@ escape = purple_escape_filename(xfer->filename); filename = g_build_filename(dirname, escape, NULL); + /* Split at the first dot, to avoid uniquifying "foo.tar.gz" to "foo.tar-2.gz" */ + name_and_ext = g_strsplit(escape, ".", 2); + name = name_and_ext[0]; + g_return_if_fail(name != NULL); + if (name_and_ext[1] != NULL) { + /* g_strsplit does not include the separator in each chunk. */ + ext = g_strdup_printf(".%s", name_and_ext[1]); + } else { + ext = g_strdup(""); + } + /* Make sure the file doesn't exist. Do we want some better checking than this? */ + /* FIXME: There is a race here: if the newly uniquified file name gets created between + * this g_file_test and the transfer starting, the file created in the meantime + * will be clobbered. But it's not at all straightforward to fix. + */ while (g_file_test(filename, G_FILE_TEST_EXISTS)) { - char *file = g_strdup_printf("%s-%d", escape, count++); + char *file = g_strdup_printf("%s-%d%s", name, count++, ext); g_free(filename); filename = g_build_filename(dirname, file, NULL); g_free(file); @@ -142,6 +160,8 @@ purple_xfer_request_accepted(xfer, filename); + g_strfreev(name_and_ext); + g_free(ext); g_free(dirname); g_free(filename); }
--- a/pidgin/gtkprefs.c Sat Sep 06 07:49:05 2008 +0000 +++ b/pidgin/gtkprefs.c Sat Sep 13 23:25:34 2008 +0000 @@ -1828,6 +1828,25 @@ g_value_unset (&val); } + +static void +mute_changed_cb(const char *pref_name, + PurplePrefType pref_type, + gconstpointer val, + gpointer data) +{ + GtkToggleButton *button = data; + gboolean muted = val; + + g_return_if_fail(!strcmp (pref_name, PIDGIN_PREFS_ROOT "/sound/mute")); + + /* Block the handler that re-sets the preference. */ + g_signal_handlers_block_matched(button, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pref_name); + gtk_toggle_button_set_active (button, muted); + g_signal_handlers_unblock_matched(button, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, pref_name); +} + + static GtkWidget * sound_page(void) { @@ -1889,9 +1908,13 @@ #endif /* _WIN32 */ vbox = pidgin_make_frame (ret, _("Sound Options")); + + button = pidgin_prefs_checkbox(_("M_ute sounds"), PIDGIN_PREFS_ROOT "/sound/mute", vbox); + purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/sound/mute", mute_changed_cb, button); + pidgin_prefs_checkbox(_("Sounds when conversation has _focus"), PIDGIN_PREFS_ROOT "/sound/conv_focus", vbox); - pidgin_prefs_dropdown(vbox, _("Enable sounds:"), + pidgin_prefs_dropdown(vbox, _("_Enable sounds:"), PURPLE_PREF_INT, "/purple/sound/while_status", _("Only when available"), 1, _("Only when not available"), 2, @@ -1908,7 +1931,7 @@ g_signal_connect (G_OBJECT (sw), "value-changed", G_CALLBACK (prefs_sound_volume_changed), NULL); - hbox = pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("Volume:"), NULL, sw, TRUE, NULL); + hbox = pidgin_add_widget_to_vbox(GTK_BOX(vbox), _("V_olume:"), NULL, sw, TRUE, NULL); purple_prefs_connect_callback(prefs, PIDGIN_PREFS_ROOT "/sound/method", sound_changed3_cb, hbox);