diff src/gtkutils.c @ 7420:53c86d59f20b

[gaim-migrate @ 8022] (19:08:24) deryni: Paco-Paco can stop wanting to kill Sean for using ctrl-f in conversations, and all the rest of you can have fun making offline buddies take priority over online ones (I'm sure you'll figure it out =) and a change from free() to g_free() in yahoo from zuperdee, since g_free is theoretically doing more error checking committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 04 Nov 2003 00:10:29 +0000
parents 2737c287f84d
children 357eb1c39b72
line wrap: on
line diff
--- a/src/gtkutils.c	Mon Nov 03 16:42:32 2003 +0000
+++ b/src/gtkutils.c	Tue Nov 04 00:10:29 2003 +0000
@@ -49,6 +49,8 @@
 #include "wspell.h"
 #endif
 
+guint accels_save_timer = 0;
+
 static void
 url_clicked_cb(GtkWidget *w, const char *uri)
 {
@@ -1077,3 +1079,40 @@
 		gdk_pixbuf_loader_close(loader, NULL);
 	}
 }
+
+void
+gaim_gtk_save_accels_cb(GtkAccelGroup *accel_group, guint arg1,
+														 GdkModifierType arg2, GClosure *arg3,
+														 gpointer data)
+{
+	gaim_debug(GAIM_DEBUG_MISC, "accels", "accel changed, scheduling save.\n");
+
+	if (!accels_save_timer)
+		accels_save_timer = g_timeout_add(5000, gaim_gtk_save_accels, NULL);
+}
+
+gboolean
+gaim_gtk_save_accels(gpointer data)
+{
+	char *filename = NULL;
+
+	filename = g_build_filename(gaim_user_dir(), G_DIR_SEPARATOR_S,
+															"accels", NULL);
+	gaim_debug(GAIM_DEBUG_MISC, "accels", "saving accels to %s\n", filename);
+	gtk_accel_map_save(filename);
+	g_free(filename);
+
+	accels_save_timer = 0;
+	return FALSE;
+}
+
+void
+gaim_gtk_load_accels(gpointer data)
+{
+	char *filename = NULL;
+
+	filename = g_build_filename(gaim_user_dir(), G_DIR_SEPARATOR_S,
+															"accels", NULL);
+	gtk_accel_map_load(filename);
+	g_free(filename);
+}