diff src/gnome_applet_mgr.c @ 18:99d91a6c2fbf

[gaim-migrate @ 27] Yet another patch by Eric. Someone needs to stop this boy :) committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Thu, 23 Mar 2000 18:40:39 +0000
parents 5cdd1f11db02
children 2c150f36612b
line wrap: on
line diff
--- a/src/gnome_applet_mgr.c	Thu Mar 23 12:44:52 2000 +0000
+++ b/src/gnome_applet_mgr.c	Thu Mar 23 18:40:39 2000 +0000
@@ -249,11 +249,7 @@
                 _("Signoff"),
                 signoff,
                 NULL);
-	applet_widget_register_callback(APPLET_WIDGET(applet),
-		"away",
-		_("Away Message"),
-		show_away_mess,
-		NULL);
+	insert_applet_away();
         applet_widget_register_callback(APPLET_WIDGET(applet),
                 "buddy",
                 _("Buddy List"),
@@ -261,6 +257,59 @@
                 NULL);
 }
 
+void insert_applet_away() {
+	GList *awy = away_messages;
+	struct away_message *a;
+	char  *awayname;
+
+	applet_widget_register_callback_dir(APPLET_WIDGET(applet),
+		"away",
+		_("Away"));
+	applet_widget_register_callback(APPLET_WIDGET(applet),
+		"away/new",
+		_("New Away Message"),
+		(AppletCallbackFunc)create_away_mess,
+		NULL);
+
+	while(awy) {
+		a = (struct away_message *)awy->data;
+
+		awayname = malloc(sizeof *awayname * (6 + strlen(a->name)));
+		awayname[0] = '\0';
+		strcat(awayname, "away/");
+		strcat(awayname, a->name);
+		applet_widget_register_callback(APPLET_WIDGET(applet),
+			awayname,
+			a->name,
+			(AppletCallbackFunc)do_away_message,
+			a);
+
+		awy = awy->next;
+	}
+}
+
+void remove_applet_away() {
+	GList *awy = away_messages;
+	struct away_message *a;
+	char  *awayname;
+
+	applet_widget_unregister_callback(APPLET_WIDGET(applet), "away/new");
+
+	while (awy) {
+		a = (struct away_message *)awy->data;
+
+		awayname = malloc(sizeof *awayname * (5 + strlen(a->name)));
+		awayname[0] = '\0';
+		strcat(awayname, "away/");
+		strcat(awayname, a->name);
+		applet_widget_unregister_callback(APPLET_WIDGET(applet), awayname);
+
+		awy = awy->next;
+	}
+	applet_widget_unregister_callback_dir(APPLET_WIDGET(applet), "away");
+	applet_widget_unregister_callback(APPLET_WIDGET(applet), "away");
+}
+
 /***************************************************************
 **
 ** function applet_show_about
@@ -411,15 +460,6 @@
      applet_draw_open = FALSE;
 }
 
-/**************************************************
-**
-**  Dummy function to fix compiles for gnome
-**  Feel free to implement an away message
-**
-***************************************************/ 
-void show_away_mess( AppletWidget *widget, gpointer data ) {
-}
-
 void AppletClicked( GtkWidget *sender, gpointer data ){
         
 	if( applet_draw_open ){