# HG changeset patch
# Node ID 39b40178bc49
# Parent  1e026cbb93dd
diff --git a/finch/gntaccount.c b/finch/gntaccount.c
--- a/finch/gntaccount.c
+++ b/finch/gntaccount.c
@@ -146,7 +146,7 @@
 		 * only unref this new instance here. The pointer will remain valid as
 		 * the account manager adds a reference.
 		 */
-		g_object_unref(G_OBJECT(account));
+		g_object_unref(account);
 	} else {
 		account = dialog->account;
 		info = PURPLE_CONTACT_INFO(account);
diff --git a/finch/gntmedia.c b/finch/gntmedia.c
--- a/finch/gntmedia.c
+++ b/finch/gntmedia.c
@@ -315,11 +315,12 @@
 static GntWidget *
 finch_media_new(PurpleMedia *media)
 {
-	return GNT_WIDGET(g_object_new(finch_media_get_type(),
-				"media", media,
-				"vertical", FALSE,
-				"homogeneous", FALSE,
-				NULL));
+	return g_object_new(
+		finch_media_get_type(),
+		"media", media,
+		"vertical", FALSE,
+		"homogeneous", FALSE,
+		NULL);
 }
 
 static void
diff --git a/finch/gntroomlist.c b/finch/gntroomlist.c
--- a/finch/gntroomlist.c
+++ b/finch/gntroomlist.c
@@ -217,7 +217,7 @@
 		return;
 
 	froomlist.window = window = gnt_window_new();
-	g_object_set(G_OBJECT(window), "vertical", TRUE, NULL);
+	g_object_set(window, "vertical", TRUE, NULL);
 	gnt_box_set_pad(GNT_BOX(window), 0);
 	gnt_box_set_title(GNT_BOX(window), _("Room List"));
 	gnt_box_set_alignment(GNT_BOX(window), GNT_ALIGN_MID);
diff --git a/finch/plugins/grouping/grouping.c b/finch/plugins/grouping/grouping.c
--- a/finch/plugins/grouping/grouping.c
+++ b/finch/plugins/grouping/grouping.c
@@ -193,7 +193,7 @@
 no_group_init(void)
 {
 	GntTree *tree = finch_blist_get_tree();
-	g_object_set(G_OBJECT(tree), "expander-level", 0, NULL);
+	g_object_set(tree, "expander-level", 0, NULL);
 	return TRUE;
 }
 
@@ -201,7 +201,7 @@
 no_group_uninit(void)
 {
 	GntTree *tree = finch_blist_get_tree();
-	g_object_set(G_OBJECT(tree), "expander-level", 1, NULL);
+	g_object_set(tree, "expander-level", 1, NULL);
 	return TRUE;
 }
 
diff --git a/libpurple/media.c b/libpurple/media.c
--- a/libpurple/media.c
+++ b/libpurple/media.c
@@ -495,7 +495,7 @@
 {
 	PurpleAccount *account;
 	g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
-	g_object_get(G_OBJECT(media), "account", &account, NULL);
+	g_object_get(media, "account", &account, NULL);
 	return account;
 }
 
@@ -504,7 +504,7 @@
 {
 	gpointer protocol_data;
 	g_return_val_if_fail(PURPLE_IS_MEDIA(media), NULL);
-	g_object_get(G_OBJECT(media), "protocol-data", &protocol_data, NULL);
+	g_object_get(media, "protocol-data", &protocol_data, NULL);
 	return protocol_data;
 }
 
@@ -512,7 +512,7 @@
 purple_media_set_protocol_data(PurpleMedia *media, gpointer protocol_data)
 {
 	g_return_if_fail(PURPLE_IS_MEDIA(media));
-	g_object_set(G_OBJECT(media), "protocol-data", protocol_data, NULL);
+	g_object_set(media, "protocol-data", protocol_data, NULL);
 }
 
 void
diff --git a/libpurple/mediamanager.c b/libpurple/mediamanager.c
--- a/libpurple/mediamanager.c
+++ b/libpurple/mediamanager.c
@@ -215,7 +215,7 @@
 	static PurpleMediaManager *manager = NULL;
 
 	if (manager == NULL) {
-		manager = PURPLE_MEDIA_MANAGER(g_object_new(purple_media_manager_get_type(), NULL));
+		manager = g_object_new(purple_media_manager_get_type(), NULL);
 	}
 
 	return manager;
@@ -286,12 +286,13 @@
 	PurpleMedia *media;
 	guint signal_id;
 
-	media = PURPLE_MEDIA(g_object_new(purple_media_get_type(),
-			     "manager", manager,
-			     "account", account,
-			     "conference-type", conference_type,
-			     "initiator", initiator,
-			     NULL));
+	media = g_object_new(
+		purple_media_get_type(),
+		"manager", manager,
+		"account", account,
+		"conference-type", conference_type,
+		"initiator", initiator,
+		NULL);
 
 	signal_id = private ?
 			signals[SIG_INIT_PRIVATE_MEDIA] :
@@ -591,7 +592,7 @@
 		if (src) {
 			GstElement *capsfilter = gst_bin_get_by_name(GST_BIN(src), "protocol_video_caps");
 			if (capsfilter) {
-				g_object_set(G_OBJECT(capsfilter), "caps", caps, NULL);
+				g_object_set(capsfilter, "caps", caps, NULL);
 				gst_object_unref (capsfilter);
 			}
 			gst_object_unref (src);
@@ -1058,7 +1059,7 @@
 				videoscale = gst_element_factory_make("videoscale", NULL);
 				capsfilter = gst_element_factory_make("capsfilter", "protocol_video_caps");
 
-				g_object_set(G_OBJECT(capsfilter),
+				g_object_set(capsfilter,
 					"caps", purple_media_manager_get_video_caps(manager), NULL);
 
 				gst_bin_add_many(GST_BIN(bin), videoscale, capsfilter, NULL);
@@ -1353,12 +1354,10 @@
 				GObjectClass *klass =
 						G_OBJECT_GET_CLASS(ow->sink);
 				if (g_object_class_find_property(klass, "sync")) {
-					g_object_set(G_OBJECT(ow->sink),
-							"sync", FALSE, NULL);
+					g_object_set(ow->sink, "sync", FALSE, NULL);
 				}
 				if (g_object_class_find_property(klass, "async")) {
-					g_object_set(G_OBJECT(ow->sink),
-							"async", FALSE, NULL);
+					g_object_set(ow->sink, "async", FALSE, NULL);
 				}
 			}
 
diff --git a/libpurple/plugins/kwallet/purplekwallet.cpp b/libpurple/plugins/kwallet/purplekwallet.cpp
--- a/libpurple/plugins/kwallet/purplekwallet.cpp
+++ b/libpurple/plugins/kwallet/purplekwallet.cpp
@@ -114,7 +114,7 @@
  *****************************************************************************/
 PurpleKWalletPlugin::Request::Request(const QString &key, GTask *task) {
 	this->key = key;
-	this->task = G_TASK(g_object_ref(G_OBJECT(task)));
+	this->task = g_object_ref(task);
 }
 
 PurpleKWalletPlugin::Request::~Request(void) {
@@ -414,7 +414,7 @@
 
 	key = purple_kwallet_provider_account_key(account);
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task, (gpointer)purple_kwallet_read_password_async);
 
 	request = new PurpleKWalletPlugin::ReadRequest(key, task);
@@ -445,7 +445,7 @@
 	GTask *task = NULL;
 	QString key;
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task, (gpointer)purple_kwallet_write_password_async);
 
 	key = purple_kwallet_provider_account_key(account);
@@ -477,7 +477,7 @@
 	GTask *task = NULL;
 	QString key;
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task, (gpointer)purple_kwallet_clear_password_async);
 
 	key = purple_kwallet_provider_account_key(account);
