[MPlayer-cvslog] r38521 - in trunk: gui/dialog/fileselect.c gui/gtk-compat.h gui/win32/dialogs.c help/help_mp-de.h help/help_mp-en.h help/help_mp-ru.h help/help_mp-zh_CN.h

ib subversion at mplayerhq.hu
Sun May 12 20:04:17 EEST 2024


Author: ib
Date: Sun May 12 20:04:17 2024
New Revision: 38521

Log:
Work around a bug in gtk_button_set_image().

Up to GTK+ 2.8.14, gtk_button_set_image() does not display an image
if the button does not also have a label.

This reverts most of svn r38487.

Modified:
   trunk/gui/dialog/fileselect.c
   trunk/gui/gtk-compat.h
   trunk/gui/win32/dialogs.c

Changes in other areas also in this revision:
Modified:
   trunk/help/help_mp-de.h
   trunk/help/help_mp-en.h
   trunk/help/help_mp-ru.h
   trunk/help/help_mp-zh_CN.h

Modified: trunk/gui/dialog/fileselect.c
==============================================================================
--- trunk/gui/dialog/fileselect.c	Sun May 12 20:00:22 2024	(r38520)
+++ trunk/gui/dialog/fileselect.c	Sun May 12 20:04:17 2024	(r38521)
@@ -751,7 +751,7 @@ static GtkWidget *CreateFileSelect(void)
     GtkWidget *fsFNameListWindow;
     GtkWidget *hbuttonbox3;
 
-    GtkWidget *Up;
+    GtkWidget *up;
     GdkPixbuf *pixbuf;
 
     accel_group = gtk_accel_group_new();
@@ -781,12 +781,11 @@ static GtkWidget *CreateFileSelect(void)
     gtk_box_pack_start(GTK_BOX(hbox4), vseparator1, FALSE, TRUE, 0);
 
     pixbuf = gdk_pixbuf_new_from_inline(-1, dir_up_png, FALSE, NULL);
-    Up     = gtk_image_new_from_pixbuf(pixbuf);
+    up     = gtk_image_new_from_pixbuf(pixbuf);
     g_object_unref(pixbuf);
-    gtk_widget_show(Up);
 
     fsUp = gtk_button_new();
-    gtk_button_set_image(GTK_BUTTON(fsUp), Up);
+    gtk_button_set_image(GTK_BUTTON(fsUp), up);
     gtk_widget_show(fsUp);
     gtk_box_pack_start(GTK_BOX(hbox4), fsUp, FALSE, FALSE, 0);
     gtk_widget_set_size_request(fsUp, 60, -1);

Modified: trunk/gui/gtk-compat.h
==============================================================================
--- trunk/gui/gtk-compat.h	Sun May 12 20:00:22 2024	(r38520)
+++ trunk/gui/gtk-compat.h	Sun May 12 20:04:17 2024	(r38521)
@@ -26,8 +26,9 @@
 
 #include <gtk/gtk.h>
 
-#if !GTK_CHECK_VERSION(2,6,0)
-#define gtk_button_set_image(button, image) gtk_button_set_label(button, MSGTR_GUI_ ## image)
+#if !GTK_CHECK_VERSION(2,8,14)
+/* a bug: unlabeled buttons do not show the image */
+#define gtk_button_set_image(button, image) do { gtk_button_set_label(button, ""); gtk_button_set_image(button, image); } while (0)
 #endif
 
 #if !GTK_CHECK_VERSION(2,14,0)

Modified: trunk/gui/win32/dialogs.c
==============================================================================
--- trunk/gui/win32/dialogs.c	Sun May 12 20:00:22 2024	(r38520)
+++ trunk/gui/win32/dialogs.c	Sun May 12 20:04:17 2024	(r38521)
@@ -437,7 +437,7 @@ static LRESULT CALLBACK PlayListWndProc(
                                NULL);
             SendMessage(wdg, WM_SETFONT, (WPARAM) GetStockObject(DEFAULT_GUI_FONT), 0);
 
-            wdg = CreateWindow ("button", acp(MSGTR_GUI_Up),
+            wdg = CreateWindow ("button", acp(MSGTR_GUI_WIN32_Up),
                                 WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
                                 4, 37, 80, 25, hwnd,
                                 (HMENU) ID_UP,


More information about the MPlayer-cvslog mailing list