Diff of /trunk/src/html.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1 by harbaum, Sat Jun 20 11:08:47 2009 UTC revision 12 by harbaum, Fri Jun 26 20:07:33 2009 UTC
# Line 178  static void on_request_url(GtkHTML *html Line 178  static void on_request_url(GtkHTML *html
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 */
# Line 247  void html_zoom(appdata_t *appdata, gbool Line 244  void html_zoom(appdata_t *appdata, gbool
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;
# Line 284  static void on_destroy_textview(GtkWidge Line 282  static void on_destroy_textview(GtkWidge
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;
# Line 312  static void on_destroy_htmlview(GtkWidge Line 311  static void on_destroy_htmlview(GtkWidge
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;
# Line 343  static gboolean focus_in(GtkWidget *widg Line 345  static gboolean focus_in(GtkWidget *widg
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
349    
350  /* panning a gtkhtml view currently doesn't work well */  /* panning a gtkhtml view currently doesn't work well */
351  #undef PANNABLE_HTML  #define PANNABLE_HTML
352    
353  #ifdef PANNABLE_HTML  #ifdef PANNABLE_HTML
354  /* eat the button events */  /* eat the button events */
# Line 413  GtkWidget *html_view(appdata_t *appdata, Line 416  GtkWidget *html_view(appdata_t *appdata,
416      GtkTextBuffer *buffer = gtk_text_buffer_new(NULL);      GtkTextBuffer *buffer = gtk_text_buffer_new(NULL);
417      gtk_text_buffer_set_text(buffer, text, strlen(text));      gtk_text_buffer_set_text(buffer, text, strlen(text));
418    
419  #ifndef USE_MAEMO  #ifndef USE_HILDON_TEXT_VIEW
420      view = gtk_text_view_new_with_buffer(buffer);      view = gtk_text_view_new_with_buffer(buffer);
421  #else  #else
422      view = hildon_text_view_new();      view = hildon_text_view_new();
# Line 424  GtkWidget *html_view(appdata_t *appdata, Line 427  GtkWidget *html_view(appdata_t *appdata,
427      gtk_text_view_set_editable(GTK_TEXT_VIEW(view), FALSE);      gtk_text_view_set_editable(GTK_TEXT_VIEW(view), FALSE);
428      gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(view), FALSE);      gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(view), FALSE);
429    
430    #ifndef NO_COPY_N_PASTE
431      g_signal_connect(G_OBJECT(view), "destroy",      g_signal_connect(G_OBJECT(view), "destroy",
432                       G_CALLBACK(on_destroy_textview), appdata);                       G_CALLBACK(on_destroy_textview), appdata);
433    #endif
434    }    }
435    
436    #ifndef NO_COPY_N_PASTE
437    g_signal_connect(G_OBJECT(view), "focus-in-event",    g_signal_connect(G_OBJECT(view), "focus-in-event",
438                     G_CALLBACK(focus_in), appdata);                     G_CALLBACK(focus_in), appdata);
439    #endif
440    
441    if(scrollwin) {    if(scrollwin) {
442  #ifndef USE_PANNABLE_AREA  #ifndef USE_PANNABLE_AREA

Legend:
Removed from v.1  
changed lines
  Added in v.12