diff --git a/libpurple/plugins/libsecret/libsecret.c b/libpurple/plugins/libsecret/libsecret.c
--- a/libpurple/plugins/libsecret/libsecret.c
+++ b/libpurple/plugins/libsecret/libsecret.c
@@ -93,7 +93,7 @@
 		g_task_return_pointer(task, password, g_free);
 	}
 
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static void
@@ -112,7 +112,7 @@
 		g_task_return_boolean(task, ret);
 	}
 
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static void
@@ -135,7 +135,7 @@
 		g_task_return_boolean(task, TRUE);
 	}
 
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 /******************************************************************************
@@ -151,7 +151,7 @@
 	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 	GTask *task = NULL;
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task, purple_libsecret_read_password_async);
 
 	secret_password_lookup(&purple_libsecret_schema, cancellable,
@@ -185,7 +185,7 @@
 	gchar *label = NULL;
 	const gchar *username = NULL;
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task, purple_libsecret_write_password_async);
 	username = purple_contact_info_get_username(info);
 
@@ -221,7 +221,7 @@
 	PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
 	GTask *task = NULL;
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task, purple_libsecret_clear_password_async);
 
 	secret_password_clear(&purple_libsecret_schema, cancellable,
diff --git a/libpurple/plugins/purple-toast/purple-toast.c b/libpurple/plugins/purple-toast/purple-toast.c
--- a/libpurple/plugins/purple-toast/purple-toast.c
+++ b/libpurple/plugins/purple-toast/purple-toast.c
@@ -64,7 +64,7 @@
 	                                NULL,
 	                                notification);
 
-	g_object_unref(G_OBJECT(notification));
+	g_object_unref(notification);
 }
 
 static GIcon *
@@ -102,9 +102,9 @@
 
 				icon = g_file_icon_new(file);
 
-				g_object_unref(G_OBJECT(file));
+				g_object_unref(file);
 			}
-			g_object_unref(G_OBJECT(image));
+			g_object_unref(image);
 		}
 	}
 
@@ -137,7 +137,7 @@
 	purple_toast_show_notification(title, message, icon);
 
 	if(G_IS_ICON(icon)) {
-		g_object_unref(G_OBJECT(icon));
+		g_object_unref(icon);
 	}
 }
 
@@ -182,7 +182,7 @@
 	g_free(title);
 
 	if(G_IS_ICON(icon)) {
-		g_object_unref(G_OBJECT(icon));
+		g_object_unref(icon);
 	}
 }
 
diff --git a/libpurple/plugins/wincred/wincred.c b/libpurple/plugins/wincred/wincred.c
--- a/libpurple/plugins/wincred/wincred.c
+++ b/libpurple/plugins/wincred/wincred.c
@@ -95,13 +95,13 @@
 	gchar *password = NULL;
 	PCREDENTIALW credential = NULL;
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task, purple_wincred_read_password_async);
 
 	target_name = wincred_get_target_name(account, &error);
 	if (target_name == NULL) {
 		g_task_return_error(task, error);
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 		return;
 	}
 
@@ -136,7 +136,7 @@
 		}
 
 		g_task_return_error(task, error);
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 		return;
 	}
 
@@ -154,7 +154,7 @@
 			0,
 			_("Cannot read password (unicode error)."));
 		g_task_return_error(task, error);
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 		return;
 	} else {
 		PurpleContactInfo *info = PURPLE_CONTACT_INFO(account);
@@ -164,7 +164,7 @@
 	}
 
 	g_task_return_pointer(task, password, g_free);
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static gchar *
@@ -194,13 +194,13 @@
 	glong password_len = 0;
 	CREDENTIALW credential;
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task, purple_wincred_write_password_async);
 
 	target_name = wincred_get_target_name(account, &error);
 	if (target_name == NULL) {
 		g_task_return_error(task, error);
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 		return;
 	}
 
@@ -210,7 +210,7 @@
 		g_free(target_name);
 		purple_debug_error("keyring-wincred", "Couldn't convert username");
 		g_task_return_error(task, error);
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 		return;
 	}
 
@@ -220,7 +220,7 @@
 		g_free(target_name);
 		purple_debug_error("keyring-wincred", "Couldn't convert password");
 		g_task_return_error(task, error);
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 		return;
 	}
 
@@ -263,7 +263,7 @@
 		g_task_return_boolean(task, TRUE);
 	}
 
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static gboolean
@@ -286,13 +286,13 @@
 	GError *error = NULL;
 	gunichar2 *target_name = NULL;
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task, purple_wincred_clear_password_async);
 
 	target_name = wincred_get_target_name(account, &error);
 	if (target_name == NULL) {
 		g_task_return_error(task, error);
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 		return;
 	}
 
@@ -328,7 +328,7 @@
 		}
 	}
 
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static gboolean
@@ -376,13 +376,12 @@
 static PurpleCredentialProvider *
 purple_wincred_new(void)
 {
-	return PURPLE_CREDENTIAL_PROVIDER(g_object_new(
+	return g_object_new(
 		PURPLE_TYPE_WINCRED,
 		"id", WINCRED_ID,
 		"name", _(WINCRED_NAME),
 		"description", _(WINCRED_DESCRIPTION),
-		NULL
-	));
+		NULL);
 }
 
 /******************************************************************************
diff --git a/libpurple/protocols/bonjour/bonjour.c b/libpurple/protocols/bonjour/bonjour.c
--- a/libpurple/protocols/bonjour/bonjour.c
+++ b/libpurple/protocols/bonjour/bonjour.c
@@ -724,7 +724,7 @@
 
 static PurpleProtocol *
 bonjour_protocol_new(void) {
-	return PURPLE_PROTOCOL(g_object_new(
+	return g_object_new(
 		BONJOUR_TYPE_PROTOCOL,
 		"id", "prpl-bonjour",
 		"name", "Bonjour (Deprecated)",
@@ -733,7 +733,7 @@
 		"icon-name", "im-bonjour",
 		"icon-resource-path", "/im/pidgin/libpurple/bonjour/icons",
 		"options", OPT_PROTO_NO_PASSWORD,
-		NULL));
+		NULL);
 }
 
 static GPluginPluginInfo *
diff --git a/libpurple/protocols/bonjour/xmpp.c b/libpurple/protocols/bonjour/xmpp.c
--- a/libpurple/protocols/bonjour/xmpp.c
+++ b/libpurple/protocols/bonjour/xmpp.c
@@ -1262,7 +1262,7 @@
 	g_clear_object(&bconv->input);
 	g_clear_object(&bconv->output);
 
-	g_object_unref(G_OBJECT(bconv->tx_buf));
+	g_object_unref(bconv->tx_buf);
 	if (bconv->stream_data != NULL) {
 		struct _stream_start_data *ss = bconv->stream_data;
 		g_free(ss->msg);
diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
--- a/libpurple/protocols/gg/gg.c
+++ b/libpurple/protocols/gg/gg.c
@@ -1348,14 +1348,14 @@
 
 static PurpleProtocol *
 ggp_protocol_new(void) {
-	return PURPLE_PROTOCOL(g_object_new(
+	return g_object_new(
 		GGP_TYPE_PROTOCOL,
 		"id", "prpl-gg",
 		"name", "Gadu-Gadu",
 		"description", _("Gadu-Gadu is a Polish instant messaging network."),
 		"icon-name", "im-gadu-gadu",
 		"icon-resource-path", "/im/pidgin/libpurple/gg/icons",
-		NULL));
+		NULL);
 }
 
 static GPluginPluginInfo *
diff --git a/libpurple/protocols/gg/message-prpl.c b/libpurple/protocols/gg/message-prpl.c
--- a/libpurple/protocols/gg/message-prpl.c
+++ b/libpurple/protocols/gg/message-prpl.c
@@ -257,7 +257,7 @@
 
 		purple_conversation_write_message(im, pmsg);
 
-		g_object_unref(G_OBJECT(pmsg));
+		g_object_unref(pmsg);
 	} else {
 		purple_debug_error("gg", "ggp_message_got_display: "
 			"unexpected message type: %d\n", msg->type);
diff --git a/libpurple/protocols/gg/resolver-purple.c b/libpurple/protocols/gg/resolver-purple.c
--- a/libpurple/protocols/gg/resolver-purple.c
+++ b/libpurple/protocols/gg/resolver-purple.c
@@ -84,7 +84,7 @@
 			addresses, cbdata);
 	}
 
-	g_object_unref(G_OBJECT(data->cancellable));
+	g_object_unref(data->cancellable);
 	data->cancellable = NULL;
 
 	for(l = addresses; l; l = l->next) {
@@ -193,7 +193,7 @@
 	if (G_IS_CANCELLABLE(data->cancellable)) {
 		g_cancellable_cancel(data->cancellable);
 
-		g_object_unref(G_OBJECT(data->cancellable));
+		g_object_unref(data->cancellable);
 	}
 
 	if (data->pipes[0])
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -1056,7 +1056,7 @@
 	g_clear_handle_id(&js->conn_close_timeout, g_source_remove);
 
 	g_cancellable_cancel(js->cancellable);
-	g_object_unref(G_OBJECT(js->cancellable));
+	g_object_unref(js->cancellable);
 
 	g_free(js);
 
diff --git a/libpurple/protocols/jabber/si.c b/libpurple/protocols/jabber/si.c
--- a/libpurple/protocols/jabber/si.c
+++ b/libpurple/protocols/jabber/si.c
@@ -1783,7 +1783,7 @@
 	}
 
 	if(jsx->stream_method == STREAM_METHOD_UNKNOWN) {
-		g_object_unref(G_OBJECT(jsx));
+		g_object_unref(jsx);
 		return;
 	}
 
@@ -1857,7 +1857,7 @@
 	}
 
 	if (jsx->ibb_buffer) {
-		g_object_unref(G_OBJECT(jsx->ibb_buffer));
+		g_object_unref(jsx->ibb_buffer);
 	}
 
 	purple_debug_info("jabber", "jabber_si_xfer_free(): freeing jsx %p\n", jsx);
diff --git a/libpurple/purpleattachment.c b/libpurple/purpleattachment.c
--- a/libpurple/purpleattachment.c
+++ b/libpurple/purpleattachment.c
@@ -224,12 +224,11 @@
 purple_attachment_new(guint64 id, const gchar *content_type) {
 	g_return_val_if_fail(content_type != NULL, NULL);
 
-	return PURPLE_ATTACHMENT(g_object_new(
+	return g_object_new(
 		PURPLE_TYPE_ATTACHMENT,
 		"id", id,
 		"content-type", content_type,
-		NULL
-	));
+		NULL);
 }
 
 guint64
diff --git a/libpurple/purpleconversation.c b/libpurple/purpleconversation.c
--- a/libpurple/purpleconversation.c
+++ b/libpurple/purpleconversation.c
@@ -295,7 +295,7 @@
 			purple_signal_emit(handle, "sent-im-msg", account, msg);
 		}
 
-		g_object_unref(G_OBJECT(msg));
+		g_object_unref(msg);
 	} else if(PURPLE_IS_CHAT_CONVERSATION(conv)) {
 		PurpleMessage *msg;
 		gint id = purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(conv));
@@ -310,7 +310,7 @@
 			purple_signal_emit(handle, "sent-chat-msg", account, msg, id);
 		}
 
-		g_object_unref(G_OBJECT(msg));
+		g_object_unref(msg);
 	}
 
 	if(err < 0) {
diff --git a/libpurple/purplecredentialmanager.c b/libpurple/purplecredentialmanager.c
--- a/libpurple/purplecredentialmanager.c
+++ b/libpurple/purplecredentialmanager.c
@@ -72,7 +72,7 @@
 	}
 
 	/* Clean up our initial reference to the task. */
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static void
@@ -95,7 +95,7 @@
 	}
 
 	/* Clean up our initial reference to the task. */
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static void
@@ -118,7 +118,7 @@
 	}
 
 	/* Clean up our initial reference to the task. */
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 /******************************************************************************
@@ -426,7 +426,7 @@
 	}
 
 	if(PURPLE_IS_CREDENTIAL_PROVIDER(manager->active)) {
-		previous = PURPLE_CREDENTIAL_PROVIDER(g_object_ref(manager->active));
+		previous = g_object_ref(manager->active);
 	}
 
 	if(g_set_object(&manager->active, provider)) {
@@ -494,7 +494,7 @@
 		g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0,
 		                        _("can not read password, no active "
 		                          "credential provider"));
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 	}
 }
 
@@ -533,7 +533,7 @@
 		g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0,
 		                        _("account \"%s\" is not marked to be stored"),
 		                        name);
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 
 		return;
 	}
@@ -549,7 +549,7 @@
 		                        _("can not write password, no active "
 		                          "credential provider"));
 
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 	}
 
 }
@@ -591,7 +591,7 @@
 		                        _("can not clear password, no active "
 		                          "credential provider"));
 
-		g_object_unref(G_OBJECT(task));
+		g_object_unref(task);
 	}
 }
 
diff --git a/libpurple/purplegdkpixbuf.c b/libpurple/purplegdkpixbuf.c
--- a/libpurple/purplegdkpixbuf.c
+++ b/libpurple/purplegdkpixbuf.c
@@ -137,7 +137,7 @@
 				"failed with size=%" G_GSIZE_FORMAT ": %s\n", count,
 				error ? error->message : "(no error message)");
 		g_clear_error(&error);
-		g_object_unref(G_OBJECT(loader));
+		g_object_unref(loader);
 		return NULL;
 	}
 
@@ -146,7 +146,7 @@
 				"failed for image of size %" G_GSIZE_FORMAT ": %s\n", count,
 				error ? error->message : "(no error message)");
 		g_clear_error(&error);
-		g_object_unref(G_OBJECT(loader));
+		g_object_unref(loader);
 		return NULL;
 	}
 
@@ -159,12 +159,12 @@
 				"of size %" G_GSIZE_FORMAT "\n",
 				animated ? "gdk_pixbuf_loader_get_animation"
 					: "gdk_pixbuf_loader_get_pixbuf", count);
-		g_object_unref(G_OBJECT(loader));
+		g_object_unref(loader);
 		return NULL;
 	}
 
 	g_object_ref(pixbuf);
-	g_object_unref(G_OBJECT(loader));
+	g_object_unref(loader);
 
 	return pixbuf;
 }
diff --git a/libpurple/purplehistorymanager.c b/libpurple/purplehistorymanager.c
--- a/libpurple/purplehistorymanager.c
+++ b/libpurple/purplehistorymanager.c
@@ -190,7 +190,7 @@
 		return FALSE;
 	}
 
-	g_object_ref(G_OBJECT(adapter));
+	g_object_ref(adapter);
 
 	id = purple_history_adapter_get_id(adapter);
 
@@ -206,7 +206,7 @@
 		ret = FALSE;
 	}
 
-	g_object_unref(G_OBJECT(adapter));
+	g_object_unref(adapter);
 
 	return ret;
 }
diff --git a/libpurple/purplemessage.c b/libpurple/purplemessage.c
--- a/libpurple/purplemessage.c
+++ b/libpurple/purplemessage.c
@@ -450,13 +450,14 @@
 	dt = g_date_time_new_now_local();
 
 	/* who may be NULL for outgoing MUC messages */
