changeset 570:93c65fbaa622

[gaim-migrate @ 580] switched the smiley button to a toggle button so that all the other toggle buttons on the playground would stop making fun of her... also added save and cancel buttons to the pref dialog, with pretty pixmaps to boot! committer: Tailor Script <tailor@pidgin.im>
author Todd Kulesza <fflewddur>
date Tue, 01 Aug 2000 22:32:21 +0000
parents b8f0402090bb
children feccb7afc81d
files src/conversation.c src/dialogs.c src/gaimrc.c src/prefs.c
diffstat 4 files changed, 103 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/src/conversation.c	Tue Aug 01 20:50:59 2000 +0000
+++ b/src/conversation.c	Tue Aug 01 22:32:21 2000 +0000
@@ -316,16 +316,15 @@
 		show_log_dialog(p->name);
 }
 
-void insert_smiley(GtkWidget *widget, struct conversation *c)
+void insert_smiley(GtkWidget *smiley, struct conversation *c)
 {
 	if (state_lock)
 		return;
-		
-	if (c->smiley_dialog)
-		close_smiley_dialog(widget, c);
-	else
-		show_smiley_dialog(c, NULL);
-		
+	if (GTK_TOGGLE_BUTTON(smiley)->active)
+		show_smiley_dialog(c, smiley);
+	else if (c->smiley_dialog)
+		close_smiley_dialog(smiley, c);
+	
 	return;
 }
 
@@ -1297,9 +1296,9 @@
 					    NULL, _("Logging"), _("Enable logging"),
                                           _("Logging"), wood_p, GTK_SIGNAL_FUNC(toggle_loggle), c);
 	smiley = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
-						GTK_TOOLBAR_CHILD_BUTTON,
-						NULL, _("Smiley"), _("Insert smiley face"),
-						_("Smiley"), smiley_p, GTK_SIGNAL_FUNC(insert_smiley), c);
+						GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
+						NULL, _("Smiley"), _("Insert smiley face"), _("Smiley"),
+						 smiley_p, GTK_SIGNAL_FUNC(insert_smiley), c);
         speaker = gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
 		                            GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
 					    NULL, _("Sound"), _("Enable sounds"),
@@ -1342,6 +1341,7 @@
 	c->palette = palette;
 	c->link = link;  
 	c->font = font;
+	c->smiley = smiley;
 
         gtk_widget_set_sensitive(c->log_button, ((general_options & OPT_GEN_LOG_ALL)) ? FALSE : TRUE);
         
@@ -1501,6 +1501,7 @@
 
 	c->font_dialog = NULL;
 	c->color_dialog = NULL;	
+	c->smiley_dialog = NULL;
 	
 	gtk_container_add(GTK_CONTAINER(win), paned);
         gtk_container_border_width(GTK_CONTAINER(win), 10);
--- a/src/dialogs.c	Tue Aug 01 20:50:59 2000 +0000
+++ b/src/dialogs.c	Tue Aug 01 22:32:21 2000 +0000
@@ -2889,8 +2889,6 @@
 				fontface[k++] = fontname[i];
 		}
 		fontface[k] = '\0';
-	
-		save_prefs();
 	}
 	
 	cancel_font(NULL, c);
@@ -2918,7 +2916,6 @@
 			fontface[k++] = fontname[i];
 	}
 	fontface[k] = '\0';
-	save_prefs();
 }
 
 void show_font_dialog(struct conversation *c, GtkWidget *font)
@@ -3383,6 +3380,12 @@
 
 void close_smiley_dialog(GtkWidget *widget, struct conversation *c)
 {	
+	if (c->smiley)
+	{
+		set_state_lock(1);
+		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(c->smiley), FALSE);
+		set_state_lock(0);
+	}
 	dialogwindows = g_list_remove(dialogwindows, c->smiley_dialog);
 	gtk_widget_destroy(c->smiley_dialog);
 	c->smiley_dialog = NULL;	
