pidgin/purple-plugin-pack
remove stocker as the aol servers it used have been taken down
--- a/meson.build Sun Mar 01 18:39:32 2020 -0600
+++ b/meson.build Sun Mar 01 18:43:49 2020 -0600
@@ -199,7 +199,6 @@
--- a/stocker/README.md Sun Mar 01 18:39:32 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-notes: This plugin partially works but is buggy and in need of TLC.
-Adds a stock ticker similar to the one in the Windows AIM client to the bottom of the buddy list.
--- a/stocker/gtkticker.c Sun Mar 01 18:39:32 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,513 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- * This library 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
- * Library General Public License for more details.
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02111-1301, USA.
- * GtkTicker Copyright 2000 Syd Logan
-static void gtk_ticker_compute_offsets (GtkTicker *ticker);
-static void gtk_ticker_class_init (GtkTickerClass *klass);
-static void gtk_ticker_init (GtkTicker *ticker);
-static void gtk_ticker_map (GtkWidget *widget);
-static void gtk_ticker_realize (GtkWidget *widget);
-static void gtk_ticker_size_request (GtkWidget *widget,
- GtkRequisition *requisition);
-static void gtk_ticker_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation);
-static void gtk_ticker_add_real (GtkContainer *container,
-static void gtk_ticker_remove_real (GtkContainer *container,
-static void gtk_ticker_forall (GtkContainer *container,
- gboolean include_internals,
- gpointer callback_data);
-static GtkType gtk_ticker_child_type (GtkContainer *container);
-static GtkContainerClass *parent_class = NULL;
-GType gtk_ticker_get_type (void)
- static GType ticker_type = 0;
- ticker_type = g_type_from_name("GtkTicker");
- static const GTypeInfo ticker_info =
- sizeof(GtkTickerClass),
- (GClassInitFunc) gtk_ticker_class_init,
- (GInstanceInitFunc) gtk_ticker_init
- ticker_type = g_type_register_static (GTK_TYPE_CONTAINER, "GtkTicker",
- /* kludge to re-initialise the class if it's already registered */
- else if (parent_class == NULL) {
- gtk_ticker_class_init((GtkTickerClass *)g_type_class_peek(ticker_type));
-static void gtk_ticker_finalize(GObject *object) {
- gtk_ticker_stop_scroll(GTK_TICKER(object));
- G_OBJECT_CLASS(parent_class)->finalize(object);
-static void gtk_ticker_class_init (GtkTickerClass *class)
- GObjectClass *gobject_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
- gobject_class = (GObjectClass*) class;
- widget_class = (GtkWidgetClass*) class;
- container_class = (GtkContainerClass*) class;
- parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
- gobject_class->finalize = gtk_ticker_finalize;
- widget_class->map = gtk_ticker_map;
- widget_class->realize = gtk_ticker_realize;
- widget_class->size_request = gtk_ticker_size_request;
- widget_class->size_allocate = gtk_ticker_size_allocate;
- container_class->add = gtk_ticker_add_real;
- container_class->remove = gtk_ticker_remove_real;
- container_class->forall = gtk_ticker_forall;
- container_class->child_type = gtk_ticker_child_type;
-static GtkType gtk_ticker_child_type (GtkContainer *container)
- return GTK_TYPE_WIDGET;
-static void gtk_ticker_init (GtkTicker *ticker)
- GTK_WIDGET_UNSET_FLAGS (ticker, GTK_NO_WINDOW);
- ticker->interval = (guint) 200;
- ticker->scootch = (guint) 2;
- ticker->children = NULL;
-GtkWidget* gtk_ticker_new (void)
- return GTK_WIDGET(g_object_new(GTK_TYPE_TICKER, NULL));
-static void gtk_ticker_put (GtkTicker *ticker, GtkWidget *widget)
- GtkTickerChild *child_info;
- g_return_if_fail (ticker != NULL);
- g_return_if_fail (GTK_IS_TICKER (ticker));
- g_return_if_fail (widget != NULL);
- child_info = g_new(GtkTickerChild, 1);
- child_info->widget = widget;
- gtk_widget_set_parent(widget, GTK_WIDGET (ticker));
- ticker->children = g_list_append (ticker->children, child_info);
- if (GTK_WIDGET_REALIZED (ticker))
- gtk_widget_realize (widget);
- if (GTK_WIDGET_VISIBLE (ticker) && GTK_WIDGET_VISIBLE (widget))
- if (GTK_WIDGET_MAPPED (ticker))
- gtk_widget_map (widget);
- gtk_widget_queue_resize (GTK_WIDGET (ticker));
-void gtk_ticker_set_interval (GtkTicker *ticker, gint interval)
- g_return_if_fail (ticker != NULL);
- g_return_if_fail (GTK_IS_TICKER (ticker));
- ticker->interval = interval;
-guint gtk_ticker_get_interval (GtkTicker *ticker)
- g_return_val_if_fail (ticker != NULL, -1);
- g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
- return ticker->interval;
-void gtk_ticker_set_scootch (GtkTicker *ticker, gint scootch)
- g_return_if_fail (ticker != NULL);
- g_return_if_fail (GTK_IS_TICKER (ticker));
- ticker->scootch = scootch;
-guint gtk_ticker_get_scootch (GtkTicker *ticker )
- g_return_val_if_fail (ticker != NULL, -1);
- g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
- return ticker->scootch;
-void gtk_ticker_set_spacing (GtkTicker *ticker, gint spacing )
- g_return_if_fail (ticker != NULL);
- g_return_if_fail (GTK_IS_TICKER (ticker));
- ticker->spacing = spacing;
-static int ticker_timeout(gpointer data)
- GtkTicker *ticker = (GtkTicker *) data;
- if (GTK_WIDGET_VISIBLE (ticker))
- gtk_widget_queue_resize (GTK_WIDGET (ticker));
-void gtk_ticker_start_scroll(GtkTicker *ticker)
- g_return_if_fail (ticker != NULL);
- g_return_if_fail (GTK_IS_TICKER (ticker));
- if ( ticker->timer != 0 )
- ticker->timer = g_timeout_add(ticker->interval, ticker_timeout, ticker);
-void gtk_ticker_stop_scroll(GtkTicker *ticker)
- g_return_if_fail (ticker != NULL);
- g_return_if_fail (GTK_IS_TICKER (ticker));
- if ( ticker->timer == 0 )
- g_source_remove(ticker->timer);
-guint gtk_ticker_get_spacing (GtkTicker *ticker )
- g_return_val_if_fail (ticker != NULL, -1);
- g_return_val_if_fail (GTK_IS_TICKER (ticker), -1);
- return ticker->spacing;
-static void gtk_ticker_map (GtkWidget *widget)
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TICKER (widget));
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
- ticker = GTK_TICKER (widget);
- children = ticker->children;
- child = children->data;
- children = children->next;
- if (GTK_WIDGET_VISIBLE (child->widget) &&
- !GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
- gdk_window_show (widget->window);
-static void gtk_ticker_realize (GtkWidget *widget)
- GdkWindowAttr attributes;
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TICKER (widget));
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
- attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
- attributes.wclass = GDK_INPUT_OUTPUT;
- attributes.visual = gtk_widget_get_visual (widget);
- attributes.colormap = gtk_widget_get_colormap (widget);
- attributes.event_mask = gtk_widget_get_events (widget);
- attributes.event_mask |= GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK;
- attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes, attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
-static void gtk_ticker_size_request (GtkWidget *widget, GtkRequisition *requisition)
- GtkRequisition child_requisition;
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TICKER (widget));
- g_return_if_fail (requisition != NULL);
- ticker = GTK_TICKER (widget);
- requisition->width = 0;
- requisition->height = 0;
- children = ticker->children;
- child = children->data;
- children = children->next;
- if (GTK_WIDGET_VISIBLE (child->widget))
- gtk_widget_size_request (child->widget, &child_requisition);
- requisition->height = MAX (requisition->height,
- child_requisition.height);
- requisition->width += child_requisition.width + ticker->spacing;
- if ( requisition->width > ticker->spacing )
- requisition->width -= ticker->spacing;
- requisition->height += GTK_CONTAINER (ticker)->border_width * 2;
- requisition->width += GTK_CONTAINER (ticker)->border_width * 2;
-static void gtk_ticker_compute_offsets (GtkTicker *ticker)
- GtkRequisition child_requisition;
- g_return_if_fail (ticker != NULL);
- g_return_if_fail (GTK_IS_TICKER(ticker));
- border_width = GTK_CONTAINER (ticker)->border_width;
- ticker->width = GTK_WIDGET(ticker)->allocation.width;
- children = ticker->children;
- child = children->data;
- if (GTK_WIDGET_VISIBLE (child->widget)) {
- gtk_widget_get_child_requisition (child->widget, &child_requisition);
- child->offset = ticker->total;
- child_requisition.width + border_width + ticker->spacing;
- children = children->next;
-static void gtk_ticker_size_allocate (GtkWidget *widget,
- GtkAllocation *allocation)
- GtkAllocation child_allocation;
- GtkRequisition child_requisition;
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_TICKER(widget));
- g_return_if_fail (allocation != NULL);
- ticker = GTK_TICKER (widget);
- if ( GTK_WIDGET(ticker)->allocation.width != ticker->width )
- if ( ticker->dirty == TRUE ) {
- gtk_ticker_compute_offsets( ticker );
- widget->allocation = *allocation;
- if (GTK_WIDGET_REALIZED (widget))
- gdk_window_move_resize (widget->window,
- border_width = GTK_CONTAINER (ticker)->border_width;
- children = ticker->children;
- child = children->data;
- child->x -= ticker->scootch;
- if (GTK_WIDGET_VISIBLE (child->widget)) {
- gtk_widget_get_child_requisition (child->widget, &child_requisition);
- child_allocation.width = child_requisition.width;
- child_allocation.x = child->offset + border_width + child->x;
- if ( ( child_allocation.x + child_allocation.width ) < GTK_WIDGET(ticker)->allocation.x ) {
- if ( ticker->total >= GTK_WIDGET(ticker)->allocation.width ) {
- child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width + ( ticker->total - ( GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width ) );
- child->x += GTK_WIDGET(ticker)->allocation.x + GTK_WIDGET(ticker)->allocation.width;
- child_allocation.y = border_width;
- child_allocation.height = child_requisition.height;
- gtk_widget_size_allocate (child->widget, &child_allocation);
- children = children->next;
-void gtk_ticker_add(GtkTicker *ticker, GtkWidget *widget)
- gtk_ticker_add_real( GTK_CONTAINER( ticker ), widget );
-void gtk_ticker_remove(GtkTicker *ticker, GtkWidget *widget)
- gtk_ticker_remove_real( GTK_CONTAINER( ticker ), widget );
-static void gtk_ticker_add_real(GtkContainer *container, GtkWidget *widget)
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TICKER (container));
- g_return_if_fail (widget != NULL);
- gtk_ticker_put(GTK_TICKER (container), widget);
-static void gtk_ticker_remove_real(GtkContainer *container, GtkWidget *widget)
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TICKER (container));
- g_return_if_fail (widget != NULL);
- ticker = GTK_TICKER (container);
- children = ticker->children;
- child = children->data;
- if (child->widget == widget)
- gboolean was_visible = GTK_WIDGET_VISIBLE (widget);
- gtk_widget_unparent (widget);
- ticker->children = g_list_remove_link (ticker->children, children);
- g_list_free (children);
- if (was_visible && GTK_WIDGET_VISIBLE (container))
- gtk_widget_queue_resize (GTK_WIDGET (container));
- children = children->next;
-static void gtk_ticker_forall (GtkContainer *container,
- gboolean include_internals,
- gpointer callback_data)
- g_return_if_fail (container != NULL);
- g_return_if_fail (GTK_IS_TICKER (container));
- g_return_if_fail (callback != NULL);
- ticker = GTK_TICKER (container);
- children = ticker->children;
- child = children->data;
- children = children->next;
- (* callback) (child->widget, callback_data);
--- a/stocker/gtkticker.h Sun Mar 01 18:39:32 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/* GTK - The GIMP Toolkit
- * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- * This library 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
- * Library General Public License for more details.
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02111-1301, USA.
- * Copyright 2000 Syd Logan
-#ifndef __GTK_TICKER_H__
-#define __GTK_TICKER_H__
-#include <gtk/gtkcontainer.h>
-#include <gtk/gtkmain.h>
-#endif /* __cplusplus */
-#define GTK_TYPE_TICKER (gtk_ticker_get_type ())
-#define GTK_TICKER(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TICKER, GtkTicker))
-#define GTK_TICKER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TICKER, GtkTickerClass))
-#define GTK_IS_TICKER(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TICKER))
-#define GTK_IS_TICKER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TICKER))
-typedef struct _GtkTicker GtkTicker;
-typedef struct _GtkTickerClass GtkTickerClass;
-typedef struct _GtkTickerChild GtkTickerChild;
-/* XXX children move from right to left, should be able to go other way */
- GtkContainer container;
- guint interval; /* how often to scootch */
- gint spacing; /* inter-child horizontal spacing */
- guint scootch; /* how many pixels to move each scootch */
- gint timer; /* timer object */
- gint total; /* total width of widgets */
- gint width; /* width of containing window */
- GtkContainerClass parent_class;
- gint x; /* current position */
- gint offset; /* offset in list */
-GtkType gtk_ticker_get_type (void);
-GtkWidget* gtk_ticker_new (void);
-void gtk_ticker_add (GtkTicker *ticker,
-void gtk_ticker_remove (GtkTicker *ticker,
-void gtk_ticker_set_interval (GtkTicker *ticker,
-guint gtk_ticker_get_interval (GtkTicker *ticker);
-void gtk_ticker_set_spacing (GtkTicker *ticker,
-guint gtk_ticker_get_spacing (GtkTicker *ticker);
-void gtk_ticker_set_scootch (GtkTicker *ticker,
-guint gtk_ticker_get_scootch (GtkTicker *ticker);
-void gtk_ticker_start_scroll (GtkTicker *ticker);
-void gtk_ticker_stop_scroll (GtkTicker *ticker);
-#endif /* __cplusplus */
-#endif /* __GTK_TICKER_H__ */
--- a/stocker/meson.build Sun Mar 01 18:39:32 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-if TYPES.contains('incomplete') and PIDGIN.found()
- stocker = shared_module('stocker',
- dependencies : [PIDGIN, GTK],
- install_dir : PIDGIN_LIBDIR)
- PP_PIDGIN_BUILD += 'stocker'
--- a/stocker/stocker.c Sun Mar 01 18:39:32 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,412 +0,0 @@
- * Stocker - Adds a stock ticker to the buddy list
- * Copyright (C) 2005-2008 Gary Kramlich <grim@reaperworld.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
-/* If you can't figure out what this line is for, DON'T TOUCH IT. */
-#include "../common/pp_internal.h"
-#include "stocker_prefs.h"
-#define URL_REQUEST "http://quotewebvip-m01.blue.aol.com/?action=aim&syms=%s&fields=nspg"
-#define CHANGE_INCREASE "<span color=\"green3\">%+0.04g</span>"
-#define CHANGE_DECREASE "<span color=\"red\">%+0.04g</span>"
-#define CHANGE_NONE "%0.04g"
-/******************************************************************************
- *****************************************************************************/
-#define STOCKER_QUOTE(obj) ((StockerQuote *)(obj))
-/******************************************************************************
- *****************************************************************************/
-static GtkWidget *ticker = NULL;
-static GHashTable *quotes = NULL;
-static guint quotes_id = 0, interval_id = 0, interval_timer = 0;
-/******************************************************************************
- *****************************************************************************/
-stocker_quote_new(const gchar *symbol) {
- StockerQuote *ret = g_new0(StockerQuote, 1);
- ret->symbol = g_strdup(symbol);
- label = g_strdup_printf("%s (refreshing)", symbol);
- ret->label = gtk_label_new(label);
- gtk_ticker_add(GTK_TICKER(ticker), ret->label);
- gtk_widget_show(ret->label);
-stocker_quote_ref(StockerQuote *quote) {
-stocker_quote_unref(StockerQuote *quote) {
- gtk_widget_destroy(quote->label);
-stocker_quote_update(StockerQuote *quote, const gchar *name, gdouble current,
- GString *str = g_string_sized_new(512);
- g_string_append_printf(str,
- "<span weight=\"bold\">%s</span> "
- "<span size=\"small\">(%s)</span> $%g ",
- name, quote->symbol, current);
- g_string_append_printf(str, CHANGE_DECREASE, change);
- g_string_append_printf(str, CHANGE_INCREASE, change);
- g_string_append_printf(str, CHANGE_NONE, change);
- gtk_label_set_markup(GTK_LABEL(quote->label), str->str);
- g_string_free(str, TRUE);
-/******************************************************************************
- *****************************************************************************/
-stocker_refresh_url_cb(PurpleUtilFetchUrlData *url_data, gpointer data,
- const gchar *text, gsize len, const gchar *errmsg)
- while((p = g_strstr_len(p, strlen(p), "DATA="))) {
- const gchar *name = NULL, *symbol = NULL;
- gdouble current = 0.0, change = 0.0;
- /* move paste the data text */
- /* find the current price */
- /* now move p to the EOL */
- StockerQuote *quote = g_hash_table_lookup(quotes, symbol);
- stocker_quote_update(quote, name, current, change);
-stocker_refresh_helper(gpointer k, gpointer v, gpointer d) {
- GString *str = (GString *)d;
- gchar *symbol = (gchar *)k;
- g_string_append_printf(str, "%s%s",
- (str->len > 0) ? "," : "",
- GString *syms = g_string_sized_new(64);
- g_hash_table_foreach(quotes, stocker_refresh_helper, syms);
- url = g_strdup_printf(URL_REQUEST, syms->str);
- g_string_free(syms, TRUE);
- purple_util_fetch_url(url, TRUE, "purple", TRUE,
- stocker_refresh_url_cb,
- PurpleBuddyList *blist;
- PidginBuddyList *gtkblist;
- if(GTK_IS_WIDGET(ticker))
- gtk_widget_destroy(ticker);
- blist = purple_get_blist();
- gtkblist = PIDGIN_BLIST(blist);
- ticker = gtk_ticker_new();
- gtk_box_pack_start(GTK_BOX(gtkblist->vbox), ticker, FALSE, FALSE, 0);
- gtk_ticker_set_spacing(GTK_TICKER(ticker), 16);
- gtk_ticker_start_scroll(GTK_TICKER(ticker));
- gtk_widget_show_all(ticker);
-stocker_blist_created(PurpleBuddyList *blist, gpointer data) {
-stocker_quotes_refresh(GList *symbols) {
- StockerQuote *quote = NULL;
- GHashTable *new_quotes = NULL, *temp = NULL;
- /* this is a bit more complicated than I'd like, but we need a way to be
- * able to remove quotes that we don't know by name. So we create a new
- * hashtable, copy all the existing quotes over to it, add the new ones,
- * then delete the old table and use the new one.
- new_quotes = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
- (GDestroyNotify)stocker_quote_unref);
- for(l = symbols; l; l = l->next) {
- gchar *symbol = l->data;
- /* sanity check to make sure we have a symbol */
- quote = g_hash_table_lookup(quotes, symbol);
- /* ref the quote so it stays alive */
- stocker_quote_ref(quote);
- /* this is a new symbol, create a quote for it */
- quote = stocker_quote_new(symbol);
- /* insert the quote into the new hashtable */
- g_hash_table_insert(new_quotes, g_strdup(symbol), quote);
- /* hold onto the old pointer */
- /* update the pointer to the updated list */
- /* kill the old table */
- g_hash_table_destroy(temp);
- /* refresh everything */
-stocker_quotes_changed_cb(const gchar *name, PurplePrefType type,
- gconstpointer value, gpointer data)
- stocker_quotes_refresh((GList *)value);
-stocker_refresh_cb(gpointer data) {
-stocker_interval_changed_cb(const gchar *name, PurplePrefType type,
- gconstpointer value, gpointer data)
- gint new_time = GPOINTER_TO_INT(value);
- /* remove the old timer */
- purple_timeout_remove(interval_timer);
- interval_timer = purple_timeout_add_seconds(new_time * 60,
- stocker_refresh_cb, NULL);
-/******************************************************************************
- *****************************************************************************/
-stocker_load(PurplePlugin *plugin) {
- void *prefs_handle = purple_prefs_get_handle();
- quotes = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
- (GDestroyNotify)stocker_quote_unref);
- purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created",
- PURPLE_CALLBACK(stocker_blist_created), NULL);
- quotes_id = purple_prefs_connect_callback(prefs_handle, PREF_SYMBOLS,
- stocker_quotes_changed_cb,
- interval_id = purple_prefs_connect_callback(prefs_handle, PREF_INTERVAL,
- stocker_interval_changed_cb,
- interval = 60 * purple_prefs_get_int(PREF_INTERVAL);
- interval_timer = purple_timeout_add_seconds(interval, stocker_refresh_cb,
- stocker_quotes_refresh(purple_prefs_get_string_list(PREF_SYMBOLS));
-stocker_unload(PurplePlugin *plugin) {
-stocker_destroy(PurplePlugin *plugin) {
- purple_timeout_remove(interval_timer);
- if(GTK_IS_WIDGET(ticker))
- gtk_widget_destroy(ticker);
-static PidginPluginUiInfo stocker_ui_info = { stocker_prefs_get_frame };
-static PurplePluginInfo stocker_info =
- PURPLE_PLUGIN_STANDARD,
- PURPLE_PRIORITY_DEFAULT,
- "gtk-plugin_pack-stocker",
- "Gary Kramlich <grim@reaperworld.com>",
-stocker_init(PurplePlugin *plugin) {
- bindtextdomain(GETTEXT_PACKAGE, PP_LOCALEDIR);
- bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
- stocker_info.name = _("Stocker");
- stocker_info.summary = _("A stock ticker");
- stocker_info.description =
- _("Adds a stock ticker similar to the one in the Windows AIM client to"
- " the bottom of the buddy list.");
-PURPLE_INIT_PLUGIN(stocker, stocker_init, stocker_info)
--- a/stocker/stocker_prefs.c Sun Mar 01 18:39:32 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,323 +0,0 @@
- * Stocker - Adds a stock ticker to the buddy list
- * Copyright (C) 2005-2008 Gary Kramlich <grim@reaperworld.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
-/* If you can't figure out what this line is for, DON'T TOUCH IT. */
-#include "../common/pp_internal.h"
-#include "stocker_prefs.h"
-/******************************************************************************
- *****************************************************************************/
-#define STOCKER_PREFS(obj) ((StockerPrefs *)(obj))
-/******************************************************************************
- *****************************************************************************/
-stocker_prefs_update_list(StockerPrefs *prefs) {
- gtk_list_store_clear(prefs->symbols);
- for(l = purple_prefs_get_string_list(PREF_SYMBOLS); l; l = l->next) {
- symbol = (gchar *)l->data;
- gtk_list_store_append(prefs->symbols, &iter);
- gtk_list_store_set(prefs->symbols, &iter,
-stocker_prefs_apply_helper(GtkTreeModel *model, GtkTreePath *path,
- GtkTreeIter *iter, gpointer data)
- GList **symbols = (GList **)data;
- gtk_tree_model_get(model, iter,
- *symbols = g_list_append(*symbols, symbol);
-stocker_prefs_apply_cb(GtkButton *button, gpointer data) {
- StockerPrefs *prefs = (StockerPrefs *)data;
- GList *symbols = NULL, *l;
- gtk_tree_model_foreach(GTK_TREE_MODEL(prefs->symbols),
- stocker_prefs_apply_helper, &symbols);
- purple_prefs_set_string_list(PREF_SYMBOLS, symbols);
- for(l = symbols; l; l = l->next)
-stocker_prefs_add_cb(GtkButton *button, gpointer data) {
- StockerPrefs *prefs = (StockerPrefs *)data;
- symbol = gtk_entry_get_text(GTK_ENTRY(prefs->entry));
- if(g_utf8_strlen(symbol, -1) <= 0)
- gtk_list_store_append(prefs->symbols, &iter);
- gtk_list_store_set(prefs->symbols, &iter,
- gtk_entry_set_text(GTK_ENTRY(prefs->entry), "");
-stocker_prefs_remove_cb(GtkButton *button, gpointer data) {
- StockerPrefs *prefs = (StockerPrefs *)data;
- sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(prefs->list));
- if(!gtk_tree_selection_get_selected(sel, NULL, &iter))
- gtk_tree_model_get(GTK_TREE_MODEL(prefs->symbols), &iter,
- gtk_entry_set_text(GTK_ENTRY(prefs->entry), symbol);
- gtk_list_store_remove(prefs->symbols, &iter);
-stocker_prefs_move_up_cb(GtkButton *button, gpointer data) {
- StockerPrefs *prefs = STOCKER_PREFS(data);
- GtkTreeIter siter, diter;
- sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(prefs->list));
- if(!gtk_tree_selection_get_selected(sel, NULL, &siter)) {
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(prefs->symbols), &siter);
- if(!gtk_tree_path_prev(path))
- if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(prefs->symbols), &diter, path))
- gtk_tree_path_free(path);
- gtk_tree_path_free(path);
-#if GTK_CHECK_VERSION(2,2,0)
- gtk_list_store_swap(prefs->symbols, &siter, &diter);
-# warning Someone make me work on gtk < 2.2.0
-stocker_prefs_move_down_cb(GtkButton *button, gpointer data) {
- StockerPrefs *prefs = STOCKER_PREFS(data);
- GtkTreeIter siter, diter;
- sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(prefs->list));
- if(!gtk_tree_selection_get_selected(sel, NULL, &siter)) {
- path = gtk_tree_model_get_path(GTK_TREE_MODEL(prefs->symbols), &siter);
- gtk_tree_path_next(path);
- if(!gtk_tree_model_get_iter(GTK_TREE_MODEL(prefs->symbols), &diter, path))
- gtk_tree_path_free(path);
- gtk_tree_path_free(path);
-#if GTK_CHECK_VERSION(2,2,0)
- gtk_list_store_swap(prefs->symbols, &siter, &diter);
-# warning Someone make me work on gtk < 2.2.0
-stocker_prefs_destroyed(gpointer data) {
- StockerPrefs *prefs = STOCKER_PREFS(data);
- g_object_unref(G_OBJECT(prefs->symbols));
-/******************************************************************************
- *****************************************************************************/
-stocker_prefs_init(void) {
- GList *def_syms = NULL;
- def_syms = g_list_append(def_syms, "GOOG");
- def_syms = g_list_append(def_syms, "YHOO");
- def_syms = g_list_append(def_syms, "RHT");
- def_syms = g_list_append(def_syms, "VMW");
- purple_prefs_add_none(PREF_MY);
- purple_prefs_add_none(PREF_ROOT);
- purple_prefs_add_string_list(PREF_SYMBOLS, def_syms);
- purple_prefs_add_int(PREF_INTERVAL, 30);
-stocker_prefs_get_frame(PurplePlugin *plugin) {
- StockerPrefs *prefs = g_new0(StockerPrefs, 1);
- GtkWidget *ret, *vbox, *hbox, *box, *frame, *sw, *label, *button;
- GtkTreeViewColumn *col;
- sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
- ret = gtk_vbox_new(FALSE, 4);
- gtk_container_set_border_width(GTK_CONTAINER(ret), 12);
- g_object_set_data_full(G_OBJECT(ret), "prefs", prefs,
- stocker_prefs_destroyed);
- /**********************************
- *********************************/
- frame = pidgin_make_frame(ret, _("Symbols"));
- box = gtk_hbox_new(FALSE, 4);
- gtk_box_pack_start(GTK_BOX(frame), box, FALSE, FALSE, 0);
- vbox = gtk_vbox_new(FALSE, 4);
- gtk_box_pack_start(GTK_BOX(box), vbox, FALSE, FALSE, 0);
- hbox = gtk_hbox_new(FALSE, 4);
- gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
- label = gtk_label_new(_("Symbol:"));
- gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
- gtk_size_group_add_widget(sg, label);
- gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
- prefs->entry = gtk_entry_new();
- gtk_box_pack_start(GTK_BOX(hbox), prefs->entry, FALSE, FALSE, 0);
- sw = gtk_scrolled_window_new(NULL, NULL);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN);
- gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
- /* yes we purposely keep a reference.... */
- prefs->symbols = gtk_list_store_new(1, G_TYPE_STRING);
- stocker_prefs_update_list(prefs);
- prefs->list = gtk_tree_view_new_with_model(GTK_TREE_MODEL(prefs->symbols));
- gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(prefs->list), FALSE);
- gtk_tree_view_set_reorderable(GTK_TREE_VIEW(prefs->list), TRUE);
- gtk_container_add(GTK_CONTAINER(sw), prefs->list);
- rend = gtk_cell_renderer_text_new();
- col = gtk_tree_view_column_new_with_attributes("Symbol", rend,
- gtk_tree_view_append_column(GTK_TREE_VIEW(prefs->list), col);
- vbox = gtk_vbox_new(FALSE, 4);
- gtk_box_pack_start(GTK_BOX(box), vbox, FALSE, FALSE, 0);
- button = gtk_button_new_from_stock(GTK_STOCK_ADD);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(stocker_prefs_add_cb), prefs);
- gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
- button = gtk_button_new_from_stock(GTK_STOCK_REMOVE);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(stocker_prefs_remove_cb), prefs);
- gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
- button = gtk_button_new_from_stock(GTK_STOCK_GO_DOWN);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(stocker_prefs_move_down_cb), prefs);
- gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
- button = gtk_button_new_from_stock(GTK_STOCK_GO_UP);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(stocker_prefs_move_up_cb), prefs);
- gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
- button = gtk_button_new_from_stock(GTK_STOCK_APPLY);
- g_signal_connect(G_OBJECT(button), "clicked",
- G_CALLBACK(stocker_prefs_apply_cb), prefs);
- gtk_box_pack_start(GTK_BOX(vbox), button, FALSE, FALSE, 0);
- /**********************************
- *********************************/
- frame = pidgin_make_frame(ret, _("Options"));
- pidgin_prefs_labeled_spin_button(frame, "Update interval (minutes):",
- PREF_INTERVAL, 1, 1440, sg);
- /* show and return it already! */
- gtk_widget_show_all(ret);
--- a/stocker/stocker_prefs.h Sun Mar 01 18:39:32 2020 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,39 +0,0 @@
- * Stocker - Adds a stock ticker to the buddy list
- * Copyright (C) 2005-2008 Gary Kramlich <grim@reaperworld.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
-#define PREF_MY "/plugins/gtk/plugin_pack"
-#define PREF_ROOT "/plugins/gtk/plugin_pack/stocker"
-#define PREF_SYMBOLS "/plugins/gtk/plugin_pack/stocker/symbols"
-#define PREF_INTERVAL "/plugins/gtk/plugin_pack/stocker/interval"
-void stocker_prefs_init(void);
-GtkWidget *stocker_prefs_get_frame(PurplePlugin *plugin);
-#endif /* STOCKER_PREFS_H */