View | Details | Raw Unified | Return to bug 78691
Collapse All | Expand All

(-)leafpad/Makefile (-2 / +18 lines)
Lines 18-27 Link Here
18
USE_REINPLACE=	yes
18
USE_REINPLACE=	yes
19
USE_X_PREFIX=	yes
19
USE_X_PREFIX=	yes
20
GNU_CONFIGURE=	yes
20
GNU_CONFIGURE=	yes
21
CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include" \
21
CONFIGURE_ENV=	CPPFLAGS="-I${LOCALBASE}/include -I${X11BASE}/include ${PTHREAD_CFLAGS}" \
22
		LDFLAGS="-L${LOCALBASE}/lib"
22
		LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib ${PTHREAD_LIBS}" \
23
		PTHREAD_LIB="${PTHREAD_LIBS}"
23
24
24
PORTDOCS=	AUTHORS COPYING ChangeLog INSTALL README
25
PORTDOCS=	AUTHORS COPYING ChangeLog INSTALL README
26
27
.if defined (WITH_NEW_SELECTOR)
28
EXTRA_PATCHES=	${FILESDIR}/extra-new-selector.patch
29
.endif
30
31
pre-everything::
32
.if !defined(WITH_NEW_SELECTOR)
33
	@${ECHO_MSG} ""
34
	@${ECHO_MSG} "You may choose to compile with unsupported patch"
35
	@${ECHO_MSG} "that lets leafpad use the new GTK file selector."
36
	@${ECHO_MSG} "Define:"
37
	@${ECHO_MSG} ""
38
	@${ECHO_MSG} "	WITH_NEW_SELECTOR=yes"
39
	@${ECHO_MSG} ""
40
.endif
25
41
26
post-patch:
42
post-patch:
27
	@${REINPLACE_CMD} -e 's|/pixmaps|/gnome/pixmaps|; \
43
	@${REINPLACE_CMD} -e 's|/pixmaps|/gnome/pixmaps|; \
(-)leafpad/pkg-plist (+1 lines)
Lines 16-20 Link Here
16
share/locale/ta/LC_MESSAGES/leafpad.mo
16
share/locale/ta/LC_MESSAGES/leafpad.mo
17
share/locale/zh_CN/LC_MESSAGES/leafpad.mo
17
share/locale/zh_CN/LC_MESSAGES/leafpad.mo
18
share/locale/zh_TW/LC_MESSAGES/leafpad.mo
18
share/locale/zh_TW/LC_MESSAGES/leafpad.mo
19
%%PORTDOCS%%@dirrm %%DOCSDIR%%
19
@exec update-desktop-database > /dev/null || /usr/bin/true
20
@exec update-desktop-database > /dev/null || /usr/bin/true
20
@unexec update-desktop-database > /dev/null || /usr/bin/true
21
@unexec update-desktop-database > /dev/null || /usr/bin/true
(-)leafpad/files/extra-new-selector.patch (+130 lines)
Line 0 Link Here
1
--- src/callback.c.orig	Mon Dec 20 12:58:26 2004
2
+++ src/callback.c	Thu Feb  3 20:08:07 2005
3
@@ -93,7 +93,7 @@
4
 	
5
 	if (!check_text_modification(sd)) {
6
 //		fi = get_file_info_by_selector(OPEN, sd->fi);
7
-		fi = get_fileinfo_from_selector(sd->mainwin->window, sd->fi, OPEN);
8
+		fi = get_fileinfo_from_chooser(sd->mainwin->window, sd->fi, OPEN);
9
 		if (fi) {
10
 			if (file_open_real(sd->mainwin->textview, fi)) {
11
 				g_free(fi);
12
@@ -123,7 +123,7 @@
13
 {
14
 	FileInfo *fi;
15
 	
16
-	fi = get_fileinfo_from_selector(sd->mainwin->window, sd->fi, SAVE);
17
+	fi = get_fileinfo_from_chooser(sd->mainwin->window, sd->fi, SAVE);
18
 	if (fi) {
19
 		if (file_save_real(sd->mainwin->textview, fi))
20
 			g_free(fi);
21
--- src/selector.c.orig	Fri Dec 24 10:35:12 2004
22
+++ src/selector.c	Thu Feb  3 21:02:00 2005
23
@@ -310,7 +310,7 @@
24
 	return option_menu;
25
 }
26
 
27
-static GtkWidget *create_file_selector(FileInfo *selected_fi)
28
+static GtkWidget *create_file_chooser(FileInfo *selected_fi, GtkWidget *window)
29
 {
30
 	GtkWidget *filesel;
31
 	GtkWidget *align;
32
@@ -322,12 +322,19 @@
33
 	
34
 	title = mode ? _("Open") : _("Save As");
35
 	
36
-	filesel = gtk_file_selection_new(title);
37
-//	gtk_window_set_transient_for(GTK_WINDOW(filesel), GTK_WINDOW(window));
38
+	if(mode == OPEN)
39
+		filesel = gtk_file_chooser_dialog_new(title, GTK_WINDOW(window),
40
+				GTK_FILE_CHOOSER_ACTION_OPEN,
41
+				GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,
42
+				GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,NULL);
43
+	else
44
+		filesel = gtk_file_chooser_dialog_new(title, GTK_WINDOW(window),
45
+				GTK_FILE_CHOOSER_ACTION_SAVE,
46
+				GTK_STOCK_CANCEL,GTK_RESPONSE_CANCEL,
47
+				GTK_STOCK_SAVE,GTK_RESPONSE_ACCEPT,NULL);
48
 	
49
 	align = gtk_alignment_new(1, 0, 0, 0);
50
-	gtk_box_pack_end(GTK_BOX(GTK_FILE_SELECTION(filesel)->main_vbox),
51
-		align, FALSE, FALSE, 0);
52
+	gtk_file_chooser_set_extra_widget(GTK_FILE_CHOOSER(filesel),align);
53
 	table = gtk_table_new(2, 2, FALSE);
54
 	gtk_table_set_row_spacings(GTK_TABLE(table), 5);
55
 	gtk_container_add(GTK_CONTAINER(align), table);
56
@@ -340,15 +347,15 @@
57
 		option_menu_lineend = create_lineend_menu(selected_fi);
58
 		gtk_table_attach_defaults(GTK_TABLE(table), option_menu_lineend, 1, 2, 0, 1);
59
 	}
60
-	gtk_widget_show_all(GTK_FILE_SELECTION(filesel)->main_vbox);
61
+	gtk_widget_show_all(GTK_FILE_CHOOSER(filesel));
62
 	
63
 	if (selected_fi->filename)
64
-		gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), selected_fi->filename);
65
+		gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(filesel), selected_fi->filename);
66
 	
67
 	return filesel;
68
 }
