changeset 21971:07eb63fa0bdb

Modified patch from Gabriel (Sylar?) Schulof to deprecate PIDGIN_DIALOG. Closes #4535. (PS: I am aware of --author).
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Wed, 02 Jan 2008 12:04:27 +0000
parents a83a70314f8a
children 07970e819720
files ChangeLog.API pidgin/gtkdebug.c pidgin/gtkdialogs.c pidgin/gtkdialogs.h pidgin/gtkimhtmltoolbar.c
diffstat 5 files changed, 14 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog.API	Wed Jan 02 11:05:09 2008 +0000
+++ b/ChangeLog.API	Wed Jan 02 12:04:27 2008 +0000
@@ -25,6 +25,9 @@
 		  pidgin_tooltip_show and pidgin_tooltip_setup_for_widget to simplify
 		  the process of drawing tooltips.
 
+	        Deprecated:
+	        * PIDGIN_DIALOG
+
 	Finch:
 		libgnt:
 		* Added gnt_tree_set_row_color to set the color for a row in a tree.
--- a/pidgin/gtkdebug.c	Wed Jan 02 11:05:09 2008 +0000
+++ b/pidgin/gtkdebug.c	Wed Jan 02 12:04:27 2008 +0000
@@ -686,13 +686,11 @@
 	width  = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/width");
 	height = purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/height");
 
-	PIDGIN_DIALOG(win->window);
+	win->window = pidgin_create_dialog(_("Debug Window"), 0, "debug", TRUE);
 	purple_debug_info("gtkdebug", "Setting dimensions to %d, %d\n",
 					width, height);
 
 	gtk_window_set_default_size(GTK_WINDOW(win->window), width, height);
-	gtk_window_set_role(GTK_WINDOW(win->window), "debug");
-	gtk_window_set_title(GTK_WINDOW(win->window), _("Debug Window"));
 
 	g_signal_connect(G_OBJECT(win->window), "delete_event",
 	                 G_CALLBACK(debug_window_destroy), NULL);
@@ -700,7 +698,7 @@
 	                 G_CALLBACK(configure_cb), win);
 
 	handle = pidgin_debug_get_handle();
-	
+
 #ifdef HAVE_REGEX_H
 	/* the list store for all the messages */
 	win->store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
@@ -716,8 +714,7 @@
 #endif /* HAVE_REGEX_H */
 
 	/* Setup the vbox */
-	vbox = gtk_vbox_new(FALSE, 0);
-	gtk_container_add(GTK_CONTAINER(win->window), vbox);
+	vbox = pidgin_dialog_get_vbox(GTK_DIALOG(win->window));
 
 	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) {
 		/* Setup our top button bar thingie. */
--- a/pidgin/gtkdialogs.c	Wed Jan 02 11:05:09 2008 +0000
+++ b/pidgin/gtkdialogs.c	Wed Jan 02 12:04:27 2008 +0000
@@ -337,12 +337,10 @@
 
 void pidgin_dialogs_about()
 {
-	GtkWidget *hbox;
 	GtkWidget *vbox;
 	GtkWidget *logo;
 	GtkWidget *frame;
 	GtkWidget *text;
-	GtkWidget *bbox;
 	GtkWidget *button;
 	GtkTextIter iter;
 	GString *str;
@@ -357,20 +355,12 @@
 		return;
 	}
 
-	PIDGIN_DIALOG(about);
 	tmp = g_strdup_printf(_("About %s"), PIDGIN_NAME);
-	gtk_window_set_title(GTK_WINDOW(about), tmp);
+	about = pidgin_create_dialog(tmp, PIDGIN_HIG_BORDER, "about", TRUE);
 	g_free(tmp);
-	gtk_window_set_role(GTK_WINDOW(about), "about");
-	gtk_window_set_resizable(GTK_WINDOW(about), TRUE);
 	gtk_window_set_default_size(GTK_WINDOW(about), 340, 450);
 
-	hbox = gtk_hbox_new(FALSE, PIDGIN_HIG_BORDER);
-	gtk_container_set_border_width(GTK_CONTAINER(hbox), PIDGIN_HIG_BORDER);
-	gtk_container_add(GTK_CONTAINER(about), hbox);
-
-	vbox = gtk_vbox_new(FALSE, PIDGIN_HIG_BORDER);
-	gtk_container_add(GTK_CONTAINER(hbox), vbox);
+	vbox = pidgin_dialog_get_vbox_with_properties(GTK_DIALOG(about), FALSE, PIDGIN_HIG_BORDER);
 
 	/* Generate a logo with a version number */
 	logo = gtk_window_new(GTK_WINDOW_TOPLEVEL);
@@ -709,15 +699,9 @@
 	gtk_text_buffer_place_cursor(gtk_text_view_get_buffer(GTK_TEXT_VIEW(text)), &iter);
 
 	/* Close Button */
-	bbox = gtk_hbutton_box_new();
-	gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_END);
-	gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);
+	button = pidgin_dialog_add_button(GTK_DIALOG(about), GTK_STOCK_CLOSE,
+	                G_CALLBACK(destroy_about), about);
 
-	button = gtk_button_new_from_stock(GTK_STOCK_CLOSE);
-	gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 0);
-
-	g_signal_connect_swapped(G_OBJECT(button), "clicked",
-							 G_CALLBACK(destroy_about), G_OBJECT(about));
 	g_signal_connect(G_OBJECT(about), "destroy",
 					 G_CALLBACK(destroy_about), G_OBJECT(about));
 
--- a/pidgin/gtkdialogs.h	Wed Jan 02 11:05:09 2008 +0000
+++ b/pidgin/gtkdialogs.h	Wed Jan 02 12:04:27 2008 +0000
@@ -54,11 +54,10 @@
 
 /* Everything after this should probably be moved elsewhere */
 
-/**
- * Our UI's identifier.
- */
+#ifndef PIDGIN_DISABLE_DEPRECATED
 #define PIDGIN_DIALOG(x)	x = gtk_window_new(GTK_WINDOW_TOPLEVEL); \
 			gtk_window_set_type_hint(GTK_WINDOW(x), GDK_WINDOW_TYPE_HINT_DIALOG)
+#endif
 #define PIDGIN_WINDOW_ICONIFIED(x) (gdk_window_get_state(GTK_WIDGET(x)->window) & GDK_WINDOW_STATE_ICONIFIED)
 
 #endif /* _PIDGINDIALOGS_H_ */
--- a/pidgin/gtkimhtmltoolbar.c	Wed Jan 02 11:05:09 2008 +0000
+++ b/pidgin/gtkimhtmltoolbar.c	Wed Jan 02 12:04:27 2008 +0000
@@ -709,10 +709,8 @@
 		smileys = smileys->next;
 	}
 
-	PIDGIN_DIALOG(dialog);
+	dialog = pidgin_create_dialog(_("Smile!"), 0, "smiley_dialog", FALSE);
 
-	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);
 
 	if (unique_smileys != NULL) {
@@ -769,18 +767,15 @@
 	}
 
 	g_signal_connect(G_OBJECT(dialog), "key-press-event", (GCallback)smiley_dialog_input_cb, toolbar);
-	gtk_container_add(GTK_CONTAINER(dialog), smiley_table);
+	gtk_container_add(GTK_CONTAINER(pidgin_dialog_get_vbox(GTK_DIALOG(dialog))), smiley_table);
 
 	gtk_widget_show(smiley_table);
 
-	gtk_container_set_border_width(GTK_CONTAINER(dialog), 5);
-
 	/* connect signals */
 	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);
 	gtk_window_set_transient_for(GTK_WINDOW(dialog),
 			GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(toolbar))));