Rename page_get_id to page_get_index

This commit is contained in:
Moritz Lipp 2012-03-26 15:30:58 +02:00
parent 1133207a48
commit 5bf32f33a5
5 changed files with 12 additions and 11 deletions

View file

@ -328,7 +328,7 @@ cmd_search(girara_session_t* session, const char* input, girara_argument_t* argu
g_object_set(page_widget, "search-results", result, NULL);
if (firsthit == true) {
if (page_id != 0) {
page_set_delayed(zathura, zathura_page_get_id(page));
page_set_delayed(zathura, zathura_page_get_index(page));
}
g_object_set(page_widget, "search-current", 0, NULL);
firsthit = false;

10
page.c
View file

@ -12,7 +12,7 @@
struct zathura_page_s {
double height; /**< Page height */
double width; /**< Page width */
unsigned int id; /**< Page number */
unsigned int index; /**< Page number */
void* data; /**< Custom data */
bool visible; /**< Page is visible */
GtkWidget* widget; /**< Drawing area */
@ -20,7 +20,7 @@ struct zathura_page_s {
};
zathura_page_t*
zathura_page_new(zathura_document_t* document, unsigned int id, zathura_plugin_error_t* error)
zathura_page_new(zathura_document_t* document, unsigned int index, zathura_plugin_error_t* error)
{
if (document == NULL || document->zathura == NULL || document->zathura->ui.session == NULL) {
if (error != NULL) {
@ -32,7 +32,7 @@ zathura_page_new(zathura_document_t* document, unsigned int id, zathura_plugin_e
/* init page */
zathura_page_t* page = g_malloc0(sizeof(zathura_page_t));
page->id = id;
page->index = index;
page->visible = false;
page->document = document;
page->widget = zathura_page_widget_new(page);
@ -118,13 +118,13 @@ zathura_page_get_document(zathura_page_t* page)
}
unsigned int
zathura_page_get_id(zathura_page_t* page)
zathura_page_get_index(zathura_page_t* page)
{
if (page == NULL) {
return 0;
}
return page->id;
return page->index;
}
GtkWidget*

7
page.h
View file

@ -11,11 +11,12 @@
* Get the page object
*
* @param document The document
* @param id Page number
* @param index Page number
* @param error Optional error
* @return Page object or NULL if an error occured
*/
zathura_page_t* zathura_page_new(zathura_document_t* document, unsigned int id, zathura_plugin_error_t* error);
zathura_page_t* zathura_page_new(zathura_document_t* document, unsigned int
index, zathura_plugin_error_t* error);
/**
* Frees the page object
@ -41,7 +42,7 @@ zathura_document_t* zathura_page_get_document(zathura_page_t* page);
* @param page The page object
* @return The id of the page
*/
unsigned int zathura_page_get_id(zathura_page_t* page);
unsigned int zathura_page_get_index(zathura_page_t* page);
/**
* Returns the page widget of the page

View file

@ -31,7 +31,7 @@ render_job(void* data, void* user_data)
}
if (render(zathura, page) != true) {
girara_error("Rendering failed (page %d)\n", zathura_page_get_id(page));
girara_error("Rendering failed (page %d)\n", zathura_page_get_index(page));
}
}

View file

@ -572,7 +572,7 @@ sc_search(girara_session_t* session, girara_argument_t* argument,
for (int npage_id = 1; page_id < num_pages; ++npage_id) {
int ntmp = cur_page + diff * (page_id + npage_id);
zathura_page_t* npage = zathura->document->pages[(ntmp + 2*num_pages) % num_pages];
zathura->document->current_page_number = zathura_page_get_id(npage);
zathura->document->current_page_number = zathura_page_get_index(npage);
GtkWidget* npage_page_widget = zathura_page_get_widget(npage);
g_object_get(npage_page_widget, "search-length", &num_search_results, NULL);
if (num_search_results != 0) {