pidgin: 8d31b9ab: Remove GTK_CHECK_VERSION(2,4,0) checks.

qulogic at pidgin.im qulogic at pidgin.im
Sat Feb 20 02:13:07 EST 2010


-----------------------------------------------------------------
Revision: 8d31b9ab451dbeb751de733ab73a01e483d041c2
Ancestor: 03fe3ebbc1dccb5922eeb579f303a2dbed6f7826
Author: qulogic at pidgin.im
Date: 2010-02-20T06:41:25
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/8d31b9ab451dbeb751de733ab73a01e483d041c2

Modified files:
        pidgin/gtkdebug.c

ChangeLog: 

Remove GTK_CHECK_VERSION(2,4,0) checks.

-------------- next part --------------
============================================================
--- pidgin/gtkdebug.c	53b06331cdf575b1514b004212e870dd8f4d94e6
+++ pidgin/gtkdebug.c	1ca72f3159399f3e3cd33bdddf7612486981635c
@@ -43,19 +43,6 @@
 
 #include <gdk/gdkkeysyms.h>
 
-/* TODO: I'm too lazy to change all these until we bump required GTK+ version */
-#if GTK_CHECK_VERSION(2,4,0)
-#undef GTK_TOGGLE_BUTTON
-#undef gtk_toggle_button_get_active
-#undef gtk_toggle_button_set_active
-#undef GtkToggleButton
-
-#define GTK_TOGGLE_BUTTON GTK_TOGGLE_TOOL_BUTTON
-#define gtk_toggle_button_get_active gtk_toggle_tool_button_get_active
-#define gtk_toggle_button_set_active gtk_toggle_tool_button_set_active
-#define GtkToggleButton GtkToggleToolButton
-#endif
-
 typedef struct
 {
 	GtkWidget *window;
@@ -263,11 +250,11 @@ pause_cb(GtkWidget *w, DebugWindow *win)
 static void
 pause_cb(GtkWidget *w, DebugWindow *win)
 {
-	win->paused = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w));
+	win->paused = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(w));
 
 #ifdef HAVE_REGEX_H
 	if(!win->paused) {
-		if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter)))
+		if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
 			regex_filter_all(win);
 		else
 			regex_show_all(win);
@@ -458,7 +445,7 @@ regex_compile(DebugWindow *win) {
 	/* we check if the filter is on in case it was only of the options that
 	 * got changed, and not the expression.
 	 */
-	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter)))
+	if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
 		regex_filter_all(win);
 }
 
@@ -472,9 +459,9 @@ regex_pref_filter_cb(const gchar *name, 
 	if(!win || !win->window)
 		return;
 
-	current = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter));
+	current = gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter));
 	if(active != current)
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), active);
+		gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter), active);
 }
 
 static void
@@ -496,7 +483,7 @@ regex_pref_invert_cb(const gchar *name, 
 
 	win->invert = active;
 
-	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter)))
+	if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
 		regex_filter_all(win);
 }
 
@@ -509,7 +496,7 @@ regex_pref_highlight_cb(const gchar *nam
 
 	win->highlight = active;
 
-	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter)))
+	if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
 		regex_filter_all(win);
 }
 
@@ -535,7 +522,7 @@ regex_row_changed_cb(GtkTreeModel *model
 	gtk_tree_model_get(model, iter, 0, &text, 1, &level, -1);
 
 	if (level >= purple_prefs_get_int(PIDGIN_PREFS_ROOT "/debug/filterlevel")) {
-		if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) {
+		if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) {
 			regex_match(win, text);
 		} else {
 			gtk_imhtml_append_text(GTK_IMHTML(win->text), text, 0);
@@ -559,8 +546,8 @@ regex_changed_cb(GtkWidget *w, DebugWind
 
 static void
 regex_changed_cb(GtkWidget *w, DebugWindow *win) {
-	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter))) {
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter),
+	if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter))) {
+		gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter),
 									 FALSE);
 	}
 
@@ -574,9 +561,9 @@ regex_key_release_cb(GtkWidget *w, GdkEv
 regex_key_release_cb(GtkWidget *w, GdkEventKey *e, DebugWindow *win) {
 	if(e->keyval == GDK_Return &&
 	   GTK_WIDGET_IS_SENSITIVE(win->filter) &&
-	   !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter)))
+	   !gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
 	{
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter), TRUE);
+		gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter), TRUE);
 	}
 }
 
@@ -601,10 +588,10 @@ static void
 }
 
 static void
