erbrowser/src/mozEmbedCallbacks.h File Reference

browser - eReader "GtkMozEmbed" related callbacks More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void location_changed_cb (GtkMozEmbed *embed, gpointer data)
void visibility_cb (GtkMozEmbed *embed, gboolean visibility, Ereader *browser)
void load_finished_cb (GtkMozEmbed *embed, Ereader *browser)
void progress_change_cb (GtkMozEmbed *embed, gint cur, gint max, Ereader *browser)
void status_change_cb (GtkMozEmbed *embed, gpointer request, gint status, gpointer message)
gint open_uri_cb (GtkMozEmbed *embed, const char *uri, gpointer data)


Detailed Description

browser - eReader "GtkMozEmbed" related callbacks

<File description>="">

Definition in file mozEmbedCallbacks.h.


Function Documentation

void load_finished_cb ( GtkMozEmbed *  embed,
Ereader browser 
)

Callback "net_stop" This signal is emitted any time that the loading of a document has completed

Parameters:
embed reference to MozEmbed widget
browser reference to reader struct
Returns:
void

Definition at line 116 of file mozEmbedCallbacks.cpp.

00117 {
00118     gchar  *type = NULL;
00119     gboolean pagebar_update_needed = FALSE;
00120     gboolean page_type_known = FALSE;
00121     int     pageCount;
00122     int     page;
00123         int     offset;
00124         gchar  *url = NULL;
00125 
00126     BR_PAGEBARPRINTF("________________BROWSER - load_finished _____________");
00127 #ifdef TIMING_INFORMATION_ENABLED
00128     timing_display_time_elapsed();
00129 #endif //TIMING_INFORMATION_ENABLED
00130 
00131     BR_PAGEBARPRINTF("0x%x -- mozembed 0x%x -- pagestatus 0x%x", browser, embed, browser->pageStatus);
00132 
00133     // Comes from browser examples => still have to look into this  
00134     // nsMemory::HeapMinimize(PR_TRUE);
00135 
00136     // retrieve the page type information from the XHTML meta data
00137     page_type_known = mozilla_get_page_type(GTK_MOZ_EMBED(browser->mozEmbed), &type);
00138 
00139     // given the type, determine the pagecount and the current page 
00140     if (!page_type_known)
00141     {
00142         BR_PAGEBARPRINTF("---- mozilla_get_page_type returned unknown page type ----");
00143         type = g_strdup(INVALID_PAGE_TYPE);
00144         pageCount = DEFAULT_PAGE_COUNT;
00145         page = DEFAULT_PAGE;
00146         }
00147     else
00148     {
00149                 if ( (pageCount = index_file_get_page_count(&browser->pageStatus->index, type)) == INVALID_PAGE_COUNT )
00150                 {
00151                         BR_WARNPRINTF("index_file_get_page_count() returned INVALID_PAGE_COUNT");
00152                         pageCount = DEFAULT_PAGE_COUNT;
00153                         page = DEFAULT_PAGE;
00154                 }
00155                 else
00156                 {
00157                 BR_PAGEBARPRINTF("---- mozilla_get_page_type returned %s (count %d) ----", type, pageCount);
00158                         
00159                         url = gtk_moz_embed_get_location(GTK_MOZ_EMBED(browser->mozEmbed));
00160                         BR_PAGEBARPRINTF("load_finished_cb -- location %s", url);
00161 
00162                         page = index_file_get_page_number(&browser->pageStatus->index, type, url);
00163                         BR_PAGEBARPRINTF("index_file_get_page_number returned %d", page);
00164                 }
00165 
00166     }
00167 
00168         browser->pageStatus->pageCount = pageCount;
00169         browser->pageStatus->currentPage = page;
00170         
00171         offset = mozilla_determine_page_offset(GTK_MOZ_EMBED(browser->mozEmbed));
00172         BR_PAGEBARPRINTF("mozilla_determine_page_offset returned %d", offset);
00173 
00174         // This pagebar_update_needed stuff is some legacy code. It saves 1 IPC call, but introduces other overhead
00175         // TODO: evaluate this code... [MvdW]
00176         BR_PAGEBARPRINTF("---- mozilla_get_page_type -- page_status_handle_type_update %s [0x%x]----", type, browser->pageStatus);
00177     pagebar_update_needed = page_status_handle_type_update(browser->pageStatus, type);
00178 
00179     if (!pagebar_update_needed)
00180     {
00181         BR_PAGEBARPRINTF("---- no pagebar_update_needed => select page %d ----", page);
00182         pagebar_goto_page(page);
00183                 pagebar_set_offset(offset);
00184         pagebar_redraw();
00185     }
00186     else
00187     {
00188         BR_PAGEBARPRINTF("---- pagebar_update_needed => redraw pagebar %d select page %d ----", pageCount, page);
00189         pagebar_set_pagecount(pageCount);
00190         pagebar_goto_page(page);
00191                 pagebar_set_offset(offset);
00192         pagebar_redraw();
00193     }
00194 
00195     // free used memory
00196     if (type)
00197     {
00198         g_free(type);
00199         type = NULL;
00200     }
00201 
00202     if (url)
00203     {
00204         g_free(url);
00205         url = NULL;
00206     }
00207 
00208 #ifdef SELECTION_ENABLED
00209     // when needed, add the selections to this page
00210     selection_set_current_page_selections(GTK_MOZ_EMBED(embed));
00211 #endif // SELECTION_ENABLED
00212 
00213     // handle screen refresh
00214     BR_DISPLAYPRINTF("________________BROWSER - set idle callback _____________");
00215 
00216 #ifdef TIMING_INFORMATION_ENABLED
00217     timing_display_time_elapsed();
00218 #endif //TIMING_INFORMATION_ENABLED
00219 
00220     display_update_request_screen_refresh(MOZEMBED_UPDATE_LEVEL, NULL);
00221 
00222 }

