[Pidgin] #2767: per-conversation/chat mute option
Pidgin
trac at pidgin.im
Sun Aug 26 14:35:59 EDT 2007
#2767: per-conversation/chat mute option
----------------------------------+-----------------------------------------
Reporter: lschiere | Owner: sadrul
Type: enhancement | Status: closed
Priority: minor | Milestone: 2.2.0
Component: finch (gnt/ncurses) | Version: 2.1.1
Resolution: fixed | Keywords:
Pending: 0 |
----------------------------------+-----------------------------------------
Changes (by sadrul at pidgin.im):
* milestone: 2.1.2 => 2.2.0
Comment:
(In [528a0578e6355b12b7e4198d2248e81d5cd219b2]) Fix #2767 (per-
conversation/chat mute option).My limited testing makes me think it's
working!============================================================---
finch/gntconv.c 1040461cd217ab7d5799f941b2d81a6c7eef0614+++
finch/gntconv.c 52914b261007386aecf0d351e61f7df23f7ed367@@ -37,6 +37,7
@@ #include "gntdebug.h" #include "gntplugin.h" #include
"gntprefs.h"+#include "gntsound.h" #include "gntstatus.h" #include
"gntpounce.h" @@ -387,6 +388,13 @@ static void } static
void+toggle_sound_cb(GntMenuItem *item, gpointer ggconv)+{+ FinchConv *fc
= ggconv;+ fc->flags ^= FINCH_CONV_NO_SOUND;+}++static void
send_to_cb(GntMenuItem *m, gpointer n) { PurpleAccount *account =
g_object_get_data(G_OBJECT(m), "purple_account");@@ -498,6 +506,12 @@
gg_create_menu(FinchConv *ggc)
purple_conversation_is_logging(ggc->active_conv));
gnt_menu_add_item(GNT_MENU(sub), item);
gnt_menuitem_set_callback(item, toggle_logging_cb, ggc);++ item =
gnt_menuitem_check_new(_("Enable Sounds"));+
gnt_menuitem_check_set_checked(GNT_MENU_ITEM_CHECK(item),+
!(ggc->flags & FINCH_CONV_NO_SOUND));+ gnt_menu_add_item(GNT_MENU(sub),
item);+ gnt_menuitem_set_callback(item, toggle_sound_cb, ggc); }
static void@@ -638,6 +652,9 @@ finch_create_conversation(PurpleConversa
g_signal_connect(G_OBJECT(ggc->entry), "text_changed",
G_CALLBACK(send_typing_notification), ggc); } + if
(!finch_sound_is_enabled())+ ggc->flags |= FINCH_CONV_NO_SOUND;+
gg_create_menu(ggc);
g_free(title);============================================================---
finch/gntconv.h 560be2d4d0d4ce285df499c615fb421fc14a0c4b+++
finch/gntconv.h dc8aa760d94b8c6756f5cbbb507dce7dfa7396a5@@ -43,6
+43,11 @@ typedef struct _FinchConvIm FinchConvIm; typedef struct
_FinchConvChat FinchConvChat; typedef struct _FinchConvIm FinchConvIm;
+typedef enum+{+ FINCH_CONV_NO_SOUND = 1 << 0,+}
FinchConversationFlag;+ struct _FinchConv { GList *list;@@ -53,7
+58,7 @@ struct _FinchConv GntWidget *tv; /* text-view
*/ GntWidget *menu; GntWidget *info;- void *pad;+
FinchConversationFlag flags; union
{============================================================---
finch/gntsound.c 05528d8844f0181f05387ea1e02c60646f393868+++
finch/gntsound.c da9f4852b5eb8906d828af511a1fec7aaa84b8bf@@ -40,6 +40,8
@@ #include "sound.h" #include "util.h" +#include "gntconv.h"+ #include
"gntbox.h" #include "gntwindow.h" #include "gntcombobox.h"@@ -173,7 +175,8
@@ play_conv_event(PurpleConversation *conv has_focus =
purple_conversation_has_focus(conv); - if (has_focus &&
!purple_prefs_get_bool(make_pref("/conv_focus")))+ if
((gntconv->flags & FINCH_CONV_NO_SOUND) ||+ (has_focus &&
!purple_prefs_get_bool(make_pref("/conv_focus")))) {
return; }@@ -1061,8 +1064,23 @@
finch_sounds_show_all(void)
load_pref_window(finch_sound_get_active_profile());
gnt_widget_show(win);-} +} +gboolean finch_sound_is_enabled(void)+{+
const char *pref = make_pref("/method");+ const char *method =
purple_prefs_get_string(pref);++ if (!method)+ return FALSE;+
if (strcmp(method, "nosound") == 0)+ return FALSE;+ if
(purple_prefs_get_int(make_pref("/volume")) <= 0)+ return
FALSE;++ return TRUE;+}+ static PurpleSoundUiOps sound_ui_ops = {
finch_sound_init,============================================================---
finch/gntsound.h 35deaf5d7911249519d039752bd42e51d013f355+++
finch/gntsound.h d2bffa711f82d969465ba8d376ccd83dc2105c7e@@ -55,6
+55,14 @@ GList *finch_sound_get_profiles(void); GList
*finch_sound_get_profiles(void); /**+ * Determine whether any sound will
be played or not.+ *+ * @return Returns FALSE if preference is set to 'No
sound', or if volume is+ * set to zero.+ */+gboolean
finch_sound_is_enabled(void);++/** * Gets GNT sound UI ops. * * @return
The UI operations structure.
--
Ticket URL: </ticket/2767#comment:2>
Pidgin <http://pidgin.im>
Pidgin
More information about the Tracker
mailing list