--- a/src/gaimrc.c	Tue Aug 01 20:50:59 2000 +0000
+++ b/src/gaimrc.c	Tue Aug 01 22:32:21 2000 +0000
@@ -527,6 +527,16 @@
 
 void set_defaults()
 {
+        if (aim_users)
+        {
+        	g_list_free(aim_users);
+        	aim_users = NULL;
+        }
+        if (away_messages)
+        {
+        	g_list_free(away_messages);
+        	away_messages = NULL;
+        }
         general_options =
                 OPT_GEN_SEND_LINKS |
                 OPT_GEN_ENTER_SENDS |
@@ -568,7 +578,7 @@
 	FILE *f;
 	char buf[1024];
 	int ver = 0;
-	
+
         if (getenv("HOME")) {
                 g_snprintf(buf, sizeof(buf), "%s/.gaimrc", getenv("HOME"));
 		if ((f = fopen(buf,"r"))) {
--- a/src/prefs.c	Tue Aug 01 20:50:59 2000 +0000
+++ b/src/prefs.c	Tue Aug 01 22:32:21 2000 +0000
@@ -35,6 +35,8 @@
 #include "gaim.h"
 #include "proxy.h"
 #include "gnome_applet_mgr.h"
+#include "pixmaps/save.xpm"
+#include "pixmaps/cancel.xpm"
 
 struct prefs_data *pd = NULL;
 struct debug_window *dw = NULL;
@@ -95,7 +97,6 @@
         if (pd == NULL)
                 return;
 	strcpy(a->message, pd->edited_message);
-	save_prefs();
 }
 
 void set_option(GtkWidget *w, int *option)
@@ -112,14 +113,11 @@
 #ifdef USE_APPLET
 	update_pixmaps();
 #endif
-
-	save_prefs();
 }
 
 void set_sound_option(GtkWidget *w, int *option)
 {
 	sound_options = sound_options ^ (int)option;
-	save_prefs();
 }
 
 void set_font_option(GtkWidget *w, int *option)
@@ -127,8 +125,6 @@
 	font_options = font_options ^ (int)option;
 
 	update_font_buttons();	
-
-	save_prefs();
 }
 
 void set_general_option(GtkWidget *w, int *option)
@@ -139,7 +135,6 @@
        		update_lagometer(-1);
        	if ((int)option == OPT_GEN_LOG_ALL)
        		update_log_convs();
-	save_prefs();
 
 	/*
         if (data == &show_grp_nums)
@@ -162,7 +157,6 @@
 	if (general_options & OPT_GEN_DEBUG)
 	{
 		general_options = general_options ^ (int)OPT_GEN_DEBUG;
-		save_prefs();
 	}
 	g_free(dw);
 	dw=NULL;
@@ -190,7 +184,6 @@
 
 	}
 	
-	save_prefs();
 
 	if (event == NULL)
 	{
@@ -207,8 +200,8 @@
 static int
 manualentry_key_pressed(GtkWidget *w, GdkEvent *event, void *dummy)
 {
-        g_snprintf(web_command, sizeof(web_command), "%s", gtk_entry_get_text(GTK_ENTRY(pd->browser_entry)));
-        save_prefs();
+    g_snprintf(web_command, sizeof(web_command), "%s", gtk_entry_get_text(GTK_ENTRY(pd->browser_entry)));
+
 	return TRUE;
 }
 
@@ -224,7 +217,6 @@
 
 	g_snprintf(login_host, sizeof(login_host), "%s", gtk_entry_get_text(GTK_ENTRY(pd->login_host_entry)));
 	sscanf(gtk_entry_get_text(GTK_ENTRY(pd->login_port_entry)), "%d", &login_port);	
-	save_prefs();
 	return TRUE;
 }
 
@@ -249,9 +241,6 @@
                 if (pd->nwbutton)
                         gtk_widget_set_sensitive(pd->nwbutton, TRUE);
         }
-        
-
-        save_prefs();
 }
 
 static void set_connect(GtkWidget *w, int *data)
@@ -269,13 +258,11 @@
 			gtk_widget_set_sensitive(pd->proxy_port_entry, FALSE);
 	}
         
-        save_prefs();
 }
 
 static void set_idle(GtkWidget *w, int *data)
 {
 	report_idle = (int)data;
-        save_prefs();
 }
 
 
@@ -301,7 +288,6 @@
 	return button;
 }
 
-
 void build_prefs()
 {
 	GtkWidget *bbox;
@@ -316,7 +302,6 @@
 	GtkWidget *away_botbox;
 	GtkWidget *add_away;
 	GtkWidget *remove_away;
-	GtkWidget *close;
 	GtkWidget *notebook;
 	GtkWidget *sound_page;
 	/* GtkWidget *debug_page; */
@@ -335,7 +320,7 @@
         GtkWidget *label;
         GtkWidget *browseropt;
         GtkWidget *idleopt;
-	        
+	    
         GList *awy = away_messages;
         struct away_message *a;
         GtkWidget *sw;
@@ -343,8 +328,10 @@
 	GtkWidget *away_page;
 	GtkWidget *select_font;
 	GtkWidget *font_face_for_text;
-	
 	GtkWidget *list_item;