-	message = PURPLE_MESSAGE(g_object_new(PURPLE_TYPE_MESSAGE,
+	message = g_object_new(
+		PURPLE_TYPE_MESSAGE,
 		"author", author,
 		"recipient", recipient,
 		"contents", contents,
 		"timestamp", dt,
 		"flags", flags,
-		NULL));
+		NULL);
 
 	g_date_time_unref(dt);
 
@@ -481,13 +482,14 @@
 		dt = g_date_time_new_from_unix_local((gint64)timestamp);
 	}
 
-	message = PURPLE_MESSAGE(g_object_new(PURPLE_TYPE_MESSAGE,
+	message = g_object_new(
+		PURPLE_TYPE_MESSAGE,
 		"author", who,
 		"author-alias", who,
 		"contents", contents,
 		"timestamp", dt,
 		"flags", flags,
-		NULL));
+		NULL);
 
 	g_date_time_unref(dt);
 
@@ -505,11 +507,12 @@
 	flags |= PURPLE_MESSAGE_SYSTEM;
 	dt = g_date_time_new_now_local();
 
-	message = PURPLE_MESSAGE(g_object_new(PURPLE_TYPE_MESSAGE,
+	message = g_object_new(
+		PURPLE_TYPE_MESSAGE,
 		"contents", contents,
 		"timestamp", dt,
 		"flags", flags,
-		NULL));
+		NULL);
 
 	g_date_time_unref(dt);
 
