/pidgin/main: ca8204d663bf: Backport warning fixes for Finch fro...
Tomasz Wasilczyk
twasilczyk at pidgin.im
Tue May 6 07:26:47 EDT 2014
Changeset: ca8204d663bf34a9dd188de74ce85c0b5a097b48
Author: Tomasz Wasilczyk <twasilczyk at pidgin.im>
Date: 2014-05-06 13:26 +0200
Branch: release-2.x.y
URL: https://hg.pidgin.im/pidgin/main/rev/ca8204d663bf
Description:
Backport warning fixes for Finch from default
diffstat:
finch/finch.c | 6 ++++++
finch/gntmedia.c | 4 ++--
finch/gntnotify.c | 43 +++++++++++++++++++++++++------------------
finch/plugins/gnttinyurl.c | 2 +-
finch/plugins/lastlog.c | 2 +-
5 files changed, 35 insertions(+), 22 deletions(-)
diffs (162 lines):
diff --git a/finch/finch.c b/finch/finch.c
--- a/finch/finch.c
+++ b/finch/finch.c
@@ -448,7 +448,13 @@ int main(int argc, char *argv[])
{
signal(SIGPIPE, SIG_IGN);
+#if !GLIB_CHECK_VERSION(2, 32, 0)
+ /* GLib threading system is automaticaly initialized since 2.32.
+ * For earlier versions, it have to be initialized before calling any
+ * Glib or GTK+ functions.
+ */
g_thread_init(NULL);
+#endif
g_set_prgname("Finch");
g_set_application_name(_("Finch"));
diff --git a/finch/gntmedia.c b/finch/gntmedia.c
--- a/finch/gntmedia.c
+++ b/finch/gntmedia.c
@@ -408,9 +408,9 @@ call_cmd_cb(PurpleConversation *conv, co
if (!purple_prpl_initiate_media(account,
purple_conversation_get_name(conv),
PURPLE_MEDIA_AUDIO))
- return PURPLE_CMD_STATUS_FAILED;
+ return PURPLE_CMD_RET_FAILED;
- return PURPLE_CMD_STATUS_OK;
+ return PURPLE_CMD_RET_OK;
}
static GstElement *
diff --git a/finch/gntnotify.c b/finch/gntnotify.c
--- a/finch/gntnotify.c
+++ b/finch/gntnotify.c
@@ -47,19 +47,19 @@ static struct
} emaildialog;
static void
-notify_msg_window_destroy_cb(GntWidget *window, PurpleNotifyMsgType type)
+notify_msg_window_destroy_cb(GntWidget *window, PurpleNotifyType type)
{
purple_notify_close(type, window);
}
static void *
-finch_notify_message(PurpleNotifyMsgType type, const char *title,
- const char *primary, const char *secondary)
+finch_notify_common(PurpleNotifyType ntype, PurpleNotifyMsgType msgtype,
+ const char *title, const char *primary, const char *secondary)
{
GntWidget *window, *button;
GntTextFormatFlags pf = 0, sf = 0;
- switch (type)
+ switch (msgtype)
{
case PURPLE_NOTIFY_MSG_ERROR:
sf |= GNT_TEXT_FLAG_BOLD;
@@ -88,20 +88,16 @@ finch_notify_message(PurpleNotifyMsgType
* PurpleNotifyType. Also, the if() followed by the
* inner switch doesn't make much sense.
*/
- if (type == PURPLE_NOTIFY_FORMATTED) {
+ if (ntype == PURPLE_NOTIFY_FORMATTED) {
int width = -1, height = -1;
char *plain = (char*)secondary;
msg = gnt_text_view_new();
gnt_text_view_set_flag(GNT_TEXT_VIEW(msg), GNT_TEXT_VIEW_TOP_ALIGN | GNT_TEXT_VIEW_NO_SCROLL);
- switch (type) {
- case PURPLE_NOTIFY_FORMATTED:
- plain = purple_markup_strip_html(secondary);
- if (gnt_util_parse_xhtml_to_textview(secondary, GNT_TEXT_VIEW(msg)))
- break;
- /* Fallthrough */
- default:
- gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(msg), plain, sf);
- }
+
+ plain = purple_markup_strip_html(secondary);
+ if (!gnt_util_parse_xhtml_to_textview(secondary, GNT_TEXT_VIEW(msg)))
+ gnt_text_view_append_text_with_flags(GNT_TEXT_VIEW(msg), plain, sf);
+
gnt_text_view_attach_scroll_widget(GNT_TEXT_VIEW(msg), button);
gnt_util_get_text_bound(plain, &width, &height);
gnt_widget_set_size(msg, width + 3, height + 1);
@@ -118,12 +114,20 @@ finch_notify_message(PurpleNotifyMsgType
g_signal_connect_swapped(G_OBJECT(button), "activate",
G_CALLBACK(gnt_widget_destroy), window);
g_signal_connect(G_OBJECT(window), "destroy",
- G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(type));
+ G_CALLBACK(notify_msg_window_destroy_cb), GINT_TO_POINTER(ntype));
gnt_widget_show(window);
return window;
}
+static void *
+finch_notify_message(PurpleNotifyMsgType type, const char *title,
+ const char *primary, const char *secondary)
+{
+ return finch_notify_common(PURPLE_NOTIFY_MESSAGE, type, title, primary,
+ secondary);
+}
+
/* handle is, in all/most occasions, a GntWidget * */
static void finch_close_notify(PurpleNotifyType type, void *handle)
{
@@ -156,7 +160,8 @@ static void *finch_notify_formatted(cons
void *ret;
purple_markup_html_to_xhtml(t, &xhtml, NULL);
- ret = finch_notify_message(PURPLE_NOTIFY_FORMATTED, title, primary, xhtml);
+ ret = finch_notify_common(PURPLE_NOTIFY_FORMATTED,
+ PURPLE_NOTIFY_MSG_INFO, title, primary, xhtml);
g_free(t);
g_free(xhtml);
@@ -249,7 +254,8 @@ finch_notify_emails(PurpleConnection *gc
return NULL;
}
- ret = finch_notify_message(PURPLE_NOTIFY_EMAIL, _("New Mail"), _("You have mail!"), message->str);
+ ret = finch_notify_common(PURPLE_NOTIFY_EMAIL, PURPLE_NOTIFY_MSG_INFO,
+ _("New Mail"), _("You have mail!"), message->str);
g_string_free(message, TRUE);
return ret;
}
@@ -490,7 +496,8 @@ finch_notify_searchresults(PurpleConnect
static void *
finch_notify_uri(const char *url)
{
- return finch_notify_message(PURPLE_NOTIFY_URI, _("URI"), url, NULL);
+ return finch_notify_common(PURPLE_NOTIFY_URI, PURPLE_NOTIFY_MSG_INFO,
+ _("URI"), url, NULL);
}
static PurpleNotifyUiOps ops =
diff --git a/finch/plugins/gnttinyurl.c b/finch/plugins/gnttinyurl.c
--- a/finch/plugins/gnttinyurl.c
+++ b/finch/plugins/gnttinyurl.c
@@ -367,7 +367,7 @@ tinyurl_notify_uri(const char *uri)
/* XXX: The following expects that finch_notify_message gets called. This
* may not always happen, e.g. when another plugin sets its own
* notify_message. So tread carefully. */
- win = purple_notify_message(NULL, PURPLE_NOTIFY_URI, _("URI"), uri,
+ win = purple_notify_message(NULL, PURPLE_NOTIFY_MSG_INFO, _("URI"), uri,
_("Please wait while TinyURL fetches a shorter URL ..."), NULL, NULL);
if (!GNT_IS_WINDOW(win) || !g_object_get_data(G_OBJECT(win), "info-widget"))
return win;
diff --git a/finch/plugins/lastlog.c b/finch/plugins/lastlog.c
--- a/finch/plugins/lastlog.c
+++ b/finch/plugins/lastlog.c
@@ -88,7 +88,7 @@ lastlog_cb(PurpleConversation *conv, con
g_signal_connect(G_OBJECT(win), "key_pressed", G_CALLBACK(window_kpress_cb), tv);
g_strfreev(strings);
- return PURPLE_CMD_STATUS_OK;
+ return PURPLE_CMD_RET_OK;
}
static gboolean
More information about the Commits
mailing list