changeset 8319:a2c5537a814b

[gaim-migrate @ 9043] This fixes the symbol collision, incorrect data types, lack of casting, unused variables, and comments inside comments that were preventing the new toolbar code from compiling in some cases here. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Mon, 23 Feb 2004 22:13:43 +0000
parents e45e19951e55
children 5c6c8d48946f
files src/dialogs.c src/gtkconv.c src/gtkimhtmltoolbar.c src/gtkimhtmltoolbar.h src/ui.h
diffstat 5 files changed, 64 insertions(+), 103 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Mon Feb 23 21:32:24 2004 +0000
+++ b/src/dialogs.c	Mon Feb 23 22:13:43 2004 +0000
@@ -105,45 +105,6 @@
 /*  Destroys                                                              */
 /*------------------------------------------------------------------------*/
 
-static gint delete_event_dialog(GtkWidget *w, GdkEventAny *e, GaimConversation *c)
-{
-	GaimGtkConversation *gtkconv;
-	gchar *object_data;
-
-	object_data = g_object_get_data(G_OBJECT(w), "dialog_type");
-
-	gtkconv = GAIM_GTK_CONVERSATION(c);
-
-	/*if (GTK_IS_COLOR_SELECTION_DIALOG(w)) {
-		if (w == gtkconv->dialogs.fg_color) {
-			gtk_toggle_button_set_active(
-				GTK_TOGGLE_BUTTON(gtkconv->toolbar.fgcolor), FALSE);
-			gtkconv->dialogs.fg_color = NULL;
-		} else {
-			gtk_toggle_button_set_active(
-				GTK_TOGGLE_BUTTON(gtkconv->toolbar.bgcolor), FALSE);
-			gtkconv->dialogs.bg_color = NULL;
-		}
-	} else if (GTK_IS_FONT_SELECTION_DIALOG(w)) {
-		gtk_toggle_button_set_active(
-			GTK_TOGGLE_BUTTON(gtkconv->toolbar.font), FALSE);
-		gtkconv->dialogs.font = NULL;
-	} else if (!g_ascii_strcasecmp(object_data, "smiley dialog")) {
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(gtkconv->toolbar.smiley),
-									FALSE);
-		gtkconv->dialogs.smiley = NULL;
-	} else if (!g_ascii_strcasecmp(object_data, "log dialog")) {
-		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->toolbar.log),
-									   FALSE);
-		gtkconv->dialogs.log = NULL;
-		}*/
-
-	dialogwindows = g_list_remove(dialogwindows, w);
-	gtk_widget_destroy(w);
-
-	return FALSE;
-}
-
 static void destroy_dialog(GtkWidget *w, GtkWidget *w2)
 {
 	GtkWidget *dest;
@@ -579,7 +540,6 @@
 void show_fgcolor_dialog(GaimConversation *c, GtkWidget *color)
 {
 	GaimGtkConversation *gtkconv;
-	GtkWidget *colorsel;
 	GdkColor fgcolor;
 
 	gtkconv = GAIM_GTK_CONVERSATION(c);
@@ -608,7 +568,6 @@
 void show_bgcolor_dialog(GaimConversation *c, GtkWidget *color)
 {
 	GaimGtkConversation *gtkconv;
-	GtkWidget *colorsel;
 	GdkColor bgcolor;
 
 	gtkconv = GAIM_GTK_CONVERSATION(c);
@@ -835,7 +794,7 @@
 	gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
 
 	ca->text = gtk_imhtml_new(NULL, NULL);
-	gtk_imhtml_set_editable(ca->text, TRUE);
+	gtk_imhtml_set_editable(GTK_IMHTML(ca->text), TRUE);
 	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(ca->text), GTK_WRAP_WORD_CHAR);
 
 	if (gaim_prefs_get_bool("/gaim/gtk/conversations/spellcheck"))
@@ -847,12 +806,9 @@
 	if (dummy) {
 		struct away_message *amt;
 		GtkTreeIter iter;
-		int pos = 0;
 		GtkListStore *ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dummy)));
 		GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dummy));
 		GValue val = { 0, };
-		GtkTextIter start;
-		GtkTextBuffer *buffer;
 
 		if (! gtk_tree_selection_get_selected (sel, (GtkTreeModel**)&ls, &iter))
 			return;
--- a/src/gtkconv.c	Mon Feb 23 21:32:24 2004 +0000
+++ b/src/gtkconv.c	Mon Feb 23 22:13:43 2004 +0000
@@ -2281,20 +2281,22 @@
 		}
 
 		/* Deal with the toolbar */