@@ -702,7 +705,7 @@
 
 	return g_hash_table_insert(message->attachments,
 	                           purple_attachment_get_hash_key(attachment),
-	                           g_object_ref(G_OBJECT(attachment)));
+	                           g_object_ref(attachment));
 }
 
 gboolean
@@ -720,7 +723,7 @@
 
 	attachment = g_hash_table_lookup(message->attachments, &id);
 	if(PURPLE_IS_ATTACHMENT(attachment)) {
-		return PURPLE_ATTACHMENT(g_object_ref(G_OBJECT(attachment)));
+		return g_object_ref(attachment);
 	}
 
 	return NULL;
diff --git a/libpurple/purplenoopcredentialprovider.c b/libpurple/purplenoopcredentialprovider.c
--- a/libpurple/purplenoopcredentialprovider.c
+++ b/libpurple/purplenoopcredentialprovider.c
@@ -42,14 +42,14 @@
 {
 	GTask *task = NULL;
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task,
 	                      purple_noop_credential_provider_read_password_async);
 
 	g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0,
 	                        _("provider does not store passwords"));
 
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static gchar *
@@ -70,14 +70,14 @@
 {
 	GTask *task = NULL;
 
-	task = g_task_new(G_OBJECT(provider), cancellable, callback, data);
+	task = g_task_new(provider, cancellable, callback, data);
 	g_task_set_source_tag(task,
 	                      purple_noop_credential_provider_write_password_async);
 
 	g_task_return_new_error(task, PURPLE_CREDENTIAL_MANAGER_DOMAIN, 0,
 	                        _("provider does not store passwords"));
 
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static gboolean
@@ -117,11 +117,10 @@
  *****************************************************************************/
 PurpleCredentialProvider *
 purple_noop_credential_provider_new(void) {
-	return PURPLE_CREDENTIAL_PROVIDER(g_object_new(
+	return g_object_new(
 		PURPLE_TYPE_NOOP_CREDENTIAL_PROVIDER,
 		"id", "noop-provider",
 		"name", _("None"),
 		"description", _("Passwords will not be saved."),
-		NULL
-	));
+		NULL);
 }
diff --git a/libpurple/purpleprotocolmanager.c b/libpurple/purpleprotocolmanager.c
--- a/libpurple/purpleprotocolmanager.c
+++ b/libpurple/purpleprotocolmanager.c
@@ -260,7 +260,7 @@
 	 * will need to pass it to the signal emission after it's removed from the
 	 * hash table that'll unref it.
 	 */
-	g_object_ref(G_OBJECT(protocol));
+	g_object_ref(protocol);
 
 	id = purple_protocol_get_id(protocol);
 
@@ -292,7 +292,7 @@
 		ret = FALSE;
 	}
 