Here is the call graph for this function:

void location_changed_cb ( GtkMozEmbed *  embed,
gpointer  data 
)

Callback "location signal" this signal is emitted any time that the location of the document has changed.

Parameters:
embed reference to MozEmbed widget
data NULL
Returns:
void

Definition at line 98 of file mozEmbedCallbacks.cpp.

00099 {
00100     BR_PAGEBARPRINTF("________________BROWSER - location_changed_cb _____________");
00101 
00102     // => only request a refresh load finished or a higher level
00103     display_update_increase_level(MOZEMBED_UPDATE_LEVEL);
00104 
00105 #ifdef TIMING_INFORMATION_ENABLED
00106     timing_display_time_elapsed();
00107 #endif //TIMING_INFORMATION_ENABLED
00108 }

Here is the call graph for this function:

gint open_uri_cb ( GtkMozEmbed *  embed,
const char *  uri,
gpointer  data 
)

Callback "open_uri signal" this signal is emitted any time that the browser wants to load a new URI.

Parameters:
embed reference to MozEmbed widget
uri the URI to be loaded
data NULL
Returns:
FALSE to load the URI, TRUE to prevent it from loading

Definition at line 51 of file mozEmbedCallbacks.cpp.

00052 {
00053     struct stat statbuf;
00054     char *path;
00055 
00056     BR_PAGEBARPRINTF("Going to load: %s\n", uri);
00057     
00058     path = mozilla_uri_to_path(uri);
00059 
00060     // Check if this location exists, otherwise do not follow URI (return TRUE)
00061     if (path != NULL && stat(path, &statbuf) != 0)
00062     {
00063         BR_ERRORPRINTF("Not jumping to non-existing page: %s [%s]\n", uri, path);
00064         erbusy_off();
00065         free(path);
00066         return TRUE; // Cancel loading of the page
00067     }
00068     else if (path != NULL)
00069     {
00070         free(path);
00071     }
00072 
00073 #ifdef ENABLE_LOGGING
00074     // MvdW: log this page!
00075     char * load = (char*)malloc(strlen(uri)+1);
00076     strcpy(load, uri);
00077     erlog_event_open(load);
00078     free(load);
00079 #endif
00080     
00081     // Set busy
00082     erbusy_blink();
00083     
00084     return FALSE; // this will load the URI, if we return TRUE the load will be cancelled
00085 }

Here is the call graph for this function:

void progress_change_cb ( GtkMozEmbed *  embed,
gint  cur,
gint  max,
Ereader browser 
)

Callback "progress" This signal is emitted any time that there is a cahnge in the progress of loading a document.

Parameters:
embed reference to MozEmbed widget
browser reference to reader struct
cur how much of the document has been downloaded
max the length of the document
Returns:
void

Definition at line 92 of file mozEmbedCallbacks.cpp.

00093 {
00094     BR_PAGEBARPRINTF("entry cur %d max %d", cur, max);
00095 }

void status_change_cb ( GtkMozEmbed *  embed,
gpointer  request,
gint  status,
gpointer  message 
)

Definition at line 87 of file mozEmbedCallbacks.cpp.

00088 {
00089     BR_PAGEBARPRINTF("entry status %d", status);
00090 }

void visibility_cb ( GtkMozEmbed *  embed,
gboolean  visibility,
Ereader browser 
)

Callback "location signal" This signal is emitted when the toplevel window in question needs to be shown or hidden. If the visibility argument is TRUE then the window should be shown. If it's FALSE it should be hidden.

Parameters:
embed reference to MozEmbed widget
visibility 
browser reference to rreader struct
Returns:
void

Definition at line 110 of file mozEmbedCallbacks.cpp.

00111 {
00112     BR_PAGEBARPRINTF("visibility_cb entry");
00113     set_browser_visibility(browser, visibility);
00114 }

Here is the call graph for this function:


Generated on Sun Dec 14 17:14:52 2008 by  doxygen 1.5.6