/pidgin/main: b344343d3cf0: Raise minimum GTK+ to 3.4.2.

Elliott Sales de Andrade <[email protected]> Tue, 06 Sep 2016 15:45:50 -0400
Newsgroups gmane.comp.gnome.gaim.cvs
Message-ID <[email protected]>
Changeset: b344343d3cf0597a2e54a1c01beded6a01d05a0f
Author:	 Elliott Sales de Andrade <[email protected]>
Date:	 2016-09-03 02:50 -0400
Branch:	 default
URL: https://hg.pidgin.im/pidgin/main/rev/b344343d3cf0

Description:

Raise minimum GTK+ to 3.4.2.

This is the version packaged by Ubuntu 12.04 LTS. Probably an even
higher version can be required, but this will do for now.

diffstat:

 configure.ac               |    2 +-
 pidgin/gtk3compat.h        |   60 +----------------------
 pidgin/gtkaccount.c        |  119 ---------------------------------------------
 pidgin/gtkwebviewtoolbar.c |   21 -------
 4 files changed, 2 insertions(+), 200 deletions(-)

diffs (277 lines):

diff --git a/configure.ac b/configure.ac
--- a/configure.ac
+++ b/configure.ac
@@ -572,7 +572,7 @@ dnl ####################################
 dnl Check Pidgin dependencies
 dnl #######################################################################
 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.2], , [
 		AC_MSG_RESULT(no)
 		AC_MSG_ERROR([
 You must have GTK+ 3.0.0 or newer development headers installed to compile
diff --git a/pidgin/gtk3compat.h b/pidgin/gtk3compat.h
--- a/pidgin/gtk3compat.h
+++ b/pidgin/gtk3compat.h
@@ -54,50 +54,7 @@ gtk_label_set_alignment(GtkLabel *label,
 #endif /* 3.16.0 */
 
 
-#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 */
+#if GTK_CHECK_VERSION(3,4,0)
 
 static inline void
 pidgin_color_chooser_set_rgb(GtkColorChooser *chooser, const GdkColor *rgb)
@@ -125,20 +82,5 @@ pidgin_color_chooser_get_rgb(GtkColorCho
 
 #endif /* 3.4.0 and gtk_color_chooser_ */
 
-
-#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), "");
@@ -432,10 +328,6 @@ register_button_cb(GtkWidget *checkbox, 
 			*gtk_entry_get_text(GTK_ENTRY(dialog->username_entry))
 				!= '\0');
 	}
-
-#if !GTK_CHECK_VERSION(3,2,0)
-	username_nofocus_cb(dialog->username_entry, NULL, dialog);
-#endif
 }
 
 static void
@@ -609,18 +501,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));

_______________________________________________
Commits mailing list
[email protected]
https://pidgin.im/cgi-bin/mailman/listinfo/commits