/soc/2015/mmcc/main: 224a7202337b: bump GTK+3 requirement to 3.4

Michael McConville mmcconville at mykolab.com
Tue Jun 23 16:02:34 EDT 2015


Changeset: 224a7202337bd85451664dc3a64f39b09b9e7fd1
Author:	 Michael McConville <mmcconville at mykolab.com>
Date:	 2015-06-19 19:56 -0400
Branch:	 default
URL: https://hg.pidgin.im/soc/2015/mmcc/main/rev/224a7202337b

Description:

bump GTK+3 requirement to 3.4

diffstat:

 configure.ac               |    4 +-
 pidgin/gtk3compat.h        |   62 -----------------------
 pidgin/gtkaccount.c        |  118 ---------------------------------------------
 pidgin/gtkwebviewtoolbar.c |   21 --------
 4 files changed, 2 insertions(+), 203 deletions(-)

diffs (288 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -576,10 +576,10 @@ else
 fi
 
 if test "x$enable_gtkui" = "xyes" ; then
-	PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0], , [
+	PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.4.0], , [
 		AC_MSG_RESULT(no)
 		AC_MSG_ERROR([
-You must have GTK+ 3.0.0 or newer development headers installed to compile
+You must have GTK+ 3.4.0 or newer development headers installed to compile
 Pidgin.  If you want to build only Finch then specify --disable-gtkui when
 running configure.
 ])])
diff --git a/pidgin/gtk3compat.h b/pidgin/gtk3compat.h
--- a/pidgin/gtk3compat.h
+++ b/pidgin/gtk3compat.h
@@ -34,51 +34,6 @@
 #include <gtk/gtk.h>
 #include <math.h>
 
