178 |
fclose(f); |
fclose(f); |
179 |
|
|
180 |
} else { |
} else { |
181 |
if(context->appdata->load_images) { |
printf("image file doesn't exist, starting extra thread!\n"); |
|
printf("image file doesn't exist, starting extra thread!\n"); |
|
182 |
|
|
183 |
checkdir(path); |
checkdir(path); |
184 |
|
|
185 |
/* walk to end of list */ |
/* walk to end of list */ |
186 |
load_context_t **load_context = &(context->load_context); |
load_context_t **load_context = &(context->load_context); |
187 |
while(*load_context) |
while(*load_context) |
188 |
load_context = &(*load_context)->next; |
load_context = &(*load_context)->next; |
189 |
|
|
190 |
*load_context = g_new0(load_context_t, 1); |
*load_context = g_new0(load_context_t, 1); |
191 |
|
|
192 |
(*load_context)->url = strdup(url); |
(*load_context)->url = strdup(url); |
193 |
(*load_context)->path = strdup(path); |
(*load_context)->path = strdup(path); |
194 |
(*load_context)->view = context->view; |
(*load_context)->view = context->view; |
195 |
(*load_context)->stream = stream; |
(*load_context)->stream = stream; |
196 |
(*load_context)->next = NULL; |
(*load_context)->next = NULL; |
197 |
(*load_context)->active = TRUE; |
(*load_context)->active = TRUE; |
198 |
(*load_context)->mutex = g_mutex_new(); |
(*load_context)->mutex = g_mutex_new(); |
199 |
|
|
200 |
g_thread_create(loader_thread, *load_context, TRUE, NULL); |
g_thread_create(loader_thread, *load_context, TRUE, NULL); |
201 |
return; |
return; |
|
} else |
|
|
g_print("Image loading disabled\n"); |
|
202 |
} |
} |
203 |
} else { |
} else { |
204 |
/* not a cache, maybe help, so load images from icon directory */ |
/* not a cache, maybe help, so load images from icon directory */ |
244 |
} |
} |
245 |
} |
} |
246 |
|
|
247 |
|
#ifndef NO_COPY_N_PASTE |
248 |
static void on_destroy_textview(GtkWidget *widget, gpointer data) { |
static void on_destroy_textview(GtkWidget *widget, gpointer data) { |
249 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
250 |
int destroy_active = FALSE; |
int destroy_active = FALSE; |
282 |
gtk_widget_set_sensitive(appdata->menu_paste, FALSE); |
gtk_widget_set_sensitive(appdata->menu_paste, FALSE); |
283 |
} |
} |
284 |
} |
} |
285 |
|
#endif |
286 |
|
|
287 |
static void on_destroy_htmlview(GtkWidget *widget, gpointer data) { |
static void on_destroy_htmlview(GtkWidget *widget, gpointer data) { |
288 |
http_context_t *context = (http_context_t*)data; |
http_context_t *context = (http_context_t*)data; |
311 |
load_context = tmp_context; |
load_context = tmp_context; |
312 |
} |
} |
313 |
|
|
314 |
|
#ifndef NO_COPY_N_PASTE |
315 |
on_destroy_textview(widget, context->appdata); |
on_destroy_textview(widget, context->appdata); |
316 |
|
#endif |
317 |
|
|
318 |
/* destroy context */ |
/* destroy context */ |
319 |
free(data); |
free(data); |
320 |
} |
} |
321 |
|
|
322 |
|
#ifndef NO_COPY_N_PASTE |
323 |
static gboolean focus_in(GtkWidget *widget, GdkEventFocus *event, |
static gboolean focus_in(GtkWidget *widget, GdkEventFocus *event, |
324 |
gpointer data) { |
gpointer data) { |
325 |
appdata_t *appdata = (appdata_t*)data; |
appdata_t *appdata = (appdata_t*)data; |
345 |
void html_copy_to_clipboard(appdata_t *appdata) { |
void html_copy_to_clipboard(appdata_t *appdata) { |
346 |
gtk_html_copy(GTK_HTML(appdata->active_buffer)); |
gtk_html_copy(GTK_HTML(appdata->active_buffer)); |
347 |
} |
} |
348 |
|
#endif |
|
/* panning a gtkhtml view currently doesn't work well */ |
|
|
#undef PANNABLE_HTML |
|
349 |
|
|
350 |
#ifdef PANNABLE_HTML |
#ifdef PANNABLE_HTML |
351 |
/* eat the button events */ |
/* eat the button events */ |
413 |
GtkTextBuffer *buffer = gtk_text_buffer_new(NULL); |
GtkTextBuffer *buffer = gtk_text_buffer_new(NULL); |
414 |
gtk_text_buffer_set_text(buffer, text, strlen(text)); |
gtk_text_buffer_set_text(buffer, text, strlen(text)); |
415 |
|
|
416 |
#ifndef USE_MAEMO |
#ifndef USE_HILDON_TEXT_VIEW |
417 |
view = gtk_text_view_new_with_buffer(buffer); |
view = gtk_text_view_new_with_buffer(buffer); |
418 |
#else |
#else |
419 |
view = hildon_text_view_new(); |
view = hildon_text_view_new(); |
424 |
gtk_text_view_set_editable(GTK_TEXT_VIEW(view), FALSE); |
gtk_text_view_set_editable(GTK_TEXT_VIEW(view), FALSE); |
425 |
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(view), FALSE); |
gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(view), FALSE); |
426 |
|
|
427 |
|
#ifndef NO_COPY_N_PASTE |
428 |
g_signal_connect(G_OBJECT(view), "destroy", |
g_signal_connect(G_OBJECT(view), "destroy", |
429 |
G_CALLBACK(on_destroy_textview), appdata); |
G_CALLBACK(on_destroy_textview), appdata); |
430 |
|
#endif |
431 |
} |
} |
432 |
|
|
433 |
|
#ifndef NO_COPY_N_PASTE |
434 |
g_signal_connect(G_OBJECT(view), "focus-in-event", |
g_signal_connect(G_OBJECT(view), "focus-in-event", |
435 |
G_CALLBACK(focus_in), appdata); |
G_CALLBACK(focus_in), appdata); |
436 |
|
#endif |
437 |
|
|
438 |
if(scrollwin) { |
if(scrollwin) { |
439 |
#ifndef USE_PANNABLE_AREA |
#ifndef USE_PANNABLE_AREA |