… | |
… | |
72 | |
72 | |
73 | return rv; |
73 | return rv; |
74 | } |
74 | } |
75 | |
75 | |
76 | static gchar * |
76 | static gchar * |
77 | to_uri (gchar * file) |
77 | to_uri (gchar *file) |
78 | { |
78 | { |
79 | gchar *rv = NULL; |
79 | gchar *rv = NULL; |
80 | |
80 | |
81 | if (file) |
81 | if (file) |
82 | { |
82 | { |
… | |
… | |
107 | } |
107 | } |
108 | |
108 | |
109 | return files; |
109 | return files; |
110 | } |
110 | } |
111 | |
111 | |
112 | gchar * gtk_file_chooser_get_uri (GtkFileChooser *chooser) |
112 | gchar *gtk_file_chooser_get_uri (GtkFileChooser *chooser) |
113 | { |
113 | { |
114 | return to_uri(gtk_file_chooser_get_filename (chooser)); |
114 | return to_uri(gtk_file_chooser_get_filename (chooser)); |
115 | } |
115 | } |
116 | |
116 | |
117 | gboolean gtk_file_chooser_set_uri (GtkFileChooser *chooser, const char *uri) |
117 | gboolean gtk_file_chooser_set_uri (GtkFileChooser *chooser, const char *uri) |
… | |
… | |
150 | return FALSE; |
150 | return FALSE; |
151 | } |
151 | } |
152 | |
152 | |
153 | static gboolean read_result (GIOChannel *source, GIOCondition condition, gpointer data) |
153 | static gboolean read_result (GIOChannel *source, GIOCondition condition, gpointer data) |
154 | { |
154 | { |
|
|
155 | if (last_path) |
|
|
156 | { |
|
|
157 | g_free (last_path); |
|
|
158 | last_path = 0; |
|
|
159 | } |
|
|
160 | |
155 | g_io_channel_read_to_end (source, &last_path, 0, 0); |
161 | g_io_channel_read_to_end (source, &last_path, 0, 0); |
156 | g_io_channel_unref (source); |
162 | g_io_channel_unref (source); |
157 | activate_cb (data); |
163 | activate_cb (data); |
158 | return FALSE; |
164 | return FALSE; |
159 | } |
165 | } |
… | |
… | |
187 | if (save) |
193 | if (save) |
188 | ((void (*)(void *, const char *)) dlsym (RTLD_NEXT, "gtk_file_chooser_set_current_name"))(GTK_FILE_CHOOSER (widget), "/tmp/gtkbfc/empty"); |
194 | ((void (*)(void *, const char *)) dlsym (RTLD_NEXT, "gtk_file_chooser_set_current_name"))(GTK_FILE_CHOOSER (widget), "/tmp/gtkbfc/empty"); |
189 | else |
195 | else |
190 | ((void (*)(void *, const char *)) dlsym (RTLD_NEXT, "gtk_file_chooser_set_filename"))(GTK_FILE_CHOOSER (widget), "/tmp/gtkbfc/empty"); |
196 | ((void (*)(void *, const char *)) dlsym (RTLD_NEXT, "gtk_file_chooser_set_filename"))(GTK_FILE_CHOOSER (widget), "/tmp/gtkbfc/empty"); |
191 | |
197 | |
192 | if (last_path) |
|
|
193 | { |
|
|
194 | g_free (last_path); |
|
|
195 | last_path = 0; |
|
|
196 | } |
|
|
197 | |
|
|
198 | gint stdout_fd = -1; |
198 | gint stdout_fd = -1; |
199 | |
199 | |
200 | if (g_spawn_async_with_pipes (0, argv, 0, 0, 0, 0, 0, 0, &stdout_fd, 0, 0)) |
200 | if (g_spawn_async_with_pipes (0, argv, 0, 0, 0, 0, 0, 0, &stdout_fd, 0, 0)) |
201 | { |
201 | { |
202 | GIOChannel *channel = g_io_channel_unix_new (stdout_fd); |
202 | GIOChannel *channel = g_io_channel_unix_new (stdout_fd); |