mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-13 09:13:45 +01:00
Make sure that we pass GObject* everywhere
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
01683e5492
commit
9dc02b6425
@ -43,19 +43,20 @@ draw_links(zathura_t* zathura)
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
|
GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
|
||||||
g_object_set(page_widget, "draw-search-results", FALSE, NULL);
|
GObject* obj_page_widget = G_OBJECT(page_widget);
|
||||||
|
g_object_set(obj_page_widget, "draw-search-results", FALSE, NULL);
|
||||||
if (zathura_page_get_visibility(page) == true) {
|
if (zathura_page_get_visibility(page) == true) {
|
||||||
g_object_set(page_widget, "draw-links", TRUE, NULL);
|
g_object_set(obj_page_widget, "draw-links", TRUE, NULL);
|
||||||
|
|
||||||
int number_of_links = 0;
|
int number_of_links = 0;
|
||||||
g_object_get(page_widget, "number-of-links", &number_of_links, NULL);
|
g_object_get(obj_page_widget, "number-of-links", &number_of_links, NULL);
|
||||||
if (number_of_links != 0) {
|
if (number_of_links != 0) {
|
||||||
show_links = true;
|
show_links = true;
|
||||||
}
|
}
|
||||||
g_object_set(page_widget, "offset-links", page_offset, NULL);
|
g_object_set(obj_page_widget, "offset-links", page_offset, NULL);
|
||||||
page_offset += number_of_links;
|
page_offset += number_of_links;
|
||||||
} else {
|
} else {
|
||||||
g_object_set(page_widget, "draw-links", FALSE, NULL);
|
g_object_set(obj_page_widget, "draw-links", FALSE, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return show_links;
|
return show_links;
|
||||||
@ -81,9 +82,10 @@ sc_abort(girara_session_t* session, girara_argument_t* UNUSED(argument),
|
|||||||
}
|
}
|
||||||
|
|
||||||
GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
|
GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
|
||||||
g_object_set(page_widget, "draw-links", FALSE, NULL);
|
GObject* obj_page_widget = G_OBJECT(page_widget);
|
||||||
|
g_object_set(obj_page_widget, "draw-links", FALSE, NULL);
|
||||||
if (clear_search == true) {
|
if (clear_search == true) {
|
||||||
g_object_set(page_widget, "draw-search-results", FALSE, NULL);
|
g_object_set(obj_page_widget, "draw-search-results", FALSE, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -865,7 +867,7 @@ sc_search(girara_session_t* session, girara_argument_t* argument,
|
|||||||
girara_setting_get(session, "nohlsearch", &nohlsearch);
|
girara_setting_get(session, "nohlsearch", &nohlsearch);
|
||||||
|
|
||||||
if (nohlsearch == false) {
|
if (nohlsearch == false) {
|
||||||
g_object_get(cur_page_widget, "draw-search-results", &draw, NULL);
|
g_object_get(G_OBJECT(cur_page_widget), "draw-search-results", &draw, NULL);
|
||||||
|
|
||||||
if (draw == false) {
|
if (draw == false) {
|
||||||
first_time_after_abort = true;
|
first_time_after_abort = true;
|
||||||
@ -891,7 +893,7 @@ sc_search(girara_session_t* session, girara_argument_t* argument,
|
|||||||
GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
|
GtkWidget* page_widget = zathura_page_get_widget(zathura, page);
|
||||||
|
|
||||||
int num_search_results = 0, current = -1;
|
int num_search_results = 0, current = -1;
|
||||||
g_object_get(page_widget, "search-current", ¤t, "search-length", &num_search_results, NULL);
|
g_object_get(G_OBJECT(page_widget), "search-current", ¤t, "search-length", &num_search_results, NULL);
|
||||||
if (num_search_results == 0 || current == -1) {
|
if (num_search_results == 0 || current == -1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -911,13 +913,13 @@ sc_search(girara_session_t* session, girara_argument_t* argument,
|
|||||||
target_idx = current - 1;
|
target_idx = current - 1;
|
||||||
} else {
|
} else {
|
||||||
/* the next result is on a different page */
|
/* the next result is on a different page */
|
||||||
g_object_set(page_widget, "search-current", -1, NULL);
|
g_object_set(G_OBJECT(page_widget), "search-current", -1, NULL);
|
||||||
|
|
||||||
for (int npage_id = 1; page_id < num_pages; ++npage_id) {
|
for (int npage_id = 1; page_id < num_pages; ++npage_id) {
|
||||||
int ntmp = cur_page + diff * (page_id + npage_id);
|
int ntmp = cur_page + diff * (page_id + npage_id);
|
||||||
zathura_page_t* npage = zathura_document_get_page(zathura->document, (ntmp + 2*num_pages) % num_pages);
|
zathura_page_t* npage = zathura_document_get_page(zathura->document, (ntmp + 2*num_pages) % num_pages);
|
||||||
GtkWidget* npage_page_widget = zathura_page_get_widget(zathura, npage);
|
GtkWidget* npage_page_widget = zathura_page_get_widget(zathura, npage);
|
||||||
g_object_get(npage_page_widget, "search-length", &num_search_results, NULL);
|
g_object_get(G_OBJECT(npage_page_widget), "search-length", &num_search_results, NULL);
|
||||||
if (num_search_results != 0) {
|
if (num_search_results != 0) {
|
||||||
target_page = npage;
|
target_page = npage;
|
||||||
target_idx = diff == 1 ? 0 : num_search_results - 1;
|
target_idx = diff == 1 ? 0 : num_search_results - 1;
|
||||||
@ -932,8 +934,9 @@ sc_search(girara_session_t* session, girara_argument_t* argument,
|
|||||||
if (target_page != NULL) {
|
if (target_page != NULL) {
|
||||||
girara_list_t* results = NULL;
|
girara_list_t* results = NULL;
|
||||||
GtkWidget* page_widget = zathura_page_get_widget(zathura, target_page);
|
GtkWidget* page_widget = zathura_page_get_widget(zathura, target_page);
|
||||||
g_object_set(page_widget, "search-current", target_idx, NULL);
|
GObject* obj_page_widget = G_OBJECT(page_widget);
|
||||||
g_object_get(page_widget, "search-results", &results, NULL);
|
g_object_set(obj_page_widget, "search-current", target_idx, NULL);
|
||||||
|
g_object_get(obj_page_widget, "search-results", &results, NULL);
|
||||||
|
|
||||||
/* Need to adjust rectangle to page scale and orientation */
|
/* Need to adjust rectangle to page scale and orientation */
|
||||||
zathura_rectangle_t* rect = girara_list_nth(results, target_idx);
|
zathura_rectangle_t* rect = girara_list_nth(results, target_idx);
|
||||||
|
Loading…
Reference in New Issue
Block a user