changeset 26329:86bc2d34f689

Rename state-changed enum and values.
author Mike Ruprecht <maiku@soc.pidgin.im>
date Sat, 21 Mar 2009 03:49:11 +0000
parents 144802b7ed77
children 99d58fee24b1
files finch/gntmedia.c libpurple/media.c libpurple/media.h libpurple/protocols/jabber/google.c libpurple/protocols/jabber/jingle/rtp.c pidgin/gtkmedia.c
diffstat 6 files changed, 35 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntmedia.c	Sat Mar 21 03:42:45 2009 +0000
+++ b/finch/gntmedia.c	Sat Mar 21 03:49:11 2009 +0000
@@ -226,14 +226,13 @@
 }
 
 static void
-finch_media_state_changed_cb(PurpleMedia *media,
-		PurpleMediaStateChangedType type,
+finch_media_state_changed_cb(PurpleMedia *media, PurpleMediaState state,
 		gchar *sid, gchar *name, FinchMedia *gntmedia)
 {
-	purple_debug_info("gntmedia", "type: %d sid: %s name: %s\n",
-			type, sid, name);
+	purple_debug_info("gntmedia", "state: %d sid: %s name: %s\n",
+			state, sid, name);
 	if (sid == NULL && name == NULL) {
-		if (type == PURPLE_MEDIA_STATE_CHANGED_END) {
+		if (state == PURPLE_MEDIA_STATE_END) {
 			finch_media_emit_message(gntmedia,
 					_("The call has been terminated."));
 			finch_conversation_set_info_widget(
@@ -245,10 +244,10 @@
 			 */
 			g_object_unref(gntmedia);
 		}
-	} else if (type == PURPLE_MEDIA_STATE_CHANGED_NEW
+	} else if (state == PURPLE_MEDIA_STATE_NEW
 			&& sid != NULL && name != NULL) {
 		finch_media_ready_cb(media, gntmedia);
-	} else if (type == PURPLE_MEDIA_STATE_CHANGED_CONNECTED) {
+	} else if (state == PURPLE_MEDIA_STATE_CONNECTED) {
 		finch_media_accept_cb(media, gntmedia);
 	}
 }
--- a/libpurple/media.c	Sat Mar 21 03:42:45 2009 +0000
+++ b/libpurple/media.c	Sat Mar 21 03:49:11 2009 +0000
@@ -171,12 +171,15 @@
 	static GType type = 0;
 	if (type == 0) {
 		static const GEnumValue values[] = {
-			{ PURPLE_MEDIA_STATE_CHANGED_NEW, "PURPLE_MEDIA_STATE_CHANGED_NEW", "new" },
-			{ PURPLE_MEDIA_STATE_CHANGED_CONNECTED, "PURPLE_MEDIA_STATE_CHANGED_CONNECTED", "connected" },
-			{ PURPLE_MEDIA_STATE_CHANGED_END, "PURPLE_MEDIA_STATE_CHANGED_END", "end" },
+			{ PURPLE_MEDIA_STATE_NEW,
+				"PURPLE_MEDIA_STATE_NEW", "new" },
+			{ PURPLE_MEDIA_STATE_CONNECTED,
+				"PURPLE_MEDIA_STATE_CONNECTED", "connected" },
+			{ PURPLE_MEDIA_STATE_END,
+				"PURPLE_MEDIA_STATE_END", "end" },
 			{ 0, NULL, NULL }
 		};
-		type = g_enum_register_static("PurpleMediaStateChangedType", values);
+		type = g_enum_register_static("PurpleMediaState", values);
 	}
 	return type;
 }
@@ -271,7 +274,7 @@
 	purple_media_signals[STATE_CHANGED] = g_signal_new("state-changed", G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
 					 purple_smarshal_VOID__ENUM_STRING_STRING,
-					 G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_STATE_CHANGED,
+					 G_TYPE_NONE, 3, PURPLE_MEDIA_TYPE_STATE,
 					 G_TYPE_STRING, G_TYPE_STRING);
 	purple_media_signals[STREAM_INFO] = g_signal_new("stream-info", G_TYPE_FROM_CLASS(klass),
 					 G_SIGNAL_RUN_LAST, 0, NULL, NULL,
@@ -1450,7 +1453,7 @@
 	g_return_if_fail(PURPLE_IS_MEDIA(media));
 	if (session_id == NULL && participant == NULL) {
 		g_signal_emit(media, purple_media_signals[STATE_CHANGED],
-				0, PURPLE_MEDIA_STATE_CHANGED_END,
+				0, PURPLE_MEDIA_STATE_END,
 				NULL, NULL);
 		g_object_unref(media);
 	}
@@ -1767,7 +1770,7 @@
 
 	g_signal_emit(stream->session->media,
 			purple_media_signals[STATE_CHANGED],
-			0, PURPLE_MEDIA_STATE_CHANGED_CONNECTED,
+			0, PURPLE_MEDIA_STATE_CONNECTED,
 			stream->session->id, stream->participant);
 	return FALSE;
 }
@@ -1907,7 +1910,7 @@
 
 		purple_media_add_session(media, session);
 		g_signal_emit(media, purple_media_signals[STATE_CHANGED],
-				0, PURPLE_MEDIA_STATE_CHANGED_NEW,
+				0, PURPLE_MEDIA_STATE_NEW,
 				session->id, NULL);
 
 		session_type = purple_media_from_fs(type, FS_DIRECTION_SEND);
@@ -1928,7 +1931,7 @@
 		return FALSE;
 	} else {
 		g_signal_emit(media, purple_media_signals[STATE_CHANGED],
-				0, PURPLE_MEDIA_STATE_CHANGED_NEW,
+				0, PURPLE_MEDIA_STATE_NEW,
 				NULL, who);
 	}
 
@@ -2029,7 +2032,7 @@
 				 "src-pad-added", G_CALLBACK(purple_media_src_pad_added_cb), stream);
 
 		g_signal_emit(media, purple_media_signals[STATE_CHANGED],
-				0, PURPLE_MEDIA_STATE_CHANGED_NEW,
+				0, PURPLE_MEDIA_STATE_NEW,
 				session->id, who);
 	} else if (*direction != type_direction) {	
 		/* change direction */
--- a/libpurple/media.h	Sat Mar 21 03:42:45 2009 +0000
+++ b/libpurple/media.h	Sat Mar 21 03:49:11 2009 +0000
@@ -44,7 +44,7 @@
 #define PURPLE_IS_MEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PURPLE_TYPE_MEDIA))
 #define PURPLE_MEDIA_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), PURPLE_TYPE_MEDIA, PurpleMediaClass))
 
-#define PURPLE_MEDIA_TYPE_STATE_CHANGED	(purple_media_state_changed_get_type())
+#define PURPLE_MEDIA_TYPE_STATE      (purple_media_state_changed_get_type())
 #define PURPLE_MEDIA_TYPE_INFO_TYPE	(purple_media_info_type_get_type())
 
 /** @copydoc _PurpleMedia */
@@ -91,10 +91,10 @@
 
 /** Media state-changed types */
 typedef enum {
-	PURPLE_MEDIA_STATE_CHANGED_NEW = 0,
-	PURPLE_MEDIA_STATE_CHANGED_CONNECTED,
-	PURPLE_MEDIA_STATE_CHANGED_END,
-} PurpleMediaStateChangedType;
+	PURPLE_MEDIA_STATE_NEW = 0,
+	PURPLE_MEDIA_STATE_CONNECTED,
+	PURPLE_MEDIA_STATE_END,
+} PurpleMediaState;
 
 /** Media info types */
 typedef enum {
--- a/libpurple/protocols/jabber/google.c	Sat Mar 21 03:42:45 2009 +0000
+++ b/libpurple/protocols/jabber/google.c	Sat Mar 21 03:49:11 2009 +0000
@@ -217,12 +217,11 @@
 }
 
 static void
