pidgin/purple-plugin-pack
merge of '858e9f40f7990cc6baccaf0259181302052bb20e'
and 'c98a6b865a99e87dc942aacb60eacdea3cf21cf5'
--- a/configure.ac Sat Oct 06 04:15:01 2007 -0400
+++ b/configure.ac Mon Oct 08 20:17:18 2007 -0400
@@ -320,6 +320,7 @@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/infopane/Makefile.am Mon Oct 08 20:17:18 2007 -0400
@@ -0,0 +1,26 @@
+EXTRA_DIST = .pidgin-plugin Makefile.mingw .build +infopanedir = $(PIDGIN_LIBDIR) +infopane_la_LDFLAGS = -module -avoid-version +infopane_LTLIBRARIES = infopane.la + -DLIBDIR=\"$(PIDGIN_LIBDIR)\" \ + -DDATADIR=\"$(PIDGIN_DATADIR)\" \ + -DPIXMAPSDIR=\"$(PIDGIN_PIXMAPSDIR)\" \ --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/infopane/Makefile.mingw Mon Oct 08 20:17:18 2007 -0400
@@ -0,0 +1,12 @@
+# Description: Makefile for infopane plugin. +include $(PP_TOP)/win_pp.mak --- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/infopane/infopane.c Mon Oct 08 20:17:18 2007 -0400
@@ -0,0 +1,250 @@
+ * Infopane - Use different views for the details information in conversation windows. + * 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 "../common/pp_internal.h" +#include "conversation.h" +#define PLUGIN_ID "gtk-plugin_pack-infopane" +#define PREF_PREFIX "/plugins/gtk/infopane" +#define PREF_POSITION PREF_PREFIX "/position" +#define PREF_DRAG PREF_PREFIX "/drag" +#define PREF_SINGLE PREF_PREFIX "/single" +#define PREF_ICON PREF_PREFIX "/icon" +static gboolean ensure_tabs_are_showing(PurpleConversation *conv) + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); + PidginWindow *win = gtkconv->win; + if (win->gtkconvs && win->gtkconvs->next) + if (purple_prefs_get_bool(PREF_SINGLE)) { + gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE); + } else if (win->gtkconvs->next == NULL) { + gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), FALSE); +static void set_conv_window_prefs(PidginConversation *gtkconv) + GtkWidget *paned, *vbox; + pref = purple_prefs_get_string(PREF_POSITION)[0]; + gtk_widget_hide_all(gtkconv->infopane_hbox->parent); + list = gtk_container_get_children(GTK_CONTAINER(gtkconv->tab_cont)); + vbox = gtk_paned_get_child1(GTK_PANED(paned)); + g_object_ref(G_OBJECT(gtkconv->infopane_hbox->parent)); + gtk_container_remove(GTK_CONTAINER(vbox), gtkconv->infopane_hbox->parent); + gtk_box_pack_end(GTK_BOX(vbox), gtkconv->infopane_hbox->parent, FALSE, FALSE, 0); + g_object_unref(G_OBJECT(gtkconv->infopane_hbox->parent)); + /* To disable dragging, setup a listener for button_press_event and return TRUE if the + * click is not going to popup up the sendto or the context menu */ + ensure_tabs_are_showing(gtkconv->active_conv); + if (purple_prefs_get_bool(PREF_ICON)) { + gtk_widget_show(gtkconv->icon); + gtk_widget_hide(gtkconv->icon); +static void setup_callback(PurpleConversation *conv, gboolean (*callback)(gpointer data)) + g_timeout_add(1000, callback, conv); +static void conversation_deleted(PurpleConversation *conv) + PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); + PidginWindow *win = gtkconv->win; + if (win->gtkconvs->next) { + PidginConversation *p = win->gtkconvs->data; + p = win->gtkconvs->next->data; + id = g_timeout_add(0, (GSourceFunc)ensure_tabs_are_showing, p->active_conv); + g_signal_connect_swapped(G_OBJECT(win->window), "destroy", + G_CALLBACK(g_source_remove), GINT_TO_POINTER(id)); +pref_changed(gpointer data, ...) + GList *wins = pidgin_conv_windows_get_list(); + for (; wins; wins = wins->next) { + GList *tabs = pidgin_conv_window_get_gtkconvs(wins->data); + for (; tabs; tabs = tabs->next) { + set_conv_window_prefs(tabs->data); +plugin_load(PurplePlugin *plugin) + purple_signal_connect(pidgin_conversations_get_handle(), + "conversation-displayed", + plugin, PURPLE_CALLBACK(set_conv_window_prefs), NULL); + purple_signal_connect(purple_conversations_get_handle(), + "deleting-conversation", + plugin, PURPLE_CALLBACK(conversation_deleted), NULL); + purple_signal_connect(pidgin_conversations_get_handle(), + "conversation-switched", + plugin, PURPLE_CALLBACK(ensure_tabs_are_showing), NULL); + purple_prefs_connect_callback(plugin, PREF_POSITION, (PurplePrefCallback)pref_changed, NULL); + purple_prefs_connect_callback(plugin, PREF_DRAG, (PurplePrefCallback)pref_changed, NULL); + purple_prefs_connect_callback(plugin, PREF_ICON, (PurplePrefCallback)pref_changed, NULL); + purple_prefs_connect_callback(plugin, PREF_SINGLE, (PurplePrefCallback)pref_changed, NULL); + purple_prefs_trigger_callback(PREF_POSITION); +static PurplePluginPrefFrame * +get_plugin_pref_frame(PurplePlugin *plugin) + PurplePluginPrefFrame *frame; + PurplePluginPref *pref; + frame = purple_plugin_pref_frame_new(); + /* XXX: Is there a better way than this? There really should be. */ + pref = purple_plugin_pref_new_with_name_and_label(PREF_POSITION, _("Position of the infopane ('top', 'bottom' or 'none')")); + purple_plugin_pref_frame_add(frame, pref); + pref = purple_plugin_pref_new_with_name_and_label(PREF_ICON, + _("Show icon in the tabs")); + purple_plugin_pref_frame_add(frame, pref); + pref = purple_plugin_pref_new_with_name_and_label(PREF_SINGLE, + _("Always show the tab")); + purple_plugin_pref_frame_add(frame, pref); +static PurplePluginUiInfo prefs_info = +static PurplePluginInfo info = + PURPLE_PLUGIN_STANDARD, + PURPLE_PRIORITY_DEFAULT, + N_("Infopane craziness."), + N_("Infopane craziness."), + "Sadrul H Chowdhury <sadrul@pidgin.im>", +init_plugin(PurplePlugin *plugin) + bindtextdomain(GETTEXT_PACKAGE, PP_LOCALEDIR); + bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8"); + info.name = _("Infopane"); + info.summary = _("Allow customizing the details information in conversation windows."); + info.description = _("Allow customizing the details information in conversation windows."); + purple_prefs_add_none(PREF_PREFIX); + purple_prefs_add_string(PREF_POSITION, "top"); + purple_prefs_add_bool(PREF_DRAG, FALSE); + purple_prefs_add_bool(PREF_SINGLE, TRUE); + purple_prefs_add_bool(PREF_ICON, TRUE); +PURPLE_INIT_PLUGIN(infopane, init_plugin, info)