-	g_object_unref(G_OBJECT(protocol));
+	g_object_unref(protocol);
 
 	return ret;
 }
diff --git a/libpurple/purplesavedpresence.c b/libpurple/purplesavedpresence.c
--- a/libpurple/purplesavedpresence.c
+++ b/libpurple/purplesavedpresence.c
@@ -145,7 +145,7 @@
 	if(G_IS_SETTINGS(settings)) {
 		char *schema_id = NULL;
 
-		g_object_get(G_OBJECT(settings), "schema-id", &schema_id, NULL);
+		g_object_get(settings, "schema-id", &schema_id, NULL);
 
 		if(!purple_strequal("im.pidgin.Purple.SavedPresence", schema_id)) {
 			g_warning("expected schema id of im.pidgin.Purple.SavedPresence, "
diff --git a/libpurple/server.c b/libpurple/server.c
--- a/libpurple/server.c
+++ b/libpurple/server.c
@@ -390,7 +390,7 @@
 	pmsg = purple_message_new_incoming(name, message, flags, mtime);
 	purple_conversation_write_message(im, pmsg);
 	g_free(message);
-	g_object_unref(G_OBJECT(pmsg));
+	g_object_unref(pmsg);
 
 	g_free(name);
 }
@@ -678,7 +678,7 @@
 	g_free(angel);
 	g_free(buffy);
 
-	g_object_unref(G_OBJECT(pmsg));
+	g_object_unref(pmsg);
 }
 
 void purple_serv_send_file(PurpleConnection *gc, const char *who, const char *file)
diff --git a/libpurple/tests/test_channel_join_details.c b/libpurple/tests/test_channel_join_details.c
--- a/libpurple/tests/test_channel_join_details.c
+++ b/libpurple/tests/test_channel_join_details.c
@@ -52,7 +52,8 @@
 		"password-supported", TRUE,
 		NULL);
 