-		/*gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE);
+#if 0
+		gtk_widget_set_sensitive(gtkconv->toolbar.link, TRUE);
 		gtk_widget_set_sensitive(gtkconv->toolbar.image,
 								 (prpl_info->options & OPT_PROTO_IM_IMAGE));
 		gtk_widget_set_sensitive(gtkconv->toolbar.bgcolor,
 								 !(gc->flags & GAIM_CONNECTION_NO_BGCOLOR));
 
-		/* Deal with menu items 
+		/* Deal with menu items */
 		gtk_widget_set_sensitive(gtkwin->menu.view_log, TRUE);
 		gtk_widget_set_sensitive(gtkwin->menu.add_pounce, TRUE);
 		gtk_widget_set_sensitive(gtkwin->menu.get_info, (prpl_info->get_info != NULL));
 		gtk_widget_set_sensitive(gtkwin->menu.warn, (prpl_info->warn != NULL));
 		gtk_widget_set_sensitive(gtkwin->menu.invite,
 								 (prpl_info->chat_invite != NULL));
-*/
+#endif
+
 		if (gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
 			if (gaim_find_buddy(gaim_conversation_get_account(conv),
 					    gaim_conversation_get_name(conv)) == NULL)
@@ -3740,7 +3742,8 @@
 
 	gtk_container_add(GTK_CONTAINER(sw), GTK_WIDGET(gtkconv->entry));
 	gtk_widget_show(gtkconv->entry);
-	gtk_imhtmltoolbar_attach(gtkconv->toolbar, gtkconv->entry);
+	gtk_imhtmltoolbar_attach(GTK_IMHTMLTOOLBAR(gtkconv->toolbar),
+							 gtkconv->entry);
 
 	gtkconv->bbox = gtk_hbox_new(FALSE, 6);
 	gtk_box_pack_start(GTK_BOX(vbox2), gtkconv->bbox, FALSE, FALSE, 0);
--- a/src/gtkimhtmltoolbar.c	Mon Feb 23 21:32:24 2004 +0000
+++ b/src/gtkimhtmltoolbar.c	Mon Feb 23 22:13:43 2004 +0000
@@ -20,16 +20,17 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
+#include "gtkinternal.h"
 
-#include <gtk/gtk.h>
-#include <gtk/gtkvbox.h>
 #include "gtkimhtmltoolbar.h"
 #include "gtkutils.h"
+
+#include "imgstore.h"
 #include "notify.h"
 #include "request.h"
 #include "stock.h"
-#include "internal.h"
 #include "ui.h"
+#include "util.h"
 
 static GtkVBoxClass *parent_class = NULL;
 
@@ -111,16 +112,18 @@
 static void
 toggle_font(GtkWidget *font, GtkIMHtmlToolbar *toolbar)
 {
+#if 0
 	char fonttif[128];
 	const char *fontface;
-	
+#endif
+
 	g_return_if_fail(toolbar);
-	
+
 	if (!toolbar->font_dialog) {
 		toolbar->font_dialog = gtk_font_selection_dialog_new(_("Select Font"));
 
 		g_object_set_data(G_OBJECT(toolbar->font_dialog), "gaim_toolbar", toolbar);
-		
+
 		/*	if (gtkconv->fontface[0]) {
 		  g_snprintf(fonttif, sizeof(fonttif), "%s 12", gtkconv->fontface);
 		  gtk_font_selection_dialog_set_font_name(GTK_FONT_SELECTION_DIALOG(gtkconv->dialogs.font),
@@ -130,15 +133,15 @@
 		  DEFAULT_FONT_FACE);
 		  }
 		*/
-		
+
 		g_signal_connect(G_OBJECT(toolbar->font_dialog), "delete_event",
 				 G_CALLBACK(toolbar_cancel_font), toolbar);
 		g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->ok_button),
 				 "clicked", G_CALLBACK(apply_font), toolbar->font_dialog);
 		g_signal_connect(G_OBJECT(GTK_FONT_SELECTION_DIALOG(toolbar->font_dialog)->cancel_button),
 				 "clicked", G_CALLBACK(toolbar_cancel_font), toolbar);
-		
-		
+
+
 		gtk_window_present(GTK_WINDOW(toolbar->font_dialog));
 	} else {
 		toolbar_cancel_font(NULL, toolbar);
@@ -148,7 +151,7 @@
 
 static void cancel_toolbar_fgcolor(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
 {
-       	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->fgcolor), FALSE);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->fgcolor), FALSE);
 	gtk_widget_destroy(toolbar->fgcolor_dialog);
 	toolbar->fgcolor_dialog = NULL;
 }