-regex_filter_toggled_cb(GtkToggleButton *button, DebugWindow *win) {
+regex_filter_toggled_cb(GtkToggleToolButton *button, DebugWindow *win) {
 	gboolean active;
 
-	active = gtk_toggle_button_get_active(button);
+	active = gtk_toggle_tool_button_get_active(button);
 
 	purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/debug/filter", active);
 
@@ -624,7 +611,7 @@ filter_level_pref_changed(const char *na
 
 	if (GPOINTER_TO_INT(value) != gtk_combo_box_get_active(GTK_COMBO_BOX(win->filterlevel)))
 		gtk_combo_box_set_active(GTK_COMBO_BOX(win->filterlevel), GPOINTER_TO_INT(value));
-	if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(win->filter)))
+	if(gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(win->filter)))
 		regex_filter_all(win);
 	else
 		regex_show_all(win);
@@ -692,14 +679,10 @@ debug_window_new(void)
 	GtkWidget *frame;
 	gint width, height;
 	void *handle;
-#if GTK_CHECK_VERSION(2,4,0)
 	GtkToolItem *item;
 #if !GTK_CHECK_VERSION(2,12,0)
 	GtkTooltips *tooltips;
 #endif
-#else
-	GtkWidget *image;
-#endif
 
 	win = g_new0(DebugWindow, 1);
 
@@ -740,7 +723,7 @@ debug_window_new(void)
 	if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/toolbar")) {
 		/* Setup our top button bar thingie. */
 		toolbar = gtk_toolbar_new();
-#if GTK_CHECK_VERSION(2,4,0) && !GTK_CHECK_VERSION(2,12,0)
+#if !GTK_CHECK_VERSION(2,12,0)
 		tooltips = gtk_tooltips_new();
 #endif
 #if !GTK_CHECK_VERSION(2,14,0)
@@ -760,7 +743,6 @@ debug_window_new(void)
 
 #ifndef HAVE_REGEX_H
 		/* Find button */
-#if GTK_CHECK_VERSION(2,4,0)
 		item = gtk_tool_button_new_from_stock(GTK_STOCK_FIND);
 #if GTK_CHECK_VERSION(2,12,0)
 		gtk_tool_item_set_tooltip_text(item, _("Find"));
@@ -769,15 +751,9 @@ debug_window_new(void)
 #endif
 		g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(find_cb), win);
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
-#else
-		gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_FIND,
-		                         _("Find"), NULL, G_CALLBACK(find_cb),
-		                         win, -1);
-#endif
 #endif /* HAVE_REGEX_H */
 
 		/* Save */
-#if GTK_CHECK_VERSION(2,4,0)
 		item = gtk_tool_button_new_from_stock(GTK_STOCK_SAVE);
 #if GTK_CHECK_VERSION(2,12,0)
 		gtk_tool_item_set_tooltip_text(item, _("Save"));
@@ -786,14 +762,8 @@ debug_window_new(void)
 #endif
 		g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(save_cb), win);
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
-#else
-		gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_SAVE,
-		                         _("Save"), NULL, G_CALLBACK(save_cb),
-		                         win, -1);
-#endif
 
 		/* Clear button */
-#if GTK_CHECK_VERSION(2,4,0)
 		item = gtk_tool_button_new_from_stock(GTK_STOCK_CLEAR);
 #if GTK_CHECK_VERSION(2,12,0)
 		gtk_tool_item_set_tooltip_text(item, _("Clear"));
@@ -802,21 +772,11 @@ debug_window_new(void)
 #endif
 		g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(clear_cb), win);
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
-#else
-		gtk_toolbar_insert_stock(GTK_TOOLBAR(toolbar), GTK_STOCK_CLEAR,
-		                         _("Clear"), NULL, G_CALLBACK(clear_cb),
-		                         win, -1);
-#endif
 
-#if GTK_CHECK_VERSION(2,4,0)
 		item = gtk_separator_tool_item_new();
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
-#else
-		gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);
-#endif
 
 		/* Pause */
-#if GTK_CHECK_VERSION(2,4,0)
 		item = gtk_toggle_tool_button_new_from_stock(PIDGIN_STOCK_PAUSE);
 #if GTK_CHECK_VERSION(2,12,0)
 		gtk_tool_item_set_tooltip_text(item, _("Pause"));
@@ -825,26 +785,13 @@ debug_window_new(void)
 #endif
 		g_signal_connect(G_OBJECT(item), "clicked", G_CALLBACK(pause_cb), win);
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
-#else
-		image = gtk_image_new_from_stock(PIDGIN_STOCK_PAUSE, GTK_ICON_SIZE_MENU);
-		gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
-		                                    GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
-		                                    NULL, _("Pause"), _("Pause"),
-		                                    NULL, image,
-		                                    G_CALLBACK(pause_cb), win);
-#endif
 
 #ifdef HAVE_REGEX_H
 		/* regex stuff */