-	g_object_get(G_OBJECT(details),
+	g_object_get(
+		details,
 		"name", &name,
 		"nickname", &nickname,
 		"nickname-supported", &nickname_supported,
diff --git a/libpurple/tests/test_credential_provider.c b/libpurple/tests/test_credential_provider.c
--- a/libpurple/tests/test_credential_provider.c
+++ b/libpurple/tests/test_credential_provider.c
@@ -109,7 +109,7 @@
 	g_assert_error(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 0);
 	g_clear_error(&error);
 
-	g_object_unref(G_OBJECT(provider));
+	g_object_unref(provider);
 }
 
 static void
@@ -126,7 +126,7 @@
 	g_assert_error(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 1);
 	g_clear_error(&error);
 
-	g_object_unref(G_OBJECT(provider));
+	g_object_unref(provider);
 }
 
 static void
@@ -151,7 +151,7 @@
 	g_assert_error(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 2);
 	g_clear_error(&error);
 
-	g_object_unref(G_OBJECT(provider));
+	g_object_unref(provider);
 }
 
 static void
@@ -176,7 +176,7 @@
 	g_assert_error(error, PURPLE_CREDENTIAL_PROVIDER_DOMAIN, 3);
 	g_clear_error(&error);
 
-	g_object_unref(G_OBJECT(provider));
+	g_object_unref(provider);
 }
 
 static void
@@ -202,7 +202,7 @@
 	g_assert_no_error(error);
 	g_assert_true(ret);
 