@@ -176,17 +179,17 @@
 {
 	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) {
 		GtkWidget *colorsel;
-		GdkColor fgcolor;
-		
+		/* GdkColor fgcolor; */
+
 		/*gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"),
 		  &fgcolor);*/
 		if (!toolbar->fgcolor_dialog) {
-			
+
 			toolbar->fgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color"));
 			colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->colorsel;
 			//gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &fgcolor);
 			g_object_set_data(G_OBJECT(colorsel), "gaim_toolbar", toolbar);
-			
+
 			g_signal_connect(G_OBJECT(toolbar->fgcolor_dialog), "delete_event",
 					 G_CALLBACK(cancel_toolbar_fgcolor), toolbar);
 			g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->ok_button),
@@ -194,9 +197,9 @@
 			g_signal_connect(G_OBJECT
 					 (GTK_COLOR_SELECTION_DIALOG(toolbar->fgcolor_dialog)->cancel_button),
 					 "clicked", G_CALLBACK(cancel_toolbar_fgcolor), toolbar);
-			
+
 		}
-		gtk_window_present(toolbar->fgcolor_dialog);
+		gtk_window_present(GTK_WINDOW(toolbar->fgcolor_dialog));
 	} else if (toolbar->fgcolor_dialog != NULL) {
 		cancel_toolbar_fgcolor(color, toolbar);
 	} else {
@@ -235,17 +238,17 @@
 {
 	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(color))) {
 		GtkWidget *colorsel;
-		GdkColor bgcolor;
-		
+		/* GdkColor bgcolor; */
+
 		/*gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"),
 		  &bgcolor);*/
 		if (!toolbar->bgcolor_dialog) {
-			
+
 			toolbar->bgcolor_dialog = gtk_color_selection_dialog_new(_("Select Text Color"));
 			colorsel = GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->colorsel;
 			//gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(colorsel), &bgcolor);
 			g_object_set_data(G_OBJECT(colorsel), "gaim_toolbar", toolbar);
-			
+
 			g_signal_connect(G_OBJECT(toolbar->bgcolor_dialog), "delete_event",
 					 G_CALLBACK(cancel_toolbar_bgcolor), toolbar);
 			g_signal_connect(G_OBJECT(GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->ok_button),
@@ -253,9 +256,9 @@
 			g_signal_connect(G_OBJECT
 					 (GTK_COLOR_SELECTION_DIALOG(toolbar->bgcolor_dialog)->cancel_button),
 					 "clicked", G_CALLBACK(cancel_toolbar_bgcolor), toolbar);
-			
+
 		}
-		gtk_window_present(toolbar->bgcolor_dialog);
+		gtk_window_present(GTK_WINDOW(toolbar->bgcolor_dialog));
 	} else if (toolbar->bgcolor_dialog != NULL) {
 		cancel_toolbar_bgcolor(color, toolbar);
 	} else {
@@ -267,7 +270,7 @@
 static void
 cancel_link_cb(GtkIMHtmlToolbar *toolbar, GaimRequestFields *fields)
 {
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE);	
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE);
 	toolbar->link_dialog = NULL;
 }
 
@@ -293,7 +296,7 @@
 		description = url;
 
 	gtk_imhtml_insert_link(GTK_IMHTML(toolbar->imhtml), url, description);
-	
+
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->link), FALSE);
 
 	toolbar->link_dialog = NULL;
@@ -306,20 +309,20 @@
 		GaimRequestFields *fields;
 		GaimRequestFieldGroup *group;
 		GaimRequestField *field;
-		
+
 		fields = gaim_request_fields_new();
-		
+
 		group = gaim_request_field_group_new(NULL);
 		gaim_request_fields_add_group(fields, group);
-		
+
 		field = gaim_request_field_string_new("url", _("_URL"), NULL, FALSE);
 		gaim_request_field_set_required(field, TRUE);
 		gaim_request_field_group_add_field(group, field);
-		
+
 		field = gaim_request_field_string_new("description", _("_Description"),
 						      NULL, FALSE);
 		gaim_request_field_group_add_field(group, field);
-		
+
 		toolbar->link_dialog =
 			gaim_request_fields(toolbar, _("Insert Link"),
 					    NULL,
@@ -433,7 +436,7 @@
 void close_smiley_dialog(GtkWidget *widget, GtkIMHtmlToolbar *toolbar)
 {
 	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toolbar->smiley), FALSE);