-#if !GTK_CHECK_VERSION(3,4,0)
-
-#define gtk_color_chooser_dialog_new(title, parent) \
-	gtk_color_selection_dialog_new(title)
-#define GTK_COLOR_CHOOSER(widget) (GTK_WIDGET(widget))
-
-static inline void
-gtk_color_chooser_set_use_alpha(GtkWidget *widget, gboolean use_alpha)
-{
-	if (GTK_IS_COLOR_BUTTON(widget)) {
-		gtk_color_button_set_use_alpha(GTK_COLOR_BUTTON(widget),
-			use_alpha);
-	}
-}
-
-static inline void
-pidgin_color_chooser_set_rgb(GtkWidget *widget, const GdkColor *color)
-{
-	if (GTK_IS_COLOR_SELECTION_DIALOG(widget)) {
-		GtkWidget *colorsel;
-
-		colorsel = gtk_color_selection_dialog_get_color_selection(
-			GTK_COLOR_SELECTION_DIALOG(widget));
-		gtk_color_selection_set_current_color(
-			GTK_COLOR_SELECTION(colorsel), color);
-	} else
-		gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), color);
-}
-
-static inline void
-pidgin_color_chooser_get_rgb(GtkWidget *widget, GdkColor *color)
-{
-	if (GTK_IS_COLOR_SELECTION_DIALOG(widget)) {
-		GtkWidget *colorsel;
-
-		colorsel = gtk_color_selection_dialog_get_color_selection(
-			GTK_COLOR_SELECTION_DIALOG(widget));
-		gtk_color_selection_get_current_color(
-			GTK_COLOR_SELECTION(colorsel), color);
-	} else
-		gtk_color_button_get_color(GTK_COLOR_BUTTON(widget), color);
-}
-
-#else /* 3.4.0 */
-
 static inline void
 pidgin_color_chooser_set_rgb(GtkColorChooser *chooser, const GdkColor *rgb)
 {
@@ -103,9 +58,6 @@ pidgin_color_chooser_get_rgb(GtkColorCho
 	rgb->blue = (int)round(rgba.blue * 65535.0);
 }
 
-#endif /* 3.4.0 and gtk_color_chooser_ */
-
-
 static inline GtkWidget *
 gtk_grid_table_new(guint rows, guint columns)
 {
@@ -143,18 +95,4 @@ gtk_grid_attach_full(GtkGrid *grid, GtkW
 	gtk_widget_set_margin_bottom(child, ypadding);
 }
 
-#if !GTK_CHECK_VERSION(3,2,0)
-
-#define GTK_FONT_CHOOSER GTK_FONT_SELECTION_DIALOG
-#define gtk_font_chooser_get_font gtk_font_selection_dialog_get_font_name
-#define gtk_font_chooser_set_font gtk_font_selection_dialog_set_font_name
-
-static inline GtkWidget * gtk_font_chooser_dialog_new(const gchar *title,
-	GtkWindow *parent)
-{
-	return gtk_font_selection_dialog_new(title);
-}
-
-#endif /* 3.2.0 */
-
 #endif /* _PIDGINGTK3COMPAT_H_ */
diff --git a/pidgin/gtkaccount.c b/pidgin/gtkaccount.c
--- a/pidgin/gtkaccount.c
+++ b/pidgin/gtkaccount.c
@@ -304,105 +304,6 @@ username_changed_cb(GtkEntry *entry, Acc
 	}
 }
 
-#if !GTK_CHECK_VERSION(3,2,0)
-static gboolean
-username_focus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog)
-{
-	GHashTable *table;
-	const char *label;
-
-	if (!dialog->protocol || ! PURPLE_PROTOCOL_IMPLEMENTS(
-		dialog->protocol, CLIENT_IFACE, get_account_text_table)) {
-		return FALSE;
-	}
-
-	table = purple_protocol_client_iface_get_account_text_table(dialog->protocol, NULL);
-	label = g_hash_table_lookup(table, "login_label");
-
-	if(!strcmp(gtk_entry_get_text(GTK_ENTRY(widget)), label)) {
-		gtk_entry_set_text(GTK_ENTRY(widget), "");
-		gtk_widget_override_color(widget, GTK_STATE_NORMAL, NULL);
-	}
-
-	g_hash_table_destroy(table);
-
-	return FALSE;
-}
-
-static gboolean
-username_nofocus_cb(GtkWidget *widget, GdkEventFocus *event, AccountPrefsDialog *dialog)
-{
-	GHashTable *table = NULL;
-	const char *label = NULL;
-
-	if (PURPLE_PROTOCOL_IMPLEMENTS(dialog->protocol, CLIENT_IFACE, get_account_text_table)) {
-		table = purple_protocol_client_iface_get_account_text_table(dialog->protocol, NULL);
-		label = g_hash_table_lookup(table, "login_label");
-
-		if (*gtk_entry_get_text(GTK_ENTRY(widget)) == '\0') {
-			/* We have to avoid hitting the username_changed_cb function
-			 * because it enables buttons we don't want enabled yet ;)
-			 */
-			g_signal_handlers_block_by_func(widget, G_CALLBACK(username_changed_cb), dialog);
-			gtk_entry_set_text(GTK_ENTRY(widget), label);
-			/* Make sure we can hit it again */
-			g_signal_handlers_unblock_by_func(widget, G_CALLBACK(username_changed_cb), dialog);
-			gtk_widget_override_color(widget, GTK_STATE_NORMAL, &dialog->username_entry_hint_color);
-		}
-
-		g_hash_table_destroy(table);
-	}
-
-	return FALSE;
-}
-
-static gboolean
-username_themechange_cb(GObject *widget, GdkEventFocus *event, AccountPrefsDialog *dialog)
-{
-	GHashTable *table;
-	const char *label, *text;
-	char *temp_text = NULL;
-	GtkStyleContext *context;
-	GtkBorder border;
-	gint xsize;
-
-	table = purple_protocol_client_iface_get_account_text_table(dialog->protocol, NULL);
-	label = g_hash_table_lookup(table, "login_label");
-	text = gtk_entry_get_text(GTK_ENTRY(widget));
-
-	g_signal_handlers_block_by_func(widget, G_CALLBACK(username_themechange_cb), dialog);
-	g_signal_handlers_block_by_func(widget, G_CALLBACK(username_changed_cb), dialog);
-	if (strcmp(text, label)) {
-		temp_text = g_strdup(text);
-		gtk_entry_set_text(GTK_ENTRY(widget), label);
-		gtk_widget_override_color(GTK_WIDGET(widget), GTK_STATE_NORMAL, NULL);
-	}
-
-	context = gtk_widget_get_style_context(dialog->username_entry);
-	gtk_style_context_get_color(context, GTK_STATE_FLAG_INSENSITIVE,
-	                            &dialog->username_entry_hint_color);
-
-	pango_layout_get_pixel_size(gtk_entry_get_layout(GTK_ENTRY(widget)), &xsize, NULL);
-	gtk_style_context_get_margin(context, GTK_STATE_FLAG_NORMAL, &border);
-	xsize += border.left + border.right;
-	gtk_style_context_get_padding(context, GTK_STATE_FLAG_NORMAL, &border);
-	xsize += border.left + border.right;
-	gtk_widget_set_size_request(GTK_WIDGET(widget), xsize, -1);
-	if (temp_text) {
-		gtk_entry_set_text(GTK_ENTRY(widget), temp_text);
-		g_free(temp_text);
-		gtk_widget_override_color(GTK_WIDGET(widget), GTK_STATE_NORMAL, NULL);
-	} else
-		gtk_widget_override_color(GTK_WIDGET(widget), GTK_STATE_NORMAL, &dialog->username_entry_hint_color);
-
-	g_signal_handlers_unblock_by_func(widget, G_CALLBACK(username_themechange_cb), dialog);
-	g_signal_handlers_unblock_by_func(widget, G_CALLBACK(username_changed_cb), dialog);
-	g_hash_table_destroy(table);
-
-	return FALSE;
-}
-#endif
-
 static void
 register_button_cb(GtkWidget *checkbox, AccountPrefsDialog *dialog)
 {
@@ -412,11 +313,6 @@ register_button_cb(GtkWidget *checkbox, 
 		(purple_protocol_get_options(dialog->protocol) & OPT_PROTO_REGISTER_NOSCREENNAME));
 	int register_noscreenname = (opt_noscreenname && register_checked);
 
-#if !GTK_CHECK_VERSION(3,2,0)
-	/* get rid of login_label in username field */
-	username_focus_cb(dialog->username_entry, NULL, dialog);
-#endif
-
 	if (register_noscreenname) {
 		gtk_entry_set_text(GTK_ENTRY(dialog->username_entry), "");
 		gtk_entry_set_text(GTK_ENTRY(dialog->password_entry), "");
@@ -433,9 +329,6 @@ register_button_cb(GtkWidget *checkbox, 
 				!= '\0');
 	}
 
-#if !GTK_CHECK_VERSION(3,2,0)
-	username_nofocus_cb(dialog->username_entry, NULL, dialog);
-#endif
 }
 
 static void