-	g_object_unref(G_OBJECT(provider));
+	g_object_unref(provider);
 }
 
 /******************************************************************************
@@ -242,7 +242,7 @@
 
 	task = g_task_new(p, cancellable, callback, data);
 	g_task_return_pointer(task, NULL, NULL);
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static gchar *
@@ -272,7 +272,7 @@
 
 	task = g_task_new(p, cancellable, callback, data);
 	g_task_return_boolean(task, TRUE);
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static gboolean
@@ -301,7 +301,7 @@
 
 	task = g_task_new(p, cancellable, callback, data);
 	g_task_return_boolean(task, TRUE);
-	g_object_unref(G_OBJECT(task));
+	g_object_unref(task);
 }
 
 static gboolean
diff --git a/libpurple/tests/test_image.c b/libpurple/tests/test_image.c
--- a/libpurple/tests/test_image.c
+++ b/libpurple/tests/test_image.c
@@ -88,7 +88,7 @@
 	g_assert_cmpstr(purple_image_get_extension(image), ==, ext);
 	g_assert_cmpstr(purple_image_get_mimetype(image), ==, mimetype);
 
-	g_object_unref(G_OBJECT(image));
+	g_object_unref(image);
 }
 
 /******************************************************************************
diff --git a/pidgin/gtkmedia.c b/pidgin/gtkmedia.c
--- a/pidgin/gtkmedia.c
+++ b/pidgin/gtkmedia.c
@@ -681,7 +681,7 @@
 		if (sink == NULL) {
 			sink = gst_bin_get_by_name(GST_BIN(pipeline), "gtksink");
 		}
-		g_object_get(G_OBJECT(sink), "widget", &remote_video, NULL);
+		g_object_get(sink, "widget", &remote_video, NULL);
 		gtk_widget_set_visible(remote_video, TRUE);
 		gtk_widget_set_vexpand(remote_video, TRUE);
 		gtk_box_append(GTK_BOX(recv_widget), remote_video);
@@ -703,7 +703,7 @@
 		if (sink == NULL) {
 			sink = gst_bin_get_by_name(GST_BIN(pipeline), "gtksink");
 		}
-		g_object_get(G_OBJECT(sink), "widget", &local_video, NULL);
+		g_object_get(sink, "widget", &local_video, NULL);
 		gtk_widget_set_visible(local_video, TRUE);
 		gtk_widget_set_vexpand(local_video, TRUE);
 		gtk_box_append(GTK_BOX(send_widget), local_video);
diff --git a/pidgin/gtknotify.c b/pidgin/gtknotify.c
--- a/pidgin/gtknotify.c
+++ b/pidgin/gtknotify.c
@@ -428,7 +428,7 @@
 
 	/* Setup the treeview */
 	treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
-	g_object_unref(G_OBJECT(model));
+	g_object_unref(model);
 	gtk_widget_set_size_request(treeview, 500, 400);
 	gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)),
 								GTK_SELECTION_SINGLE);
diff --git a/pidgin/gtkrequest.c b/pidgin/gtkrequest.c
--- a/pidgin/gtkrequest.c
+++ b/pidgin/gtkrequest.c
@@ -1181,8 +1181,8 @@
 			purple_request_field_image_get_scale_y(ifield) * gdk_pixbuf_get_height(buf),
 			GDK_INTERP_BILINEAR);
 	widget = gtk_image_new_from_pixbuf(scale);
-	g_object_unref(G_OBJECT(buf));
-	g_object_unref(G_OBJECT(scale));
+	g_object_unref(buf);
+	g_object_unref(scale);
 
 	return widget;
 }
@@ -1678,7 +1678,7 @@
 	view = GTK_TREE_VIEW(gtk_tree_view_new_with_model(
 		GTK_TREE_MODEL(model)));
 	g_object_set_data(G_OBJECT(model), "sheet-widget", main_box);
-	g_object_unref(G_OBJECT(model));
+	g_object_unref(model);
 
 	id_column = gtk_tree_view_column_new();
 	gtk_tree_view_column_set_visible(id_column, FALSE);
diff --git a/pidgin/gtkwhiteboard.c b/pidgin/gtkwhiteboard.c
--- a/pidgin/gtkwhiteboard.c
+++ b/pidgin/gtkwhiteboard.c
@@ -476,7 +476,7 @@
 	PurpleBuddy *buddy;
 	GdkRGBA color;
 
-	gtkwb = PIDGIN_WHITEBOARD(g_object_new(PIDGIN_TYPE_WHITEBOARD, NULL));
+	gtkwb = g_object_new(PIDGIN_TYPE_WHITEBOARD, NULL);
 	gtkwb->wb = wb;
 	g_object_set_data_full(G_OBJECT(wb), UI_DATA, gtkwb, g_object_unref);
 
diff --git a/pidgin/pidginabout.c b/pidgin/pidginabout.c
--- a/pidgin/pidginabout.c
+++ b/pidgin/pidginabout.c
@@ -141,7 +141,7 @@
 	g_list_free(sections);
 
 	/* clean up */
-	g_object_unref(G_OBJECT(parser));
+	g_object_unref(parser);
 
 	g_input_stream_close(istream, NULL, NULL);
 }
diff --git a/pidgin/pidginavatar.c b/pidgin/pidginavatar.c
--- a/pidgin/pidginavatar.c
+++ b/pidgin/pidginavatar.c
@@ -548,7 +548,7 @@
  *****************************************************************************/
 GtkWidget *
 pidgin_avatar_new(void) {
-	return GTK_WIDGET(g_object_new(PIDGIN_TYPE_AVATAR, NULL));
+	return g_object_new(PIDGIN_TYPE_AVATAR, NULL);
 }
 
 void
