annotate finch/gntmedia.c @ 27628:aac28ab73e9e

if I return FALSE to remove the timeout handle, I should probably set timeout handle to 0 as well so we won't try to remove the non-existent handle later Refs #3330
author Ka-Hing Cheung <khc@hxbc.us>
date Sun, 19 Jul 2009 17:56:02 +0000
parents 2cd9560f9795
children c8ff0a9cf8cc 23dda7e57bcf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
1 /**
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
2 * @file gntmedia.c GNT Media API
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
3 * @ingroup finch
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
4 */
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
5
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
6 /* finch
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
7 *
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
8 * Finch is the legal property of its developers, whose names are too numerous
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
9 * to list here. Please refer to the COPYRIGHT file distributed with this
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
10 * source distribution.
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
11 *
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
12 * This program is free software; you can redistribute it and/or modify
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
13 * it under the terms of the GNU General Public License as published by
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
14 * the Free Software Foundation; either version 2 of the License, or
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
15 * (at your option) any later version.
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
16 *
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
17 * This program is distributed in the hope that it will be useful,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
20 * GNU General Public License for more details.
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
21 *
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
22 * You should have received a copy of the GNU General Public License
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
23 * along with this program; if not, write to the Free Software
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
25 */
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
26
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
27 #include "finch.h"
27623
2cd9560f9795 I blame Qulogic for not compiling with vv
Ka-Hing Cheung <khc@hxbc.us>
parents: 26539
diff changeset
28 #include <internal.h>
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
29 #include "gntconv.h"
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
30 #include "gntmedia.h"
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
31
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
32 #include "gnt.h"
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
33 #include "gntbutton.h"
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
34 #include "gntbox.h"
23794
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
35 #include "gntlabel.h"
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
36
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
37 #include "cmds.h"
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
38 #include "conversation.h"
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
39 #include "debug.h"
26349
1ae3af12095a Move GStreamer related media functions into its own header.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26344
diff changeset
40 #include "mediamanager.h"
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
41
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
42 /* An incredibly large part of the following is from gtkmedia.c */
23804
cbe97caec684 Use USE_VV instead of USE_FARSIGHT.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23800
diff changeset
43 #ifdef USE_VV
26539
4f2f5659aa0d Fix build with --disable-gstreamer.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26524
diff changeset
44 #include "media-gst.h"
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
45
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
46 #undef hangup
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
47
26376
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
48 #define FINCH_TYPE_MEDIA (finch_media_get_type())
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
49 #define FINCH_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), FINCH_TYPE_MEDIA, FinchMedia))
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
50 #define FINCH_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), FINCH_TYPE_MEDIA, FinchMediaClass))
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
51 #define FINCH_IS_MEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), FINCH_TYPE_MEDIA))
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
52 #define FINCH_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), FINCH_TYPE_MEDIA))
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
53 #define FINCH_MEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), FINCH_TYPE_MEDIA, FinchMediaClass))
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
54
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
55 typedef struct _FinchMedia FinchMedia;
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
56 typedef struct _FinchMediaClass FinchMediaClass;
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
57 typedef struct _FinchMediaPrivate FinchMediaPrivate;
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
58 typedef enum _FinchMediaState FinchMediaState;
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
59
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
60 struct _FinchMediaClass
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
61 {
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
62 GntBoxClass parent_class;
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
63 };
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
64
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
65 struct _FinchMedia
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
66 {
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
67 GntBox parent;
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
68 FinchMediaPrivate *priv;
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
69 };
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
70
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
71 struct _FinchMediaPrivate
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
72 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
73 PurpleMedia *media;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
74
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
75 GntWidget *accept;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
76 GntWidget *reject;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
77 GntWidget *hangup;
23794
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
78 GntWidget *calling;
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
79
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
80 PurpleConversation *conv;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
81 };
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
82
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
83 #define FINCH_MEDIA_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), FINCH_TYPE_MEDIA, FinchMediaPrivate))
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
84
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
85 static void finch_media_class_init (FinchMediaClass *klass);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
86 static void finch_media_init (FinchMedia *media);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
87 static void finch_media_finalize (GObject *object);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
88 static void finch_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
89 static void finch_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
90
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
91 static GntBoxClass *parent_class = NULL;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
92
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
93 enum {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
94 MESSAGE,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
95 LAST_SIGNAL
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
96 };
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
97 static guint finch_media_signals[LAST_SIGNAL] = {0};
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
98
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
99 enum {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
100 PROP_0,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
101 PROP_MEDIA,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
102 };
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
103
26378
e9e9ec08e87c Silence two more warnings.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26376
diff changeset
104 static GType
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
105 finch_media_get_type(void)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
106 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
107 static GType type = 0;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
108
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
109 if (type == 0) {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
110 static const GTypeInfo info = {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
111 sizeof(FinchMediaClass),
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
112 NULL,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
113 NULL,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
114 (GClassInitFunc) finch_media_class_init,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
115 NULL,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
116 NULL,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
117 sizeof(FinchMedia),
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
118 0,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
119 (GInstanceInitFunc) finch_media_init,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
120 NULL
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
121 };
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
122 type = g_type_register_static(GNT_TYPE_BOX, "FinchMedia", &info, 0);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
123 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
124 return type;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
125 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
126
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
127
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
128 static void
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
129 finch_media_class_init (FinchMediaClass *klass)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
130 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
131 GObjectClass *gobject_class = (GObjectClass*)klass;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
132 parent_class = g_type_class_peek_parent(klass);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
133
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
134 gobject_class->finalize = finch_media_finalize;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
135 gobject_class->set_property = finch_media_set_property;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
136 gobject_class->get_property = finch_media_get_property;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
137
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
138 g_object_class_install_property(gobject_class, PROP_MEDIA,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
139 g_param_spec_object("media",
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
140 "PurpleMedia",
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
141 "The PurpleMedia associated with this media.",
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
142 PURPLE_TYPE_MEDIA,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
143 G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
144
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
145 finch_media_signals[MESSAGE] = g_signal_new("message", G_TYPE_FROM_CLASS(klass),
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
146 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
147 g_cclosure_marshal_VOID__STRING,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
148 G_TYPE_NONE, 1, G_TYPE_STRING);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
149
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
150 g_type_class_add_private(klass, sizeof(FinchMediaPrivate));
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
151 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
152
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
153
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
154 static void
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
155 finch_media_init (FinchMedia *media)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
156 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
157 media->priv = FINCH_MEDIA_GET_PRIVATE(media);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
158
23794
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
159 media->priv->calling = gnt_label_new(_("Calling ... "));
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
160 media->priv->hangup = gnt_button_new(_("Hangup"));
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
161 media->priv->accept = gnt_button_new(_("Accept"));
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
162 media->priv->reject = gnt_button_new(_("Reject"));
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
163
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
164 gnt_box_set_alignment(GNT_BOX(media), GNT_ALIGN_MID);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
165
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
166 gnt_box_add_widget(GNT_BOX(media), media->priv->accept);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
167 gnt_box_add_widget(GNT_BOX(media), media->priv->reject);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
168 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
169
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
170 static void
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
171 finch_media_finalize (GObject *media)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
172 {
23917
4a208844bb63 Make voice calls work with Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
173 FinchMedia *gntmedia = FINCH_MEDIA(media);
4a208844bb63 Make voice calls work with Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
174 purple_debug_info("gntmedia", "finch_media_finalize\n");
4a208844bb63 Make voice calls work with Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
175 if (gntmedia->priv->media)
4a208844bb63 Make voice calls work with Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
176 g_object_unref(gntmedia->priv->media);
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
177 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
178
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
179 static void
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
180 finch_media_emit_message(FinchMedia *gntmedia, const char *msg)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
181 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
182 g_signal_emit(gntmedia, finch_media_signals[MESSAGE], 0, msg);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
183 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
184
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
185 static void
26371
12c7db418c3e Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26370
diff changeset
186 finch_media_connected_cb(PurpleMedia *media, FinchMedia *gntmedia)
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
187 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
188 GntWidget *parent;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
189
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
190 finch_media_emit_message(gntmedia, _("Call in progress."));
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
191
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
192 gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->accept);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
193 gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->reject);
23794
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
194 gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->hangup);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
195 gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->calling);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
196
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
197 gnt_box_add_widget(GNT_BOX(gntmedia), gntmedia->priv->hangup);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
198
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
199 gnt_widget_destroy(gntmedia->priv->accept);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
200 gnt_widget_destroy(gntmedia->priv->reject);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
201 gnt_widget_destroy(gntmedia->priv->calling);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
202 gntmedia->priv->accept = NULL;
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
203 gntmedia->priv->reject = NULL;
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
204 gntmedia->priv->calling = NULL;
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
205
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
206 parent = GNT_WIDGET(gntmedia);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
207 while (parent->parent)
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
208 parent = parent->parent;
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
209 gnt_box_readjust(GNT_BOX(parent));
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
210 gnt_widget_draw(parent);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
211 }
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
212
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
213 static void
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
214 finch_media_wait_cb(PurpleMedia *media, FinchMedia *gntmedia)
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
215 {
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
216 GntWidget *parent;
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
217
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
218 gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->accept);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
219 gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->reject);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
220 gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->hangup);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
221 gnt_box_remove(GNT_BOX(gntmedia), gntmedia->priv->calling);
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
222
52a753b67ebb Fine tune the media (audio) widget in finch.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23793
diff changeset
223 gnt_box_add_widget(GNT_BOX(gntmedia), gntmedia->priv->calling);
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
224 gnt_box_add_widget(GNT_BOX(gntmedia), gntmedia->priv->hangup);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
225
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
226 parent = GNT_WIDGET(gntmedia);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
227 while (parent->parent)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
228 parent = parent->parent;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
229 gnt_box_readjust(GNT_BOX(parent));
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
230 gnt_widget_draw(parent);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
231 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
232
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
233 static void
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26325
diff changeset
234 finch_media_state_changed_cb(PurpleMedia *media, PurpleMediaState state,
26036
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
235 gchar *sid, gchar *name, FinchMedia *gntmedia)
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
236 {
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26325
diff changeset
237 purple_debug_info("gntmedia", "state: %d sid: %s name: %s\n",
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26325
diff changeset
238 state, sid, name);
26036
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
239 if (sid == NULL && name == NULL) {
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26325
diff changeset
240 if (state == PURPLE_MEDIA_STATE_END) {
26036
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
241 finch_media_emit_message(gntmedia,
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
242 _("The call has been terminated."));
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
243 finch_conversation_set_info_widget(
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
244 gntmedia->priv->conv, NULL);
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
245 gnt_widget_destroy(GNT_WIDGET(gntmedia));
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
246 /*
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
247 * XXX: This shouldn't have to be here
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
248 * to free the FinchMedia widget.
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
249 */
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
250 g_object_unref(gntmedia);
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
251 }
26329
86bc2d34f689 Rename state-changed enum and values.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26325
diff changeset
252 } else if (state == PURPLE_MEDIA_STATE_CONNECTED) {
26371
12c7db418c3e Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26370
diff changeset
253 finch_media_connected_cb(media, gntmedia);
26394
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
254 } else if (state == PURPLE_MEDIA_STATE_NEW &&
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
255 sid != NULL && name != NULL &&
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
256 purple_media_is_initiator(media, sid, name) == FALSE) {
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26436
diff changeset
257 PurpleAccount *account;
26394
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
258 PurpleBuddy *buddy;
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
259 const gchar *alias;
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
260 PurpleMediaSessionType type =
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
261 purple_media_get_session_type(media, sid);
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
262 gchar *message = NULL;
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
263
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26436
diff changeset
264 account = purple_media_get_account(gntmedia->priv->media);
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26436
diff changeset
265 buddy = purple_find_buddy(account, name);
26394
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
266 alias = buddy ? purple_buddy_get_contact_alias(buddy) : name;
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
267
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
268 if (type & PURPLE_MEDIA_AUDIO) {
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
269 message = g_strdup_printf(
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
270 _("%s wishes to start an audio session with you."),
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
271 alias);
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
272 } else {
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
273 message = g_strdup_printf(
26436
28f1512b0f94 Minor grammatical message fixes.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26417
diff changeset
274 _("%s is trying to start an unsupported media session type with you."),
26394
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
275 alias);
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
276 }
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
277 finch_media_emit_message(gntmedia, message);
c3cf43b9402f Say which media type is being requested in Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26392
diff changeset
278 g_free(message);
26036
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
279 }
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
280 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
281
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
282 static void
26325
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
283 finch_media_stream_info_cb(PurpleMedia *media, PurpleMediaInfoType type,
26366
4e1286e76f1f Create purple_media_stream_info. Add local parameter to stream-info signal.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26365
diff changeset
284 gchar *sid, gchar *name, gboolean local, FinchMedia *gntmedia)
26325
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
285 {
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
286 if (type == PURPLE_MEDIA_INFO_REJECT) {
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
287 finch_media_emit_message(gntmedia,
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
288 _("You have rejected the call."));
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
289 }
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
290 }
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
291
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
292 static void
26371
12c7db418c3e Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26370
diff changeset
293 finch_media_accept_cb(PurpleMedia *media, GntWidget *widget)
12c7db418c3e Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26370
diff changeset
294 {
12c7db418c3e Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26370
diff changeset
295 purple_media_stream_info(media, PURPLE_MEDIA_INFO_ACCEPT,
12c7db418c3e Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26370
diff changeset
296 NULL, NULL, TRUE);
12c7db418c3e Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26370
diff changeset
297 }
12c7db418c3e Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26370
diff changeset
298
12c7db418c3e Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26370
diff changeset
299 static void
26369
2862fee7acf2 Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
300 finch_media_hangup_cb(PurpleMedia *media, GntWidget *widget)
2862fee7acf2 Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
301 {
2862fee7acf2 Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
302 purple_media_stream_info(media, PURPLE_MEDIA_INFO_HANGUP,
2862fee7acf2 Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
303 NULL, NULL, TRUE);
2862fee7acf2 Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
304 }
2862fee7acf2 Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
305
2862fee7acf2 Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
306 static void
26370
c0846d6659c6 Remove purple_media_reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26369
diff changeset
307 finch_media_reject_cb(PurpleMedia *media, GntWidget *widget)
c0846d6659c6 Remove purple_media_reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26369
diff changeset
308 {
c0846d6659c6 Remove purple_media_reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26369
diff changeset
309 purple_media_stream_info(media, PURPLE_MEDIA_INFO_REJECT,
c0846d6659c6 Remove purple_media_reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26369
diff changeset
310 NULL, NULL, TRUE);
c0846d6659c6 Remove purple_media_reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26369
diff changeset
311 }
c0846d6659c6 Remove purple_media_reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26369
diff changeset
312
c0846d6659c6 Remove purple_media_reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26369
diff changeset
313 static void
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
314 finch_media_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
315 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
316 FinchMedia *media;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
317 g_return_if_fail(FINCH_IS_MEDIA(object));
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
318
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
319 media = FINCH_MEDIA(object);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
320 switch (prop_id) {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
321 case PROP_MEDIA:
26036
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
322 {
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
323 if (media->priv->media)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
324 g_object_unref(media->priv->media);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
325 media->priv->media = g_value_get_object(value);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
326 g_object_ref(media->priv->media);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
327 g_signal_connect_swapped(G_OBJECT(media->priv->accept), "activate",
26371
12c7db418c3e Remove purple_media_accept.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26370
diff changeset
328 G_CALLBACK(finch_media_accept_cb), media->priv->media);
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
329 g_signal_connect_swapped(G_OBJECT(media->priv->reject), "activate",
26370
c0846d6659c6 Remove purple_media_reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26369
diff changeset
330 G_CALLBACK(finch_media_reject_cb), media->priv->media);
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
331 g_signal_connect_swapped(G_OBJECT(media->priv->hangup), "activate",
26369
2862fee7acf2 Remove purple_media_hangup.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26366
diff changeset
332 G_CALLBACK(finch_media_hangup_cb), media->priv->media);
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
333
26384
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26379
diff changeset
334 if (purple_media_is_initiator(media->priv->media,
bea334b214fa Add purple_media_is_initiator.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26379
diff changeset
335 NULL, NULL) == TRUE) {
26036
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
336 finch_media_wait_cb(media->priv->media, media);
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
337 }
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
338 g_signal_connect(G_OBJECT(media->priv->media), "state-changed",
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
339 G_CALLBACK(finch_media_state_changed_cb), media);
26325
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
340 g_signal_connect(G_OBJECT(media->priv->media), "stream-info",
31236ac583ef Use stream-info instead of state-changed for reject.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26040
diff changeset
341 G_CALLBACK(finch_media_stream_info_cb), media);
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
342 break;
26036
bc22d0a449dd Update Finch to new media API.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24983
diff changeset
343 }
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
344 default:
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
345 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
346 break;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
347 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
348 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
349
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
350 static void
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
351 finch_media_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
352 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
353 FinchMedia *media;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
354 g_return_if_fail(FINCH_IS_MEDIA(object));
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
355
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
356 media = FINCH_MEDIA(object);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
357
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
358 switch (prop_id) {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
359 case PROP_MEDIA:
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
360 g_value_set_object(value, media->priv->media);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
361 break;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
362 default:
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
363 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
364 break;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
365 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
366 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
367
26378
e9e9ec08e87c Silence two more warnings.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26376
diff changeset
368 static GntWidget *
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
369 finch_media_new(PurpleMedia *media)
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
370 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
371 return GNT_WIDGET(g_object_new(finch_media_get_type(),
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
372 "media", media,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
373 "vertical", FALSE,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
374 "homogeneous", FALSE,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
375 NULL));
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
376 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
377
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
378 static void
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
379 gntmedia_message_cb(FinchMedia *gntmedia, const char *msg, PurpleConversation *conv)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
380 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
381 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
382 purple_conv_im_write(PURPLE_CONV_IM(conv), NULL, msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
383 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
384 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
385
23872
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23859
diff changeset
386 static gboolean
24983
18b71033ea6e Remove connection attribute from PurpleMedia.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 24976
diff changeset
387 finch_new_media(PurpleMediaManager *manager, PurpleMedia *media,
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26436
diff changeset
388 PurpleAccount *account, gchar *name, gpointer null)
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
389 {
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
390 GntWidget *gntmedia;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
391 PurpleConversation *conv;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
392
26524
df9042312063 Switch media to store accounts rather than connections.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26436
diff changeset
393 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name);
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
394
23821
12a16471f94e Refactored PurpleMedia to make creating audio or video sessions virtually identical. Audio, video, and audio/video sessions now work. Also added videotestsrc to the video plugin preference.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23804
diff changeset
395 gntmedia = finch_media_new(media);
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
396 g_signal_connect(G_OBJECT(gntmedia), "message", G_CALLBACK(gntmedia_message_cb), conv);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
397 FINCH_MEDIA(gntmedia)->priv->conv = conv;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
398 finch_conversation_set_info_widget(conv, gntmedia);
23872
1d9a2296d5d2 Stop additional media sessions within a single conversation for grouped contacts.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23859
diff changeset
399 return TRUE;
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
400 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
401
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
402 static PurpleCmdRet
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
403 call_cmd_cb(PurpleConversation *conv, const char *cmd, char **args,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
404 char **eror, gpointer data)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
405 {
23859
eb8c8a926589 Convert serv_* media functions to purple_prpl_* functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23821
diff changeset
406 PurpleAccount *account = purple_conversation_get_account(conv);
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
407
26365
34eb898478b4 Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26358
diff changeset
408 if (!purple_prpl_initiate_media(account,
23917
4a208844bb63 Make voice calls work with Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23872
diff changeset
409 purple_conversation_get_name(conv),
26365
34eb898478b4 Don't assume a PurpleMedia instance will be created immediately.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26358
diff changeset
410 PURPLE_MEDIA_AUDIO))
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
411 return PURPLE_CMD_STATUS_FAILED;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
412
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
413 return PURPLE_CMD_STATUS_OK;
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
414 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
415
26330
99d58fee24b1 Make voice calls in Finch work again.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26329
diff changeset
416 static GstElement *
26392
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26391
diff changeset
417 create_default_audio_src(PurpleMedia *media,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26391
diff changeset
418 const gchar *session_id, const gchar *participant)
26330
99d58fee24b1 Make voice calls in Finch work again.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26329
diff changeset
419 {
26344
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
420 GstElement *bin, *src, *volume;
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
421 GstPad *pad, *ghost;
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
422 double input_volume = purple_prefs_get_int(
26416
1147a3b1fb0b Change media volume preference to be specific to Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
423 "/finch/media/audio/volume/input")/10.0;
26344
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
424
26417
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
425 src = gst_element_factory_make("gconfaudiosrc", NULL);
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
426 if (src == NULL)
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
427 src = gst_element_factory_make("autoaudiosrc", NULL);
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
428 if (src == NULL)
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
429 src = gst_element_factory_make("alsasrc", NULL);
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
430 if (src == NULL)
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
431 src = gst_element_factory_make("osssrc", NULL);
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
432 if (src == NULL)
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
433 src = gst_element_factory_make("dshowaudiosrc", NULL);
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
434 if (src == NULL) {
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
435 purple_debug_error("gntmedia", "Unable to find a suitable "
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
436 "element for the default audio source.\n");
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
437 return NULL;
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
438 }
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
439
26377
452be048bded Unique elements ought to be named the same as their id.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26376
diff changeset
440 bin = gst_bin_new("finchdefaultaudiosrc");
26344
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
441 volume = gst_element_factory_make("volume", "purpleaudioinputvolume");
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
442 g_object_set(volume, "volume", input_volume, NULL);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
443 gst_bin_add_many(GST_BIN(bin), src, volume, NULL);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
444 gst_element_link(src, volume);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
445 pad = gst_element_get_pad(volume, "src");
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
446 ghost = gst_ghost_pad_new("ghostsrc", pad);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
447 gst_element_add_pad(bin, ghost);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
448
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
449 return bin;
26330
99d58fee24b1 Make voice calls in Finch work again.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26329
diff changeset
450 }
99d58fee24b1 Make voice calls in Finch work again.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26329
diff changeset
451
99d58fee24b1 Make voice calls in Finch work again.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26329
diff changeset
452 static GstElement *
26392
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26391
diff changeset
453 create_default_audio_sink(PurpleMedia *media,
9c671fc1b351 Give more information to element creation functions.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26391
diff changeset
454 const gchar *session_id, const gchar *participant)
26330
99d58fee24b1 Make voice calls in Finch work again.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26329
diff changeset
455 {
26344
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
456 GstElement *bin, *sink, *volume, *queue;
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
457 GstPad *pad, *ghost;
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
458 double output_volume = purple_prefs_get_int(
26416
1147a3b1fb0b Change media volume preference to be specific to Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
459 "/finch/media/audio/volume/output")/10.0;
26344
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
460
26417
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
461 sink = gst_element_factory_make("gconfaudiosink", NULL);
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
462 if (sink == NULL)
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
463 sink = gst_element_factory_make("autoaudiosink",NULL);
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
464 if (sink == NULL) {
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
465 purple_debug_error("gntmedia", "Unable to find a suitable "
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
466 "element for the default audio sink.\n");
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
467 return NULL;
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
468 }
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
469
02c0a30d2942 Pick better devices in Finch too and have fallbacks.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26416
diff changeset
470 bin = gst_bin_new("finchdefaultaudiosink");
26344
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
471 volume = gst_element_factory_make("volume", "purpleaudiooutputvolume");
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
472 g_object_set(volume, "volume", output_volume, NULL);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
473 queue = gst_element_factory_make("queue", NULL);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
474 gst_bin_add_many(GST_BIN(bin), sink, volume, queue, NULL);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
475 gst_element_link(volume, sink);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
476 gst_element_link(queue, volume);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
477 pad = gst_element_get_pad(queue, "sink");
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
478 ghost = gst_ghost_pad_new("ghostsink", pad);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
479 gst_element_add_pad(bin, ghost);
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
480
8457de1211f2 Implement create_default_audio_* functions in gntmedia.c.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26330
diff changeset
481 return bin;
26330
99d58fee24b1 Make voice calls in Finch work again.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26329
diff changeset
482 }
26376
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
483 #endif /* USE_VV */
26330
99d58fee24b1 Make voice calls in Finch work again.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26329
diff changeset
484
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
485 void finch_media_manager_init(void)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
486 {
26376
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
487 #ifdef USE_VV
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
488 PurpleMediaManager *manager = purple_media_manager_get();
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
489 PurpleMediaElementInfo *default_audio_src =
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
490 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
491 "id", "finchdefaultaudiosrc",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
492 "name", "Finch Default Audio Source",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
493 "type", PURPLE_MEDIA_ELEMENT_AUDIO
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
494 | PURPLE_MEDIA_ELEMENT_SRC
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
495 | PURPLE_MEDIA_ELEMENT_ONE_SRC
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
496 | PURPLE_MEDIA_ELEMENT_UNIQUE,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
497 "create-cb", create_default_audio_src, NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
498 PurpleMediaElementInfo *default_audio_sink =
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
499 g_object_new(PURPLE_TYPE_MEDIA_ELEMENT_INFO,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
500 "id", "finchdefaultaudiosink",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
501 "name", "Finch Default Audio Sink",
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
502 "type", PURPLE_MEDIA_ELEMENT_AUDIO
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
503 | PURPLE_MEDIA_ELEMENT_SINK
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
504 | PURPLE_MEDIA_ELEMENT_ONE_SINK,
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
505 "create-cb", create_default_audio_sink, NULL);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
506
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
507 g_signal_connect(G_OBJECT(manager), "init-media", G_CALLBACK(finch_new_media), NULL);
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
508 purple_cmd_register("call", "", PURPLE_CMD_P_DEFAULT,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
509 PURPLE_CMD_FLAG_IM, NULL,
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
510 call_cmd_cb, _("call: Make an audio call."), NULL);
26330
99d58fee24b1 Make voice calls in Finch work again.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26329
diff changeset
511
26391
24feaf9cfbf1 Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
512 purple_media_manager_set_ui_caps(manager,
24feaf9cfbf1 Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
513 PURPLE_MEDIA_CAPS_AUDIO |
24feaf9cfbf1 Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
514 PURPLE_MEDIA_CAPS_AUDIO_SINGLE_DIRECTION);
24feaf9cfbf1 Declare which media caps Pidgin and Finch handle.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26384
diff changeset
515
26330
99d58fee24b1 Make voice calls in Finch work again.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26329
diff changeset
516 purple_debug_info("gntmedia", "Registering media element types\n");
26402
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
517 purple_media_manager_set_active_element(manager, default_audio_src);
081a819bc710 Hide and gobjectify PurpleMediaElementInfo.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26394
diff changeset
518 purple_media_manager_set_active_element(manager, default_audio_sink);
26416
1147a3b1fb0b Change media volume preference to be specific to Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
519
1147a3b1fb0b Change media volume preference to be specific to Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
520 purple_prefs_add_none("/finch/media");
1147a3b1fb0b Change media volume preference to be specific to Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
521 purple_prefs_add_none("/finch/media/audio");
1147a3b1fb0b Change media volume preference to be specific to Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
522 purple_prefs_add_none("/finch/media/audio/volume");
1147a3b1fb0b Change media volume preference to be specific to Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
523 purple_prefs_add_int("/finch/media/audio/volume/input", 10);
1147a3b1fb0b Change media volume preference to be specific to Finch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26402
diff changeset
524 purple_prefs_add_int("/finch/media/audio/volume/output", 10);
26376
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
525 #endif
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
526 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
527
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
528 void finch_media_manager_uninit(void)
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
529 {
26376
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
530 #ifdef USE_VV
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
531 PurpleMediaManager *manager = purple_media_manager_get();
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
532 g_signal_handlers_disconnect_by_func(G_OBJECT(manager),
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
533 G_CALLBACK(finch_new_media), NULL);
26376
49b7044be3de Hide FinchMedia and related structures.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 26371
diff changeset
534 #endif
23789
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
535 }
128f6cb57829 Some media support in finch. This needs to be updated for the got-accept signal.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
536
23800
4b9b265a8100 Fix compiling with the --disable-vv switch.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 23797
diff changeset
537