-	
+
 	if (toolbar->smiley_dialog) {
 		gtk_widget_destroy(toolbar->smiley_dialog);
 		toolbar->smiley_dialog = NULL;
@@ -489,27 +492,27 @@
 insert_smiley_cb(GtkWidget *smiley, GtkIMHtmlToolbar *toolbar)
 {
 	if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(smiley))) {
-	
+
 		GtkWidget *dialog;
 		GtkWidget *smiley_table = NULL;
 		GSList *smileys, *unique_smileys = NULL;
 		int width;
 		int row = 0, col = 0;
-		
+
 		if (toolbar->smiley_dialog) {
 			gtk_widget_grab_focus(toolbar->imhtml);
 			return;
 		}
-		
+
 		/*
 		  if(c->account)
 		  smileys = get_proto_smileys(
 		  gaim_account_get_protocol_id(gaim_conversation_get_account(c)));
 		  else
 		*/
-		
+
 		smileys = get_proto_smileys(GAIM_PROTO_DEFAULT);
-		
+
 		while(smileys) {
 			GtkIMHtmlSmiley *smiley = smileys->data;
 			if(!smiley->hidden) {
@@ -518,19 +521,19 @@
 			}
 			smileys = smileys->next;
 		}
-		
-		
+
+
 		width = floor(sqrt(g_slist_length(unique_smileys)));
-		
+
 		GAIM_DIALOG(dialog);
 		gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE);
 		gtk_window_set_role(GTK_WINDOW(dialog), "smiley_dialog");
 		gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_MOUSE);
-		
+
 		smiley_table = gtk_table_new(width, width, TRUE);
-		
+
 		/* pack buttons */
-		
+
 		while(unique_smileys) {
 			GtkIMHtmlSmiley *smiley = unique_smileys->data;
 			if(!smiley->hidden) {
@@ -542,24 +545,24 @@
 			}
 			unique_smileys = unique_smileys->next;
 		}
-		
+
 		gtk_container_add(GTK_CONTAINER(dialog), smiley_table);
-		
+
 		gtk_widget_show(smiley_table);
-		
+
 		gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
-		
+
 		/* connect signals */
 		g_object_set_data(G_OBJECT(dialog), "dialog_type", "smiley dialog");
 		g_signal_connect(G_OBJECT(dialog), "delete_event",
 				 G_CALLBACK(close_smiley_dialog), toolbar);
-		
+
 		/* show everything */
 		gtk_window_set_title(GTK_WINDOW(dialog), _("Smile!"));
 		gtk_widget_show_all(dialog);
-		
+
 		toolbar->smiley_dialog = dialog;
-		
+
 	} else if (toolbar->smiley_dialog) {
 		close_smiley_dialog(smiley, toolbar);
 	}
@@ -756,7 +759,7 @@
 	gtk_tooltips_set_tip(toolbar->tooltips, button, _("Insert link"), NULL);
 	g_signal_connect(G_OBJECT(button), "clicked",
 				 G_CALLBACK(insert_link_cb), toolbar);
-	
+
 	toolbar->link = button;
 
 	/* Insert IM Image */
@@ -815,7 +818,7 @@
 			(GInstanceInitFunc) gtk_imhtmltoolbar_init
 		};
 
-		imhtmltoolbar_type = g_type_register_static(gtk_vbox_get_type(),
+		imhtmltoolbar_type = g_type_register_static(GTK_TYPE_VBOX,
 				"GtkIMHtmlToolbar", &imhtmltoolbar_info, 0);
 	}
 
--- a/src/gtkimhtmltoolbar.h	Mon Feb 23 21:32:24 2004 +0000
+++ b/src/gtkimhtmltoolbar.h	Mon Feb 23 22:13:43 2004 +0000
@@ -45,11 +45,11 @@
 	GtkWidget *imhtml;
 
 	GtkTooltips *tooltips;
-	
+
 	GtkWidget *bold;
 	GtkWidget *italic;
 	GtkWidget *underline;
-	
+
 	GtkWidget *larger_size;
 	GtkWidget *normal_size;
 	GtkWidget *smaller_size;
@@ -76,7 +76,7 @@
 
 };
 
-GtkType    gtk_imhtmltoolbar_get_type         (void);
+GType      gtk_imhtmltoolbar_get_type         (void);
 GtkWidget* gtk_imhtmltoolbar_new              (void);
 
 void gtk_imhtmltoolbar_attach    (GtkIMHtmlToolbar *toolbar, GtkWidget *imhtml);
--- a/src/ui.h	Mon Feb 23 21:32:24 2004 +0000
+++ b/src/ui.h	Mon Feb 23 22:13:43 2004 +0000
@@ -139,7 +139,6 @@
 extern void set_smiley_array(GtkWidget *widget, int smiley_type);
 extern void show_font_dialog(GaimConversation *c, GtkWidget *font);
 extern void cancel_font(GtkWidget *widget, GaimConversation *c);
-extern void apply_font(GtkWidget *widget, GtkFontSelection *fontsel);
 extern void destroy_fontsel(GtkWidget *w, gpointer d);
 
 /* Functions in server.c */