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 */ |
347 |
} |
} |
348 |
#endif |
#endif |
349 |
|
|
|
/* panning a gtkhtml view currently doesn't work well */ |
|
|
#undef PANNABLE_HTML |
|
|
|
|
350 |
#ifdef PANNABLE_HTML |
#ifdef PANNABLE_HTML |
351 |
/* eat the button events */ |
/* eat the button events */ |
352 |
static gboolean on_button_press(GtkWidget *widget, GdkEventButton *event, |
static gboolean on_button_press(GtkWidget *widget, GdkEventButton *event, |
362 |
static const char *html_end = "</body></html>"; |
static const char *html_end = "</body></html>"; |
363 |
|
|
364 |
GtkWidget *html_view(appdata_t *appdata, char *text, |
GtkWidget *html_view(appdata_t *appdata, char *text, |
365 |
gboolean is_html, gboolean scrollwin, |
html_mode_t mode, gboolean scrollwin, |
366 |
cache_t *cache, char *anchor) { |
cache_t *cache, char *anchor) { |
367 |
GtkWidget *view; |
GtkWidget *view; |
368 |
|
|
369 |
if(is_html) { |
if(mode == HTML_HTML) { |
370 |
http_context_t *context = g_new0(http_context_t, 1); |
http_context_t *context = g_new0(http_context_t, 1); |
371 |
context->appdata = appdata; |
context->appdata = appdata; |
372 |
context->cache = cache; |
context->cache = cache; |
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 |
|
/* make this look nicer in fremantle and not just black-on-white */ |
428 |
|
/* just use the default style */ |
429 |
|
#ifdef USE_STACKABLE_WINDOW |
430 |
|
/* in fremantle this is really tricky and we need to inherit the */ |
431 |
|
/* style from the topmost window in the stack */ |
432 |
|
HildonWindowStack *stack = hildon_window_stack_get_default(); |
433 |
|
GList *list = hildon_window_stack_get_windows(stack); |
434 |
|
gtk_widget_set_style(view, GTK_WIDGET(list->data)->style); |
435 |
|
g_list_free(list); |
436 |
|
#else |
437 |
|
gtk_widget_set_style(view, GTK_WIDGET(appdata->window)->style); |
438 |
|
#endif |
439 |
|
|
440 |
#ifndef NO_COPY_N_PASTE |
#ifndef NO_COPY_N_PASTE |
441 |
g_signal_connect(G_OBJECT(view), "destroy", |
g_signal_connect(G_OBJECT(view), "destroy", |
442 |
G_CALLBACK(on_destroy_textview), appdata); |
G_CALLBACK(on_destroy_textview), appdata); |
466 |
#endif |
#endif |
467 |
#else |
#else |
468 |
#ifndef PANNABLE_HTML |
#ifndef PANNABLE_HTML |
469 |
if(is_html) { |
if(mode == HTML_HTML) { |
470 |
GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL); |
GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL); |
471 |
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled_window), |
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled_window), |
472 |
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); |