diff --git a/pidgin/pidgindebug.c b/pidgin/pidgindebug.c
--- a/pidgin/pidgindebug.c
+++ b/pidgin/pidgindebug.c
@@ -459,9 +459,7 @@
 
 	scroll = view_near_bottom(win);
 	for (i = 0; i <= PURPLE_DEBUG_FATAL; i++) {
-		g_object_set(G_OBJECT(win->tags.level[i]),
-				"invisible", i < level,
-				NULL);
+		g_object_set(win->tags.level[i], "invisible", i < level, NULL);
 	}
 	if (scroll) {
 		gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(win->textview),
diff --git a/pidgin/pidgininvitedialog.c b/pidgin/pidgininvitedialog.c
--- a/pidgin/pidgininvitedialog.c
+++ b/pidgin/pidgininvitedialog.c
@@ -175,10 +175,10 @@
  *****************************************************************************/
 GtkWidget *
 pidgin_invite_dialog_new(PurpleChatConversation *conversation) {
-	return GTK_WIDGET(g_object_new(
+	return g_object_new(
 		PIDGIN_TYPE_INVITE_DIALOG,
 		"conversation", conversation,
-		NULL));
+		NULL);
 }
 
 const gchar *
diff --git a/pidgin/pidginpluginsdialog.c b/pidgin/pidginpluginsdialog.c
--- a/pidgin/pidginpluginsdialog.c
+++ b/pidgin/pidginpluginsdialog.c
@@ -96,5 +96,5 @@
  *****************************************************************************/
 GtkWidget *
 pidgin_plugins_dialog_new(void) {
-	return GTK_WIDGET(g_object_new(PIDGIN_TYPE_PLUGINS_DIALOG, NULL));
+	return g_object_new(PIDGIN_TYPE_PLUGINS_DIALOG, NULL);
 }
diff --git a/pidgin/prefs/pidginconversationprefs.c b/pidgin/prefs/pidginconversationprefs.c
--- a/pidgin/prefs/pidginconversationprefs.c
+++ b/pidgin/prefs/pidginconversationprefs.c
@@ -105,5 +105,5 @@
  *****************************************************************************/
 GtkWidget *
 pidgin_conversation_prefs_new(void) {
-	return GTK_WIDGET(g_object_new(PIDGIN_TYPE_CONVERSATION_PREFS, NULL));
+	return g_object_new(PIDGIN_TYPE_CONVERSATION_PREFS, NULL);
 }
diff --git a/pidgin/prefs/pidgincredentialprefs.c b/pidgin/prefs/pidgincredentialprefs.c
--- a/pidgin/prefs/pidgincredentialprefs.c
+++ b/pidgin/prefs/pidgincredentialprefs.c
@@ -189,5 +189,5 @@
  *****************************************************************************/
 GtkWidget *
 pidgin_credential_prefs_new(void) {
-	return GTK_WIDGET(g_object_new(PIDGIN_TYPE_CREDENTIAL_PREFS, NULL));
+	return g_object_new(PIDGIN_TYPE_CREDENTIAL_PREFS, NULL);
 }
diff --git a/pidgin/prefs/pidgincredentialproviderrow.c b/pidgin/prefs/pidgincredentialproviderrow.c
--- a/pidgin/prefs/pidgincredentialproviderrow.c
+++ b/pidgin/prefs/pidgincredentialproviderrow.c
@@ -187,9 +187,10 @@
 pidgin_credential_provider_row_new(PurpleCredentialProvider *provider) {
 	g_return_val_if_fail(PURPLE_IS_CREDENTIAL_PROVIDER(provider), NULL);
 
-	return GTK_WIDGET(g_object_new(PIDGIN_TYPE_CREDENTIAL_PROVIDER_ROW,
-	                               "provider", provider,
-	                               NULL));
+	return g_object_new(
+		PIDGIN_TYPE_CREDENTIAL_PROVIDER_ROW,
+		"provider", provider,
+		NULL);
 }
 
 PurpleCredentialProvider *
diff --git a/pidgin/prefs/pidginnetworkprefs.c b/pidgin/prefs/pidginnetworkprefs.c
--- a/pidgin/prefs/pidginnetworkprefs.c
+++ b/pidgin/prefs/pidginnetworkprefs.c
@@ -175,5 +175,5 @@
  *****************************************************************************/
 GtkWidget *
 pidgin_network_prefs_new(void) {
-	return GTK_WIDGET(g_object_new(PIDGIN_TYPE_NETWORK_PREFS, NULL));
+	return g_object_new(PIDGIN_TYPE_NETWORK_PREFS, NULL);
 }
diff --git a/pidgin/prefs/pidginvvprefs.c b/pidgin/prefs/pidginvvprefs.c
--- a/pidgin/prefs/pidginvvprefs.c
+++ b/pidgin/prefs/pidginvvprefs.c
@@ -603,7 +603,7 @@
  *****************************************************************************/
 GtkWidget *
 pidgin_vv_prefs_new(void) {
-	return GTK_WIDGET(g_object_new(PIDGIN_TYPE_VV_PREFS, NULL));
+	return g_object_new(PIDGIN_TYPE_VV_PREFS, NULL);
 }
 
 void
