[geany/geany] 437476: ui-utils: Fix ui_path_box_new with GTK+ >= 3.20

Quentin Glidic git-noreply at xxxxx
Sun Apr 17 09:57:38 UTC 2016


Branch:      refs/heads/master
Author:      Quentin Glidic <sardemff7+git at sardemff7.net>
Committer:   Quentin Glidic <sardemff7+git at sardemff7.net>
Date:        Sun, 17 Apr 2016 09:57:38 UTC
Commit:      4374769b7c181e56bcc01e1f0117566638d5da46
             https://github.com/geany/geany/commit/4374769b7c181e56bcc01e1f0117566638d5da46

Log Message:
-----------
ui-utils: Fix ui_path_box_new with GTK+ >= 3.20

They introduced[1] a GtkBox between the GtkEntry and the GtkComboBox to
add some magic in the layout computation.

[1] <https://git.gnome.org/browse/gtk+/commit/?id=222c43fc60362eeb97ce2d5e3a5583a69a2e30ef>

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>


Modified Paths:
--------------
    src/ui_utils.c

Modified: src/ui_utils.c
14 lines changed, 6 insertions(+), 8 deletions(-)
===================================================================
@@ -1910,21 +1910,19 @@ void ui_widget_modify_font_from_string(GtkWidget *widget, const gchar *str)
 GEANY_API_SYMBOL
 GtkWidget *ui_path_box_new(const gchar *title, GtkFileChooserAction action, GtkEntry *entry)
 {
-	GtkWidget *vbox, *dirbtn, *openimg, *hbox, *path_entry;
+	GtkWidget *vbox, *dirbtn, *openimg, *hbox, *path_entry, *parent, *next_parent;
 
 	hbox = gtk_hbox_new(FALSE, 6);
 	path_entry = GTK_WIDGET(entry);
 
 	/* prevent path_entry being vertically stretched to the height of dirbtn */
 	vbox = gtk_vbox_new(FALSE, 0);
-	if (gtk_widget_get_parent(path_entry))	/* entry->parent may be a GtkComboBoxEntry */
-	{
-		GtkWidget *parent = gtk_widget_get_parent(path_entry);
 
-		gtk_box_pack_start(GTK_BOX(vbox), parent, TRUE, FALSE, 0);
-	}
-	else
-		gtk_box_pack_start(GTK_BOX(vbox), path_entry, TRUE, FALSE, 0);
+	parent = path_entry;
+	while ((next_parent = gtk_widget_get_parent(parent)) != NULL)
+		parent = next_parent;
+
+	gtk_box_pack_start(GTK_BOX(vbox), parent, TRUE, FALSE, 0);
 
 	dirbtn = gtk_button_new();
 	openimg = gtk_image_new_from_stock(GTK_STOCK_OPEN, GTK_ICON_SIZE_BUTTON);



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list