-google_session_state_changed_cb(PurpleMedia *media,
-		PurpleMediaStateChangedType type,
+google_session_state_changed_cb(PurpleMedia *media, PurpleMediaState state,
 		gchar *sid, gchar *name, GoogleSession *session)
 {
 	if (sid == NULL && name == NULL) {
-		if (type == PURPLE_MEDIA_STATE_CHANGED_END) {
+		if (state == PURPLE_MEDIA_STATE_END) {
 			google_session_destroy(session);
 		}
 	}
--- a/libpurple/protocols/jabber/jingle/rtp.c	Sat Mar 21 03:42:45 2009 +0000
+++ b/libpurple/protocols/jabber/jingle/rtp.c	Sat Mar 21 03:49:11 2009 +0000
@@ -435,10 +435,11 @@
 }
 
 static void
-jingle_rtp_state_changed_cb(PurpleMedia *media, PurpleMediaStateChangedType type,
+jingle_rtp_state_changed_cb(PurpleMedia *media, PurpleMediaState state,
 		gchar *sid, gchar *name, JingleSession *session)
 {
-	purple_debug_info("jingle-rtp", "state-changed: type %d id: %s name: %s\n", type, sid, name);
+	purple_debug_info("jingle-rtp", "state-changed: state %d "
+			"id: %s name: %s\n", state, sid, name);
 }
 
 static void
--- a/pidgin/gtkmedia.c	Sat Mar 21 03:42:45 2009 +0000
+++ b/pidgin/gtkmedia.c	Sat Mar 21 03:49:11 2009 +0000
@@ -660,22 +660,21 @@
 }
 
 static void
-pidgin_media_state_changed_cb(PurpleMedia *media,
-		PurpleMediaStateChangedType type,
+pidgin_media_state_changed_cb(PurpleMedia *media, PurpleMediaState state,
 		gchar *sid, gchar *name, PidginMedia *gtkmedia)
 {
-	purple_debug_info("gtkmedia", "type: %d sid: %s name: %s\n",
-			type, sid, name);
+	purple_debug_info("gtkmedia", "state: %d sid: %s name: %s\n",
+			state, sid, name);
 	if (sid == NULL && name == NULL) {
-		if (type == PURPLE_MEDIA_STATE_CHANGED_END) {
+		if (state == PURPLE_MEDIA_STATE_END) {
 			pidgin_media_emit_message(gtkmedia,
 					_("The call has been terminated."));
 			gtk_widget_destroy(GTK_WIDGET(gtkmedia));
 		}
-	} else if (type == PURPLE_MEDIA_STATE_CHANGED_NEW &&
+	} else if (state == PURPLE_MEDIA_STATE_NEW &&
 			sid != NULL && name != NULL) {
 		pidgin_media_ready_cb(media, gtkmedia, sid);
-	} else if (type == PURPLE_MEDIA_STATE_CHANGED_CONNECTED &&
+	} else if (state == PURPLE_MEDIA_STATE_CONNECTED &&
 			purple_media_get_session_type(media, sid) &
 			PURPLE_MEDIA_RECV_AUDIO) {
 		GstElement *media_sink = purple_media_get_sink(media,