+	GtkWidget *button_box, *save, *cancel, *icon_i, *button_label;
+	GdkBitmap *mask;
+	GdkPixmap *icon;
 
 	gchar buffer[64];
 
@@ -812,22 +799,82 @@
 	gtk_widget_show(chat_page);
 	
 	bbox = gtk_hbox_new(FALSE, 5);
-	close = gtk_button_new_with_label(_("Close"));
+
+	/* Build Save Button */
+
+	save = gtk_button_new();
+
+	button_box = gtk_hbox_new(FALSE, 5);
+	icon = gdk_pixmap_create_from_xpm_d ( pd->window->window, &mask, NULL, save_xpm);
+
+	icon_i = gtk_pixmap_new(icon, mask);
+	
+	button_label = gtk_label_new(_("Save"));
+
+	gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2);
+	gtk_box_pack_end(GTK_BOX(button_box), button_label, FALSE, FALSE, 2);
+
+	gtk_widget_show(button_label);
+	gtk_widget_show(icon_i);
+
+	gtk_widget_show(button_box);
+
+	gtk_container_add(GTK_CONTAINER(save), button_box);
+	
+	/* End of Save Button */
+		
+	/* Build Cancel Button */
+
+	cancel = gtk_button_new();
+
+	button_box = gtk_hbox_new(FALSE, 5);
+	icon = gdk_pixmap_create_from_xpm_d ( pd->window->window, &mask, NULL, cancel_xpm);
+
+	icon_i = gtk_pixmap_new(icon, mask);
+	
+	button_label = gtk_label_new(_("Cancel"));
+
+	gtk_box_pack_start(GTK_BOX(button_box), icon_i, FALSE, FALSE, 2);
+	gtk_box_pack_end(GTK_BOX(button_box), button_label, FALSE, FALSE, 2);
+
+	gtk_widget_show(button_label);
+	gtk_widget_show(icon_i);
+
+	gtk_widget_show(button_box);
+
+	gtk_container_add(GTK_CONTAINER(cancel), button_box);
+	
+	/* End of Cancel Button */
+
+
 	if (display_options & OPT_DISP_COOL_LOOK)
-		gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE);
+	{
+		gtk_button_set_relief(GTK_BUTTON(save), GTK_RELIEF_NONE);
+		gtk_button_set_relief(GTK_BUTTON(cancel), GTK_RELIEF_NONE);
+	}
+	
+/*	close = gtk_button_new_with_label(_("Close"));
+	if (display_options & OPT_DISP_COOL_LOOK)
+		gtk_button_set_relief(GTK_BUTTON(close), GTK_RELIEF_NONE);*/
 	
 	/* Pack the button(s) in the button box */
-	gtk_box_pack_end(GTK_BOX(bbox), close, FALSE, FALSE, 5);
+	gtk_box_pack_end(GTK_BOX(bbox), cancel, FALSE, FALSE, 5);
+	gtk_box_pack_end(GTK_BOX(bbox), save, FALSE, FALSE, 5);
 	gtk_box_pack_start(GTK_BOX(vbox),bbox, FALSE, FALSE, 5);
 
 	gtk_widget_show(notebook);
-        gtk_widget_show(close);
-
+ 	gtk_widget_show(save);
+ 	gtk_widget_show(cancel);
+ 
 	gtk_widget_show(bbox);
 	gtk_widget_show(vbox);
 
-	gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(handle_delete), NULL);
-        gtk_signal_connect(GTK_OBJECT(pd->window),"delete_event", GTK_SIGNAL_FUNC(handle_delete), NULL);
+	gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(save_prefs), NULL);
+	gtk_signal_connect(GTK_OBJECT(save), "clicked", GTK_SIGNAL_FUNC(handle_delete), NULL);
+	gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(set_defaults), NULL);
+	gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(load_prefs), NULL);
+	gtk_signal_connect(GTK_OBJECT(cancel), "clicked", GTK_SIGNAL_FUNC(handle_delete), NULL);
+	gtk_signal_connect(GTK_OBJECT(pd->window),"delete_event", GTK_SIGNAL_FUNC(handle_delete), NULL);
 
 }
 
@@ -866,9 +913,6 @@
 	chat_rooms = g_list_append(chat_rooms, cr2);
 
 	setup_buddy_chats();
-	save_prefs();
-	
-
 }
 
 void remove_chat(GtkWidget *w, struct chat_page *cp)
@@ -906,7 +950,6 @@
 	}
 
 	setup_buddy_chats();
-        save_prefs();
 }
 
 void refresh_list(GtkWidget *w, struct chat_page *cp)