69
 
70
-FileInfo *get_fileinfo_from_selector(GtkWidget *window, FileInfo *fi, gint requested_mode)
71
+FileInfo *get_fileinfo_from_chooser(GtkWidget *window, FileInfo *fi, gint requested_mode)
72
 {
73
 	FileInfo *selected_fi;
74
 	GtkWidget *filesel;
75
@@ -366,24 +373,24 @@
76
 	selected_fi->manual_charset =
77
 		fi->manual_charset ? g_strdup(fi->manual_charset) : NULL;
78
 	
79
-	filesel = create_file_selector(selected_fi);
80
+	filesel = create_file_chooser(selected_fi,window);
81
 	
82
 	gtk_window_set_transient_for(GTK_WINDOW(filesel), GTK_WINDOW(window));
83
 	
84
 	do {
85
 		res = gtk_dialog_run(GTK_DIALOG(filesel));
86
-		if (res == GTK_RESPONSE_OK) {
87
+		if (res == GTK_RESPONSE_ACCEPT) {
88
 			if (selected_fi->filename)
89
 				g_free(selected_fi->filename);
90
 			selected_fi->filename = g_strdup(
91
-				gtk_file_selection_get_filename(GTK_FILE_SELECTION(filesel)));
92
+				gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filesel)));
93
 			if (g_file_test(selected_fi->filename, G_FILE_TEST_IS_DIR)) {
94
 				len = strlen(selected_fi->filename);
95
 				if (len < 1 || selected_fi->filename[len - 1] != G_DIR_SEPARATOR)
96
 					str = g_strconcat(selected_fi->filename, G_DIR_SEPARATOR_S, NULL);
97
 				else
98
 					str = g_strdup(selected_fi->filename);
99
-				gtk_file_selection_set_filename(GTK_FILE_SELECTION(filesel), str);
100
+				gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(filesel), str);
101
 				g_free(str);
102
 				continue;
103
 			}
104
@@ -397,14 +404,14 @@
105
 				case GTK_RESPONSE_NO:
106
 					continue;
107
 				case GTK_RESPONSE_YES:
108
-					res = GTK_RESPONSE_OK;
109
+					res = GTK_RESPONSE_ACCEPT;
110
 				}
111
 			}
112
 		}
113
 		gtk_widget_hide(filesel);
114
 	} while (GTK_WIDGET_VISIBLE(filesel));
115
 	
116
-	if (res != GTK_RESPONSE_OK) {
117
+	if (res != GTK_RESPONSE_ACCEPT) {
118
 		if (selected_fi->charset)
119
 			g_free(selected_fi->charset);
120
 		if (selected_fi->manual_charset)
121
--- src/selector.h.orig	Thu Feb  3 20:17:09 2005
122
+++ src/selector.h	Thu Feb  3 20:17:27 2005
123
@@ -30,6 +30,6 @@
124
 	OPEN
125
 };
126
 
127
-FileInfo *get_fileinfo_from_selector(GtkWidget *window, FileInfo *fi, gint requested_mode);
128
+FileInfo *get_fileinfo_from_chooser(GtkWidget *window, FileInfo *fi, gint requested_mode);
129
 
130
 #endif  /* _SELECTOR_H */

Return to bug 78691