--- a/pidgin/gtkdocklet.c Tue Nov 19 02:26:13 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1020 +0,0 @@
- * System tray icon (aka docklet) plugin for Purple
- * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org>
- * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com>
- * Inspired by a similar plugin by:
- * John (J5) Palmieri <johnp@martianrock.com>
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-#include "conversation.h"
-#include "gtksavedstatuses.h"
-#include "gtkstatusbox.h"
-#include "pidginstock.h"
-#ifndef DOCKLET_TOOLTIP_LINE_LIMIT
-#define DOCKLET_TOOLTIP_LINE_LIMIT 5
-#define SHORT_EMBED_TIMEOUT 5
-#define LONG_EMBED_TIMEOUT 15
-static GtkStatusIcon *docklet = NULL;
-static guint embed_timeout = 0;
-static PurpleStatusPrimitive status = PURPLE_STATUS_OFFLINE;
-static PidginDockletFlag flags = 0;
-static gboolean enable_join_chat = FALSE;
-static gboolean visible = FALSE;
-static gboolean visibility_manager = FALSE;
-static void docklet_gtk_status_create(gboolean);
-static void docklet_gtk_status_destroy(void);
-/**************************************************************************
- * docklet status and utility functions
- **************************************************************************/
-docklet_gtk_status_update_icon(PurpleStatusPrimitive status, PidginDockletFlag newflag)
- const gchar *icon_name = NULL;
- case PURPLE_STATUS_OFFLINE:
- icon_name = PIDGIN_STOCK_TRAY_OFFLINE;
- case PURPLE_STATUS_AWAY:
- icon_name = PIDGIN_STOCK_TRAY_AWAY;
- case PURPLE_STATUS_UNAVAILABLE:
- icon_name = PIDGIN_STOCK_TRAY_BUSY;
- case PURPLE_STATUS_EXTENDED_AWAY:
- icon_name = PIDGIN_STOCK_TRAY_XA;
- case PURPLE_STATUS_INVISIBLE:
- icon_name = PIDGIN_STOCK_TRAY_INVISIBLE;
- icon_name = PIDGIN_STOCK_TRAY_AVAILABLE;
- if (newflag & PIDGIN_DOCKLET_EMAIL_PENDING)
- icon_name = PIDGIN_STOCK_TRAY_EMAIL;
- if (newflag & PIDGIN_DOCKLET_CONV_PENDING)
- icon_name = PIDGIN_STOCK_TRAY_PENDING;
- if (newflag & PIDGIN_DOCKLET_CONNECTING)
- icon_name = PIDGIN_STOCK_TRAY_CONNECT;
- gtk_status_icon_set_from_icon_name(docklet, icon_name);
-get_pending_list(guint max)
- l_im = pidgin_conversations_get_unseen_ims(PIDGIN_UNSEEN_TEXT, FALSE, max);
- /* Short circuit if we have our information already */
- if (max == 1 && l_im != NULL)
- l_chat = pidgin_conversations_get_unseen_chats(
- purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/notification_chat"),
- if (l_im != NULL && l_chat != NULL)
- return g_list_concat(l_im, l_chat);
-docklet_update_status(void)
- PurpleSavedStatus *saved_status;
- PurpleStatusPrimitive newstatus = PURPLE_STATUS_OFFLINE;
- PidginDockletFlag newflags = 0;
- /* get the current savedstatus */
- saved_status = purple_savedstatus_get_current();
- /* determine if any ims have unseen messages */
- convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT);
- if (purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) {
- if (convs && !visible) {
- docklet_gtk_status_create(FALSE);
- } else if (!convs && visible) {
- docklet_gtk_status_destroy();
- /* set tooltip if messages are pending */
- GString *tooltip_text = g_string_new("");
- newflags |= PIDGIN_DOCKLET_CONV_PENDING;
- for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) {
- PurpleConversation *conv = (PurpleConversation *)l->data;
- PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
- if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) {
- g_string_append(tooltip_text, _("Right-click for more unread messages...\n"));
- g_string_append_printf(tooltip_text,
- ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count),
- purple_conversation_get_title(conv));
- g_string_append_printf(tooltip_text,
- ngettext("%d unread message from %s\n", "%d unread messages from %s\n",
- GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "unseen-count"))),
- GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "unseen-count")),
- purple_conversation_get_title(conv));
- /* get rid of the last newline */
- if (tooltip_text->len > 0)
- tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1);
- gtk_status_icon_set_tooltip_text(docklet, tooltip_text->str);
- g_string_free(tooltip_text, TRUE);
- char *tooltip_text = g_strconcat(PIDGIN_NAME, " - ",
- purple_savedstatus_get_title(saved_status), NULL);
- gtk_status_icon_set_tooltip_text(docklet, tooltip_text);
- for(l = purple_accounts_get_all(); l != NULL; l = l->next) {
- PurpleAccount *account = (PurpleAccount*)l->data;
- if (!purple_account_get_enabled(account, PIDGIN_UI))
- if (purple_account_is_disconnected(account))
- if (purple_account_is_connecting(account))
- newflags |= PIDGIN_DOCKLET_CONNECTING;
- if (pidgin_notify_emails_pending())
- newflags |= PIDGIN_DOCKLET_EMAIL_PENDING;
- newstatus = purple_savedstatus_get_primitive_type(saved_status);
- /* update the icon if we changed status */
- if (status != newstatus || flags != newflags) {
- docklet_gtk_status_update_icon(status, flags);
- return FALSE; /* for when we're called by the glib idle handler */
-online_account_supports_chat(void)
- c = purple_connections_get_all();
- PurpleConnection *gc = c->data;
- PurpleProtocol *protocol = purple_connection_get_protocol(gc);
- if (protocol != NULL && PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT, info))
-/**************************************************************************
- * callbacks and signal handlers
- **************************************************************************/
- /* TODO: confirm quit while pending */
-docklet_update_status_cb(void *data)
- docklet_update_status();
-docklet_conv_updated_cb(PurpleConversation *conv, PurpleConversationUpdateType type)
- if (type == PURPLE_CONVERSATION_UPDATE_UNSEEN)
- docklet_update_status();
-docklet_signed_on_cb(PurpleConnection *gc)
- if (!enable_join_chat) {
- if (PURPLE_PROTOCOL_IMPLEMENTS(purple_connection_get_protocol(gc), CHAT, info))
- enable_join_chat = TRUE;
- docklet_update_status();
-docklet_signed_off_cb(PurpleConnection *gc)
- if (enable_join_chat) {
- if (PURPLE_PROTOCOL_IMPLEMENTS(purple_connection_get_protocol(gc), CHAT, info))
- enable_join_chat = online_account_supports_chat();
- docklet_update_status();
-docklet_show_pref_changed_cb(const char *name, PurplePrefType type,
- gconstpointer value, gpointer data)
- const char *val = value;
- if (purple_strequal(val, "always")) {
- docklet_gtk_status_create(FALSE);
- else if (!visibility_manager) {
- pidgin_blist_visibility_manager_add();
- visibility_manager = TRUE;
- } else if (purple_strequal(val, "never")) {
- docklet_gtk_status_destroy();
- if (visibility_manager) {
- pidgin_blist_visibility_manager_remove();
- visibility_manager = FALSE;
- docklet_update_status();
-/**************************************************************************
- **************************************************************************/
-docklet_toggle_mute(GtkWidget *toggle, void *data)
- purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute",
- gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle)));
-docklet_toggle_blist(GtkWidget *toggle, void *data)
- purple_blist_set_visible(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle)));
-/* This is a workaround for a bug in windows GTK+. Clicking outside of the
- menu does not get rid of it, so instead we get rid of it as soon as the
- pointer leaves the menu. */
-hide_docklet_menu(gpointer data)
- gtk_menu_popdown(GTK_MENU(data));
-docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data)
- static guint hide_docklet_timer = 0;
- if (event->type == GDK_LEAVE_NOTIFY && (event->detail == GDK_NOTIFY_ANCESTOR ||
- event->detail == GDK_NOTIFY_UNKNOWN)) {
- purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu leave-notify-event\n");
- /* Add some slop so that the menu doesn't annoyingly disappear when mousing around */
- if (hide_docklet_timer == 0) {
- hide_docklet_timer = g_timeout_add(500,
- hide_docklet_menu, menu);
- } else if (event->type == GDK_ENTER_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) {
- purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu enter-notify-event\n");
- if (hide_docklet_timer != 0) {
- /* Cancel the hiding if we reenter */
- g_source_remove(hide_docklet_timer);
- hide_docklet_timer = 0;
-/* There is a lot of code here for handling the status submenu, much of
- * which is duplicated from the gtkstatusbox. It'd be nice to add API
- * somewhere to simplify this (either in the statusbox, or in libpurple).
-show_custom_status_editor_cb(GtkMenuItem *menuitem, gpointer user_data)
- PurpleSavedStatus *saved_status;
- saved_status = purple_savedstatus_get_current();
- if (purple_savedstatus_get_primitive_type(saved_status) == PURPLE_STATUS_AVAILABLE)
- saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AWAY);
- pidgin_status_editor_show(FALSE,
- purple_savedstatus_is_transient(saved_status) ? saved_status : NULL);
-static PurpleSavedStatus *
-create_transient_status(PurpleStatusPrimitive primitive, PurpleStatusType *status_type)
- PurpleSavedStatus *saved_status = purple_savedstatus_new(NULL, primitive);
- if(status_type != NULL) {
- GList *tmp, *active_accts = purple_accounts_get_all_active();
- for (tmp = active_accts; tmp != NULL; tmp = tmp->next) {
- purple_savedstatus_set_substatus(saved_status,
- (PurpleAccount*) tmp->data, status_type, NULL);
- g_list_free(active_accts);
-activate_status_account_cb(GtkMenuItem *menuitem, gpointer user_data)
- PurpleStatusType *status_type;
- PurpleStatusPrimitive primitive;
- PurpleSavedStatus *saved_status = NULL;
- GList *iter = purple_savedstatuses_get_all();
- GList *tmp, *active_accts = purple_accounts_get_all_active();
- status_type = (PurpleStatusType *)user_data;
- primitive = purple_status_type_get_primitive(status_type);
- for (; iter != NULL; iter = iter->next) {
- PurpleSavedStatus *ss = iter->data;
- if ((purple_savedstatus_get_primitive_type(ss) == primitive) && purple_savedstatus_is_transient(ss) &&
- purple_savedstatus_has_substatuses(ss))
- gboolean found = FALSE;
- /* The currently enabled accounts must have substatuses for all the active accts */
- for(tmp = active_accts; tmp != NULL; tmp = tmp->next) {
- PurpleAccount *acct = tmp->data;
- PurpleSavedStatusSub *sub = purple_savedstatus_get_substatus(ss, acct);
- const PurpleStatusType *sub_type = purple_savedstatus_substatus_get_status_type(sub);
- const char *subtype_status_id = purple_status_type_get_id(sub_type);
- if (subtype_status_id && purple_strequal(subtype_status_id,
- purple_status_type_get_id(status_type)))
- g_list_free(active_accts);
- /* Create a new transient saved status if we weren't able to find one */
- if (saved_status == NULL)
- saved_status = create_transient_status(primitive, status_type);
- /* Set the status for each account */
- purple_savedstatus_activate(saved_status);
-activate_status_primitive_cb(GtkMenuItem *menuitem, gpointer user_data)
- PurpleStatusPrimitive primitive;
- PurpleSavedStatus *saved_status;
- primitive = GPOINTER_TO_INT(user_data);
- /* Try to lookup an already existing transient saved status */
- saved_status = purple_savedstatus_find_transient_by_type_and_message(primitive, NULL);
- /* Create a new transient saved status if we weren't able to find one */
- if (saved_status == NULL)
- saved_status = create_transient_status(primitive, NULL);
- /* Set the status for each account */
- purple_savedstatus_activate(saved_status);
-activate_saved_status_cb(GtkMenuItem *menuitem, gpointer user_data)
- PurpleSavedStatus *saved_status;
- creation_time = GPOINTER_TO_INT(user_data);
- saved_status = purple_savedstatus_find_by_creation_time(creation_time);
- if (saved_status != NULL)
- purple_savedstatus_activate(saved_status);
-new_menu_item_with_status_icon(GtkWidget *menu, const char *str, PurpleStatusPrimitive primitive, GCallback cb, gpointer data, guint accel_key, guint accel_mods, char *mod)
- menuitem = gtk_image_menu_item_new_with_label(str);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- g_signal_connect(G_OBJECT(menuitem), "activate", cb, data);
- pixbuf = pidgin_create_status_icon(primitive, menu, PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
- image = gtk_image_new_from_pixbuf(pixbuf);
- g_object_unref(pixbuf);
- gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
- gtk_widget_show_all(menuitem);
-add_account_statuses(GtkWidget *menu, PurpleAccount *account)
- for (l = purple_account_get_status_types(account); l != NULL; l = l->next) {
- PurpleStatusType *status_type = (PurpleStatusType *)l->data;
- PurpleStatusPrimitive prim;
- if (!purple_status_type_is_user_settable(status_type))
- prim = purple_status_type_get_primitive(status_type);
- new_menu_item_with_status_icon(menu,
- purple_status_type_get_name(status_type),
- prim, G_CALLBACK(activate_status_account_cb),
- GINT_TO_POINTER(status_type), 0, 0, NULL);
-docklet_status_submenu(void)
- GtkWidget *submenu, *menuitem;
- GList *popular_statuses, *cur;
- PidginStatusBox *statusbox = NULL;
- submenu = gtk_menu_new();
- menuitem = gtk_menu_item_new_with_mnemonic(_("_Change Status"));
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
- if(pidgin_blist_get_default_gtk_blist() != NULL) {
- statusbox = PIDGIN_STATUS_BOX(pidgin_blist_get_default_gtk_blist()->statusbox);
- if(statusbox && statusbox->account != NULL) {
- add_account_statuses(submenu, statusbox->account);
- } else if(statusbox && statusbox->token_status_account != NULL) {
- add_account_statuses(submenu, statusbox->token_status_account);
- new_menu_item_with_status_icon(submenu, _("Available"),
- PURPLE_STATUS_AVAILABLE, G_CALLBACK(activate_status_primitive_cb),
- GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE), 0, 0, NULL);
- new_menu_item_with_status_icon(submenu, _("Away"),
- PURPLE_STATUS_AWAY, G_CALLBACK(activate_status_primitive_cb),
- GINT_TO_POINTER(PURPLE_STATUS_AWAY), 0, 0, NULL);
- new_menu_item_with_status_icon(submenu, _("Do not disturb"),
- PURPLE_STATUS_UNAVAILABLE, G_CALLBACK(activate_status_primitive_cb),
- GINT_TO_POINTER(PURPLE_STATUS_UNAVAILABLE), 0, 0, NULL);
- new_menu_item_with_status_icon(submenu, _("Invisible"),
- PURPLE_STATUS_INVISIBLE, G_CALLBACK(activate_status_primitive_cb),
- GINT_TO_POINTER(PURPLE_STATUS_INVISIBLE), 0, 0, NULL);
- new_menu_item_with_status_icon(submenu, _("Offline"),
- PURPLE_STATUS_OFFLINE, G_CALLBACK(activate_status_primitive_cb),
- GINT_TO_POINTER(PURPLE_STATUS_OFFLINE), 0, 0, NULL);
- popular_statuses = purple_savedstatuses_get_popular(6);
- if (popular_statuses != NULL)
- pidgin_separator(submenu);
- for (cur = popular_statuses; cur != NULL; cur = cur->next)
- PurpleSavedStatus *saved_status = cur->data;
- time_t creation_time = purple_savedstatus_get_creation_time(saved_status);
- new_menu_item_with_status_icon(submenu,
- purple_savedstatus_get_title(saved_status),
- purple_savedstatus_get_primitive_type(saved_status), G_CALLBACK(activate_saved_status_cb),
- GINT_TO_POINTER(creation_time), 0, 0, NULL);
- g_list_free(popular_statuses);
- pidgin_separator(submenu);
- pidgin_new_menu_item(submenu, _("New..."), NULL,
- G_CALLBACK(show_custom_status_editor_cb), NULL);
- pidgin_new_menu_item(submenu, _("Saved..."), NULL,
- G_CALLBACK(pidgin_status_window_show), NULL);
-plugin_act(GtkWidget *widget, PurplePluginAction *pam)
- if (pam && pam->callback)
-build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin)
- PurplePluginActionsCb actions_cb;
- PurplePluginAction *action = NULL;
- purple_plugin_info_get_actions_cb(purple_plugin_get_info(plugin));
- actions = actions_cb(plugin);
- for (l = actions; l != NULL; l = l->next)
- action = (PurplePluginAction *) l->data;
- action->plugin = plugin;
- menuitem = gtk_menu_item_new_with_label(action->label);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- g_signal_connect(G_OBJECT(menuitem), "activate",
- G_CALLBACK(plugin_act), action);
- g_object_set_data_full(G_OBJECT(menuitem), "plugin_action",
- (GDestroyNotify)purple_plugin_action_free);
- gtk_widget_show(menuitem);
- pidgin_separator(menu);
-docklet_plugin_actions(GtkWidget *menu)
- GtkWidget *menuitem, *submenu;
- PurplePlugin *plugin = NULL;
- PurplePluginInfo *info;
- g_return_if_fail(menu != NULL);
- /* Add a submenu for each plugin with custom actions */
- for (l = purple_plugins_get_loaded(); l; l = l->next) {
- plugin = PURPLE_PLUGIN(l->data);
- info = purple_plugin_get_info(plugin);
- if (!purple_plugin_info_get_actions_cb(info))
- menuitem = gtk_image_menu_item_new_with_label(
- _(gplugin_plugin_info_get_name(
- GPLUGIN_PLUGIN_INFO(info))));
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- submenu = gtk_menu_new();
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
- build_plugin_actions(submenu, plugin);
- pidgin_separator(menu);
- static GtkWidget *menu = NULL;
- gtk_widget_destroy(menu);
- menuitem = gtk_check_menu_item_new_with_mnemonic(_("Show Buddy _List"));
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible"));
- g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blist), NULL);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- menuitem = gtk_menu_item_new_with_mnemonic(_("_Unread Messages"));
- if (flags & PIDGIN_DOCKLET_CONV_PENDING) {
- GtkWidget *submenu = gtk_menu_new();
- GList *l = get_pending_list(0);
- gtk_widget_set_sensitive(menuitem, FALSE);
- purple_debug_warning("docklet",
- "status indicates messages pending, but no conversations with unseen messages were found.");
- pidgin_conversations_fill_menu(submenu, l);
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
- gtk_widget_set_sensitive(menuitem, FALSE);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- pidgin_separator(menu);
- menuitem = pidgin_new_menu_item(menu, _("New _Message..."),
- PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW,
- G_CALLBACK(pidgin_dialogs_im), NULL);
- if (status == PURPLE_STATUS_OFFLINE)
- gtk_widget_set_sensitive(menuitem, FALSE);
- menuitem = pidgin_new_menu_item(menu, _("Join Chat..."),
- PIDGIN_STOCK_CHAT, G_CALLBACK(pidgin_blist_joinchat_show),
- if (status == PURPLE_STATUS_OFFLINE)
- gtk_widget_set_sensitive(menuitem, FALSE);
- menuitem = docklet_status_submenu();
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- pidgin_separator(menu);
- pidgin_new_menu_item(menu, _("_Accounts"), NULL,
- G_CALLBACK(pidgin_accounts_window_show), NULL);
- pidgin_new_menu_item(menu, _("Plu_gins"),
- PIDGIN_STOCK_TOOLBAR_PLUGINS,
- G_CALLBACK(pidgin_plugin_dialog_show), NULL);
- pidgin_new_menu_item(menu, _("Pr_eferences"),
- G_CALLBACK(pidgin_prefs_show), NULL);
- pidgin_separator(menu);
- menuitem = gtk_check_menu_item_new_with_mnemonic(_("Mute _Sounds"));
- gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute"));
- if (purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none"))
- gtk_widget_set_sensitive(GTK_WIDGET(menuitem), FALSE);
- g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
- pidgin_separator(menu);
- /* add plugin actions */
- docklet_plugin_actions(menu);
- pidgin_new_menu_item(menu, _("_Quit"), GTK_STOCK_QUIT,
- G_CALLBACK(purple_core_quit), NULL);
- g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL);
- g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL);
- gtk_widget_show_all(menu);
- gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL);
-pidgin_docklet_clicked(int button_type)
- if (flags & PIDGIN_DOCKLET_EMAIL_PENDING) {
- pidgin_notify_emails_present(NULL);
- } else if (flags & PIDGIN_DOCKLET_CONV_PENDING) {
- GList *l = get_pending_list(1);
- pidgin_conv_present_conversation((PurpleConversation *)l->data);
- pidgin_blist_toggle_visibility();
-pidgin_docklet_embedded(void)
- if (!visibility_manager
- && !purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) {
- pidgin_blist_visibility_manager_add();
- visibility_manager = TRUE;
- docklet_update_status();
- docklet_gtk_status_update_icon(status, flags);
-pidgin_docklet_remove(void)
- if (visibility_manager) {
- pidgin_blist_visibility_manager_remove();
- visibility_manager = FALSE;
- status = PURPLE_STATUS_OFFLINE;
-docklet_gtk_embed_timeout_cb(gpointer data)
- /* The docklet was not embedded within the timeout.
- * Remove it as a visibility manager, but leave the plugin
- * loaded so that it can embed automatically if/when a notification
- * area becomes available.
- purple_debug_info("docklet", "failed to embed within timeout\n");
- pidgin_docklet_remove();
- purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE);
-docklet_gtk_embedded_cb(GtkWidget *widget, gpointer data)
- g_source_remove(embed_timeout);
- if (gtk_status_icon_is_embedded(docklet)) {
- purple_debug_info("docklet", "embedded\n");
- pidgin_docklet_embedded();
- purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE);
- purple_debug_info("docklet", "detached\n");
- pidgin_docklet_remove();
- purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE);
-docklet_gtk_status_activated_cb(GtkStatusIcon *status_icon, gpointer user_data)
- pidgin_docklet_clicked(1);
-docklet_gtk_status_clicked_cb(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data)
- purple_debug_info("docklet", "The button is %u\n", button);
-#ifdef GDK_WINDOWING_QUARTZ
- /* You can only click left mouse button on MacOSX native GTK. Let that be the menu */
- pidgin_docklet_clicked(3);
- pidgin_docklet_clicked(button);
-docklet_gtk_status_destroy(void)
- g_return_if_fail(docklet != NULL);
- pidgin_docklet_remove();
- g_source_remove(embed_timeout);
- gtk_status_icon_set_visible(docklet, FALSE);
- g_object_unref(G_OBJECT(docklet));
- purple_debug_info("docklet", "GTK+ destroyed\n");
-docklet_gtk_status_create(gboolean recreate)
- /* if this is being called when a tray icon exists, it's because
- something messed up. try destroying it before we proceed,
- although docklet_refcount may be all hosed. hopefully won't happen. */
- purple_debug_warning("docklet", "trying to create icon but it already exists?\n");
- docklet_gtk_status_destroy();
- docklet = gtk_status_icon_new();
- g_return_if_fail(docklet != NULL);
- g_signal_connect(G_OBJECT(docklet), "activate", G_CALLBACK(docklet_gtk_status_activated_cb), NULL);
- g_signal_connect(G_OBJECT(docklet), "popup-menu", G_CALLBACK(docklet_gtk_status_clicked_cb), NULL);
- g_signal_connect(G_OBJECT(docklet), "notify::embedded", G_CALLBACK(docklet_gtk_embedded_cb), NULL);
- gtk_status_icon_set_visible(docklet, TRUE);
- /* This is a hack to avoid a race condition between the docklet getting
- * embedded in the notification area and the gtkblist restoring its
- * previous visibility state. If the docklet does not get embedded within
- * the timeout, it will be removed as a visibility manager until it does
- * get embedded. Ideally, we would only call docklet_embedded() when the
- * icon was actually embedded. This only happens when the docklet is first
- * created, not when being recreated.
- * The gtk docklet tracks whether it successfully embedded in a pref and
- * allows for a longer timeout period if it successfully embedded the last
- * time it was run. This should hopefully solve problems with the buddy
- * list not properly starting hidden when Pidgin is started on login.
- pidgin_docklet_embedded();
- if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) {
- embed_timeout = g_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL);
- embed_timeout = g_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL);
- purple_debug_info("docklet", "GTK+ created\n");
-/**************************************************************************
- **************************************************************************/
-pidgin_docklet_get_handle()
-pidgin_docklet_get_status_icon(void)
- void *conn_handle = purple_connections_get_handle();
- void *conv_handle = purple_conversations_get_handle();
- void *accounts_handle = purple_accounts_get_handle();
- void *status_handle = purple_savedstatuses_get_handle();
- void *docklet_handle = pidgin_docklet_get_handle();
- void *notify_handle = purple_notify_get_handle();
- purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/blink", FALSE);
- purple_prefs_add_string(PIDGIN_PREFS_ROOT "/docklet/show", "always");
- purple_prefs_connect_callback(docklet_handle, PIDGIN_PREFS_ROOT "/docklet/show",
- docklet_show_pref_changed_cb, NULL);
- purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/notification_chat", PIDGIN_UNSEEN_TEXT);
- purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet/gtk");
- if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded")) {
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE);
- purple_prefs_remove(PIDGIN_PREFS_ROOT "/docklet/x11/embedded");
- purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE);
- if (purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always"))
- docklet_gtk_status_create(FALSE);
- purple_signal_connect(conn_handle, "signed-on",
- docklet_handle, PURPLE_CALLBACK(docklet_signed_on_cb), NULL);
- purple_signal_connect(conn_handle, "signed-off",
- docklet_handle, PURPLE_CALLBACK(docklet_signed_off_cb), NULL);
- purple_signal_connect(accounts_handle, "account-connecting",
- docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
- purple_signal_connect(conv_handle, "received-im-msg",
- docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
- purple_signal_connect(conv_handle, "conversation-created",
- docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
- purple_signal_connect(conv_handle, "deleting-conversation",
- docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
- purple_signal_connect(conv_handle, "conversation-updated",
- docklet_handle, PURPLE_CALLBACK(docklet_conv_updated_cb), NULL);
- purple_signal_connect(status_handle, "savedstatus-changed",
- docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
- purple_signal_connect(notify_handle, "displaying-email-notification",
- docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
- purple_signal_connect(notify_handle, "displaying-emails-notification",
- docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
- purple_signal_connect(notify_handle, "displaying-emails-clear",
- docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
- purple_signal_connect(purple_get_core(), "quitting",
- docklet_handle, PURPLE_CALLBACK(purple_quit_cb), NULL);
- enable_join_chat = online_account_supports_chat();
- docklet_gtk_status_destroy();
--- a/pidgin/gtkdocklet.h Tue Nov 19 02:26:13 2019 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
- * System tray icon (aka docklet) plugin for Purple
- * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org>
- * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com>
- * Inspired by a similar plugin by:
- * John (J5) Palmieri <johnp@martianrock.com>
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * @section_id: pidgin-gtkdocklet
- * @short_description: <filename>gtkdocklet.h</filename>
- * This file provides the System tray icon (aka docklet) implementation.
- PIDGIN_DOCKLET_CONNECTING = 0x1,
- PIDGIN_DOCKLET_CONV_PENDING = 0x2,
- PIDGIN_DOCKLET_EMAIL_PENDING = 0x4
- * pidgin_docklet_get_status_icon:
- * Returns: (transfer none): The #GtkStatusIcon used for the docklet.
-GtkStatusIcon *pidgin_docklet_get_status_icon(void);
-void pidgin_docklet_init(void);
-void pidgin_docklet_uninit(void);
-void*pidgin_docklet_get_handle(void);
-#endif /* _GTKDOCKLET_H_ */
--- a/pidgin/gtkprefs.c Tue Nov 19 02:26:13 2019 +0000
+++ b/pidgin/gtkprefs.c Fri Nov 15 21:47:04 2019 -0600
@@ -105,7 +105,6 @@
- PidginPrefCombo docklet;
PidginPrefCombo hide_new;
@@ -1686,10 +1685,6 @@
- win->iface.docklet.type = PURPLE_PREF_STRING;
- win->iface.docklet.key = PIDGIN_PREFS_ROOT "/docklet/show";
- pidgin_prefs_bind_dropdown(&win->iface.docklet);
win->iface.im.hide_new.type = PURPLE_PREF_STRING;
win->iface.im.hide_new.key = PIDGIN_PREFS_ROOT "/conversations/im/hide_new";
pidgin_prefs_bind_dropdown(&win->iface.im.hide_new);
@@ -3483,9 +3478,6 @@
gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow,
- gtk_widget_class_bind_template_child(
- widget_class, PidginPrefsWindow,
iface.im.hide_new.combo);
gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow,
--- a/pidgin/libpidgin.c Tue Nov 19 02:26:13 2019 +0000
+++ b/pidgin/libpidgin.c Fri Nov 15 21:47:04 2019 -0600
@@ -48,7 +48,6 @@
@@ -244,7 +243,6 @@
_pidgin_smiley_theme_init();
@@ -262,7 +260,6 @@
_pidgin_smiley_theme_uninit();
pidgin_conversations_uninit();
- pidgin_docklet_uninit();
pidgin_connection_uninit();
--- a/pidgin/meson.build Tue Nov 19 02:26:13 2019 +0000
+++ b/pidgin/meson.build Fri Nov 15 21:47:04 2019 -0600
@@ -9,7 +9,6 @@
'gtkicon-theme-loader.c',
@@ -60,7 +59,6 @@
'gtkicon-theme-loader.h',
@@ -121,7 +119,6 @@
# Files that looks like obsolete (were used in Pidgin2):
- # win32/gtkdocklet-win32.c
--- a/pidgin/resources/Prefs/prefs.ui Tue Nov 19 02:26:13 2019 +0000
+++ b/pidgin/resources/Prefs/prefs.ui Fri Nov 15 21:47:04 2019 -0600
@@ -478,77 +478,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
- <object class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">_Show system tray icon:</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">iface.docklet.combo</property>
- <property name="xalign">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- <object class="GtkComboBox" id="iface.docklet.combo">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="model">iface.docklet.store</property>
- <object class="GtkCellRendererText"/>
- <attribute name="text">0</attribute>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">System Tray Icon</property>
- <attribute name="weight" value="bold"/>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- <object class="GtkFrame">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <object class="GtkAlignment">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="bottom_padding">12</property>
- <property name="left_padding">12</property>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
@@ -1509,6 +1438,15 @@
<property name="fill">False</property>
+ <child internal-child="send_button"> + <object class="GtkButton"> + <property name="can_focus">False</property> + <property name="receives_default">False</property> + <property name="fill">False</property> <property name="expand">False</property>