# HG changeset patch # User Mark Doliner # Date 1065931831 0 # Node ID 5b94ddd51aa115c00f44b7bbd0efd3a747a09bae # Parent 7346c92b01c706a8cd5414bfddc7ca1363b51e15 [gaim-migrate @ 7812] Committing this before I break it... It saves/reads the timestamp plugin's preference. committer: Tailor Script diff -r 7346c92b01c7 -r 5b94ddd51aa1 plugins/timestamp.c --- a/plugins/timestamp.c Sun Oct 12 03:32:40 2003 +0000 +++ b/plugins/timestamp.c Sun Oct 12 04:10:31 2003 +0000 @@ -1,12 +1,32 @@ -/* iChat-like timestamps by Sean Egan. +/* + * Gaim - iChat-like timestamps + * + * Copyright (C) 2002-2003, Sean Egan + * Copyright (C) 2003, Chris J. Friesen + * + * 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. * - * Modified by: Chris J. Friesen Jan 05, 2003. - * */ + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + + #include "internal.h" #include "conversation.h" #include "debug.h" +#include "prefs.h" #include "signals.h" #include "gtkimhtml.h" @@ -16,7 +36,7 @@ #define TIMESTAMP_PLUGIN_ID "gtk-timestamp" /* Set the default to 5 minutes. */ -static int timestamp = 5 * 60 * 1000; +static int interval = 5 * 60 * 1000; static GSList *timestamp_timeouts; @@ -42,7 +62,7 @@ do_timestamp(conv); timestamp_timeouts = g_slist_append(timestamp_timeouts, - GINT_TO_POINTER(g_timeout_add(timestamp, do_timestamp, conv))); + GINT_TO_POINTER(g_timeout_add(interval, do_timestamp, conv))); } @@ -52,11 +72,12 @@ tm = 0; tm = CLAMP(gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner)), 1, G_MAXINT); - gaim_debug(GAIM_DEBUG_MISC, "timestamp", "setting time to %d mins\n", tm); + gaim_debug(GAIM_DEBUG_MISC, "timestamp", "setting time to %d mins\n", tm); tm = tm * 60 * 1000; - timestamp = tm; + interval = tm; + gaim_prefs_set_int("/plugins/gtk/timestamp/interval", interval); } static GtkWidget * @@ -81,7 +102,7 @@ label = gtk_label_new(_("Delay")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 5); - adj = (GtkAdjustment *)gtk_adjustment_new(timestamp/(60*1000), 1, G_MAXINT, 1, 0, 0); + adj = (GtkAdjustment *)gtk_adjustment_new(interval/(60*1000), 1, G_MAXINT, 1, 0, 0); spinner = gtk_spin_button_new(adj, 0, 0); gtk_box_pack_start(GTK_BOX(hbox), spinner, TRUE, TRUE, 0); @@ -116,6 +137,9 @@ "conversation-created", plugin, GAIM_CALLBACK(timestamp_new_convo), NULL); + interval = gaim_prefs_get_int("/plugins/gtk/timestamp/interval"); + gaim_debug(GAIM_DEBUG_ERROR, "XXX", "Got interval from prefs: %d\n", interval); + return TRUE; } @@ -167,6 +191,8 @@ static void init_plugin(GaimPlugin *plugin) { + gaim_prefs_add_none("/plugins/gtk/timestamp"); + gaim_prefs_add_int("/plugins/gtk/timestamp/interval", interval); } -GAIM_INIT_PLUGIN(timestamp, init_plugin, info) +GAIM_INIT_PLUGIN(interval, init_plugin, info)