@@ -609,18 +502,7 @@ add_login_options(AccountPrefsDialog *di
 		table = purple_protocol_client_iface_get_account_text_table(dialog->protocol, NULL);
 		label = g_hash_table_lookup(table, "login_label");
 
-#if GTK_CHECK_VERSION(3,2,0)
 		gtk_entry_set_placeholder_text(GTK_ENTRY(dialog->username_entry), label);
-#else
-		gtk_entry_set_text(GTK_ENTRY(dialog->username_entry), label);
-		username_themechange_cb(G_OBJECT(dialog->username_entry), NULL, dialog);
-		g_signal_connect(G_OBJECT(dialog->username_entry), "style-set",
-				G_CALLBACK(username_themechange_cb), dialog);
-		g_signal_connect(G_OBJECT(dialog->username_entry), "focus-in-event",
-				G_CALLBACK(username_focus_cb), dialog);
-		g_signal_connect(G_OBJECT(dialog->username_entry), "focus-out-event",
-				G_CALLBACK(username_nofocus_cb), dialog);
-#endif
 
 		g_hash_table_destroy(table);
 	}
diff --git a/pidgin/gtkwebviewtoolbar.c b/pidgin/gtkwebviewtoolbar.c
--- a/pidgin/gtkwebviewtoolbar.c
+++ b/pidgin/gtkwebviewtoolbar.c
@@ -246,25 +246,6 @@ destroy_toolbar_font(PidginWebViewToolba
 }
 
 static void
-realize_toolbar_font(GtkWidget *widget, PidginWebViewToolbar *toolbar)
-{
-#if !GTK_CHECK_VERSION(3,2,0)
-	PidginWebViewToolbarPriv *priv = PIDGIN_WEBVIEWTOOLBAR_GET_PRIVATE(toolbar);
-	GtkFontSelection *sel;
-
-	sel = GTK_FONT_SELECTION(
-		gtk_font_selection_dialog_get_font_selection(GTK_FONT_SELECTION_DIALOG(priv->font_dialog)));
-	gtk_widget_hide(gtk_widget_get_parent(
-		gtk_font_selection_get_size_entry(sel)));
-	gtk_widget_show_all(gtk_font_selection_get_family_list(sel));
-	gtk_widget_show(gtk_widget_get_parent(
-		gtk_font_selection_get_family_list(sel)));
-	gtk_widget_show(gtk_widget_get_parent(gtk_widget_get_parent(
-		gtk_font_selection_get_family_list(sel))));
-#endif
-}
-
-static void
 apply_font(GtkDialog *dialog, gint response, PidginWebViewToolbar *toolbar)
 {
 	/* this could be expanded to include font size, weight, etc.
@@ -321,8 +302,6 @@ toggle_font(GtkAction *font, PidginWebVi
 
 			g_signal_connect(G_OBJECT(priv->font_dialog), "response",
 			                 G_CALLBACK(apply_font), toolbar);
-			g_signal_connect_after(G_OBJECT(priv->font_dialog), "realize",
-			                       G_CALLBACK(realize_toolbar_font), toolbar);
 		}
 
 		gtk_window_present(GTK_WINDOW(priv->font_dialog));



More information about the Commits mailing list