-#if GTK_CHECK_VERSION(2,4,0)
 		item = gtk_separator_tool_item_new();
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
-#else
-		gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);
-#endif
 
 		/* regex toggle button */
-#if GTK_CHECK_VERSION(2,4,0)
 		win->filter = GTK_WIDGET(gtk_toggle_tool_button_new_from_stock(GTK_STOCK_FIND));
 		gtk_tool_button_set_label(GTK_TOOL_BUTTON(win->filter), _("Filter"));
 #if GTK_CHECK_VERSION(2,12,0)
@@ -854,16 +801,6 @@ debug_window_new(void)
 #endif
 		g_signal_connect(G_OBJECT(win->filter), "clicked", G_CALLBACK(regex_filter_toggled_cb), win);
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(win->filter));
-#else
-		image = gtk_image_new_from_stock(GTK_STOCK_FIND, GTK_ICON_SIZE_MENU);
-		win->filter =
-			gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
-									   GTK_TOOLBAR_CHILD_TOGGLEBUTTON,
-									   NULL, _("Filter"), _("Filter"),
-									   NULL, image,
-									   G_CALLBACK(regex_filter_toggled_cb),
-									   win);
-#endif
 
 		/* we purposely disable the toggle button here in case
 		 * /purple/gtk/debug/expression has an empty string.  If it does not have
@@ -871,14 +808,13 @@ debug_window_new(void)
 		 * toggle button sensitive.
 		 */
 		gtk_widget_set_sensitive(win->filter, FALSE);
-		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win->filter),
+		gtk_toggle_tool_button_set_active(GTK_TOGGLE_TOOL_BUTTON(win->filter),
 									 purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/debug/filter"));
 		purple_prefs_connect_callback(handle, PIDGIN_PREFS_ROOT "/debug/filter",
 									regex_pref_filter_cb, win);
 
 		/* regex entry */
 		win->expression = gtk_entry_new();
-#if GTK_CHECK_VERSION(2,4,0)
 		item = gtk_tool_item_new();
 #if GTK_CHECK_VERSION(2,12,0)
 		gtk_widget_set_tooltip_text(win->expression, _("Right click for more options."));
@@ -887,12 +823,7 @@ debug_window_new(void)
 #endif
 		gtk_container_add(GTK_CONTAINER(item), GTK_WIDGET(win->expression));
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
-#else
-		gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
-								   GTK_TOOLBAR_CHILD_WIDGET, win->expression,
-								   NULL, _("Right click for more options."),
-								   NULL, NULL, NULL, NULL);
-#endif
+
 		/* this needs to be before the text is set from the pref if we want it
 		 * to colorize a stored expression.
 		 */
@@ -918,25 +849,14 @@ debug_window_new(void)
 
 #endif /* HAVE_REGEX_H */
 
-#if GTK_CHECK_VERSION(2,4,0)
 		item = gtk_separator_tool_item_new();
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
-#else
-		gtk_toolbar_insert_space(GTK_TOOLBAR(toolbar), -1);
-#endif
 
-#if GTK_CHECK_VERSION(2,4,0)
 		item = gtk_tool_item_new();
 		gtk_container_add(GTK_CONTAINER(item), gtk_label_new(_("Level ")));
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
-#else
-		gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
-		                           GTK_TOOLBAR_CHILD_WIDGET, gtk_label_new(_("Level ")),
-		                           NULL, _("Select the debug filter level."),
-		                           NULL, NULL, NULL, NULL);
-#endif
+
 		win->filterlevel = gtk_combo_box_new_text();
-#if GTK_CHECK_VERSION(2,4,0)
 		item = gtk_tool_item_new();
 #if GTK_CHECK_VERSION(2,12,0)
 		gtk_widget_set_tooltip_text(win->filterlevel, _("Select the debug filter level."));
@@ -945,12 +865,7 @@ debug_window_new(void)
 #endif
 		gtk_container_add(GTK_CONTAINER(item), win->filterlevel);
 		gtk_container_add(GTK_CONTAINER(toolbar), GTK_WIDGET(item));
-#else
-		gtk_toolbar_append_element(GTK_TOOLBAR(toolbar),
-		                           GTK_TOOLBAR_CHILD_WIDGET, win->filterlevel,
-		                           NULL, _("Select the debug filter level."),
-		                           NULL, NULL, NULL, NULL);
-#endif
+
 		gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("All"));
 		gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Misc"));
 		gtk_combo_box_append_text(GTK_COMBO_BOX(win->filterlevel), _("Info"));


More information about the Commits mailing list