summaryrefslogtreecommitdiff
path: root/community/xdialog/xdialog-2.3.1-gtk2.patch
blob: ffee78dc2bdfd6060db1098b2e8a5e2860011d06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
diff -Naur Xdialog-2.3.1-orig/src/interface.c Xdialog-2.3.1/src/interface.c
--- Xdialog-2.3.1-orig/src/interface.c	2006-08-18 18:13:12.000000000 +0200
+++ Xdialog-2.3.1/src/interface.c	2006-10-17 21:33:45.000000000 +0200
@@ -183,6 +183,11 @@
 	/* Open a new GTK top-level window */
 	window = Xdialog.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 
+	/* Set window icon (in GTK2 mode only)  */
+	#ifdef USE_GTK2
+		gtk_window_set_icon_name(window, Xdialog.icon_file);
+	#endif
+
 	/* Apply the custom GTK+ theme, if any. */
 	parse_rc_file();
 
@@ -276,9 +281,6 @@
 {
 	GtkWidget *label;
 	GtkWidget *hbox;
-	GdkBitmap *mask;
-	GdkColor  transparent;
-	GdkPixmap *pixmap;
 	GtkWidget *icon;
 	gchar     text[MAX_LABEL_LENGTH];
 	int icon_width = 0;
@@ -287,6 +289,22 @@
 	gtk_box_pack_start(Xdialog.vbox, hbox, expand, TRUE, ymult/3);
 
 	if (Xdialog.icon) {
+
+#ifdef USE_GTK2
+		if (Xdialog.icon_file != NULL) {
+			icon = gtk_image_new_from_icon_name (Xdialog.icon_file, GTK_ICON_SIZE_DIALOG);
+			/*icon = gtk_image_new_from_file (Xdialog.icon_file);*/
+
+			gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 2);
+			gtk_widget_show(icon);
+			icon_width = 60;
+		}
+
+#else
+
+	  GdkBitmap *mask;
+	  GdkColor  transparent;
+	  GdkPixmap *pixmap;
 		pixmap = gdk_pixmap_create_from_xpm(Xdialog.window->window,
 						    &mask, &transparent,
 						    Xdialog.icon_file);
@@ -298,6 +316,9 @@
 			gtk_widget_show(icon);
 			icon_width = icon->requisition.width + 4;
 		}
+
+#endif
+
 	}
 
 	trim_string(label_text, text, MAX_LABEL_LENGTH);