Unverified Commit 18e2d526 authored by Rostislav Krasny's avatar Rostislav Krasny Committed by Nathan Chancellor
Browse files

kconfig: move XPM icons to separate files



Replace deprecated gdk_pixbuf_new_from_xpm_data() with gdk_pixbuf_new_from_file()
and update both GTK and QT frontends to load XPM icons from separate files
in scripts/kconfig/icons/ instead of from the code.

xpm_menu_inv and xpm_void were removed and not converted into xpm files
because they are not used since commit 64285dc5 ("kconfig: gconf:
inline fill_row() into set_node()").

This eliminates the GTK deprecation warnings at compile time and
improves memory usage and code organization.

Signed-off-by: default avatarRostislav Krasny <rostiprodev@gmail.com>
Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Tested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
Link: https://patch.msgid.link/20251217015409.30102-2-rostiprodev@gmail.com


[nathan: Minor commit message clean ups]
Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
parent a4df2071
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -201,7 +201,7 @@ $(addprefix $(obj)/, mconf.o $(lxdialog)): | $(obj)/mconf-cflags
# qconf: Used for the xconfig target based on Qt
hostprogs	+= qconf
qconf-cxxobjs	:= qconf.o qconf-moc.o
qconf-objs	:= images.o $(common-objs)
qconf-objs	:= $(common-objs)

HOSTLDLIBS_qconf         = $(call read-file, $(obj)/qconf-libs)
HOSTCXXFLAGS_qconf.o     = -std=c++11 -fPIC $(call read-file, $(obj)/qconf-cflags)
@@ -219,7 +219,7 @@ targets += qconf-moc.cc

# gconf: Used for the gconfig target based on GTK+
hostprogs	+= gconf
gconf-objs	:= gconf.o images.o $(common-objs)
gconf-objs	:= gconf.o $(common-objs)

HOSTLDLIBS_gconf   = $(call read-file, $(obj)/gconf-libs)
HOSTCFLAGS_gconf.o = $(call read-file, $(obj)/gconf-cflags)
+28 −7
Original line number Diff line number Diff line
@@ -5,7 +5,6 @@

#include <stdlib.h>
#include "lkc.h"
#include "images.h"

#include <gtk/gtk.h>

@@ -951,12 +950,24 @@ static void fixup_rootmenu(struct menu *menu)
}

/* Main Window Initialization */
static void replace_button_icon(GtkWidget *widget, const char * const xpm[])
static void replace_button_icon(GtkWidget *widget, const char *filename)
{
	GdkPixbuf *pixbuf;
	GtkWidget *image;
	GError *err = NULL;

	char *env = getenv(SRCTREE);
	gchar *path = g_strconcat(env ? env : g_get_current_dir(), "/scripts/kconfig/icons/", filename, NULL);

	pixbuf = gdk_pixbuf_new_from_file(path, &err);
	g_free(path);

	if (err) {
		g_warning("Failed to load icon %s: %s", filename, err->message);
		g_error_free(err);
		return;
	}

	pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)xpm);
	image = gtk_image_new_from_pixbuf(pixbuf);
	g_object_unref(pixbuf);

@@ -1078,17 +1089,17 @@ static void init_main_window(const gchar *glade_file)
	single_btn = GTK_WIDGET(gtk_builder_get_object(builder, "button4"));
	g_signal_connect(single_btn, "clicked",
			 G_CALLBACK(on_single_clicked), NULL);
	replace_button_icon(single_btn, xpm_single_view);
	replace_button_icon(single_btn, "single_view.xpm");

	split_btn = GTK_WIDGET(gtk_builder_get_object(builder, "button5"));
	g_signal_connect(split_btn, "clicked",
			 G_CALLBACK(on_split_clicked), NULL);
	replace_button_icon(split_btn, xpm_split_view);
	replace_button_icon(split_btn, "split_view.xpm");

	full_btn = GTK_WIDGET(gtk_builder_get_object(builder, "button6"));
	g_signal_connect(full_btn, "clicked",
			 G_CALLBACK(on_full_clicked), NULL);
	replace_button_icon(full_btn, xpm_tree_view);
	replace_button_icon(full_btn, "tree_view.xpm");

	widget = GTK_WIDGET(gtk_builder_get_object(builder, "button7"));
	g_signal_connect(widget, "clicked",
@@ -1269,7 +1280,17 @@ static void init_right_tree(void)
	g_signal_connect(G_OBJECT(renderer), "edited",
			 G_CALLBACK(renderer_edited), tree2_w);

	pix_menu = gdk_pixbuf_new_from_xpm_data((const char **)xpm_menu);
	char *env = getenv(SRCTREE);
	gchar *path = g_strconcat(env ? env : g_get_current_dir(), "/scripts/kconfig/icons/menu.xpm", NULL);
	GError *err = NULL;

	pix_menu = gdk_pixbuf_new_from_file(path, &err);
	g_free(path);

	if (err) {
		g_warning("Failed to load menu icon: %s", err->message);
		g_error_free(err);
	}

	for (i = 0; i < COL_VALUE; i++) {
		column = gtk_tree_view_get_column(view, i);
+29 −0
Original line number Diff line number Diff line
/* XPM */
static char * back_xpm[] = {
"22 22 3 1",
". c None",
"# c #000083",
"a c #838183",
"......................",
"......................",
"......................",
"......................",
"......................",
"...........######a....",
"..#......##########...",
"..##...####......##a..",
"..###.###.........##..",
"..######..........##..",
"..#####...........##..",
"..######..........##..",
"..#######.........##..",
"..########.......##a..",
"...............a###...",
"...............###....",
"......................",
"......................",
"......................",
"......................",
"......................",
"......................"
};
+18 −0
Original line number Diff line number Diff line
/* XPM */
static char * choice_no_xpm[] = {
"12 12 2 1",
"  c white",
". c black",
"            ",
"    ....    ",
"  ..    ..  ",
"  .      .  ",
" .        . ",
" .        . ",
" .        . ",
" .        . ",
"  .      .  ",
"  ..    ..  ",
"    ....    ",
"            "
};
+18 −0
Original line number Diff line number Diff line
/* XPM */
static char * choice_yes_xpm[] = {
"12 12 2 1",
"  c white",
". c black",
"            ",
"    ....    ",
"  ..    ..  ",
"  .      .  ",
" .   ..   . ",
" .  ....  . ",
" .  ....  . ",
" .   ..   . ",
"  .      .  ",
"  ..    ..  ",
"    ....    ",
"            "
};
Loading