Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
zathura
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
111
Issues
111
List
Boards
Labels
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pwmt
zathura
Commits
1133207a
Commit
1133207a
authored
Mar 26, 2012
by
Moritz Lipp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update zathura_page plugin functions
parent
efc108fb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
35 deletions
+50
-35
Makefile
Makefile
+1
-1
document.c
document.c
+1
-1
document.h
document.h
+6
-6
page.c
page.c
+40
-24
page.h
page.h
+2
-3
No files found.
Makefile
View file @
1133207a
...
...
@@ -6,7 +6,7 @@ include common.mk
PROJECT
=
zathura
OSOURCE
=
$(
wildcard
*
.c
)
HEADER
=
$(
wildcard
*
.h
)
HEADERINST
=
version.h zathura.h document.h macros.h
HEADERINST
=
version.h zathura.h document.h macros.h
page.h
ifneq
(${WITH_SQLITE},0)
INCS
+=
$(SQLITE_INC)
...
...
document.c
View file @
1133207a
...
...
@@ -372,7 +372,7 @@ zathura_document_open(zathura_t* zathura, const char* path, const char* password
}
for
(
unsigned
int
page_id
=
0
;
page_id
<
document
->
number_of_pages
;
page_id
++
)
{
zathura_page_t
*
page
=
zathura_page_
get
(
document
,
page_id
,
NULL
);
zathura_page_t
*
page
=
zathura_page_
new
(
document
,
page_id
,
NULL
);
if
(
page
==
NULL
)
{
goto
error_free
;
}
...
...
document.h
View file @
1133207a
...
...
@@ -284,7 +284,12 @@ struct zathura_document_s
/**
* Gets the page object
*/
zathura_page_t
*
(
*
page_get
)(
zathura_document_t
*
document
,
unsigned
int
page_id
,
zathura_plugin_error_t
*
error
);
zathura_plugin_error_t
(
*
page_init
)(
zathura_page_t
*
page
);
/**
* Free page
*/
zathura_plugin_error_t
(
*
page_clear
)(
zathura_page_t
*
page
);
/**
* Search text
...
...
@@ -325,11 +330,6 @@ struct zathura_document_s
* Renders the page
*/
zathura_plugin_error_t
(
*
page_render_cairo
)(
zathura_page_t
*
page
,
cairo_t
*
cairo
,
bool
printing
);
/**
* Free page
*/
zathura_plugin_error_t
(
*
page_free
)(
zathura_page_t
*
page
);
}
functions
;
/**
...
...
page.c
View file @
1133207a
...
...
@@ -20,7 +20,7 @@ struct zathura_page_s {
};
zathura_page_t
*
zathura_page_
get
(
zathura_document_t
*
document
,
unsigned
int
page_
id
,
zathura_plugin_error_t
*
error
)
zathura_page_
new
(
zathura_document_t
*
document
,
unsigned
int
id
,
zathura_plugin_error_t
*
error
)
{
if
(
document
==
NULL
||
document
->
zathura
==
NULL
||
document
->
zathura
->
ui
.
session
==
NULL
)
{
if
(
error
!=
NULL
)
{
...
...
@@ -29,9 +29,23 @@ zathura_page_get(zathura_document_t* document, unsigned int page_id, zathura_plu
goto
error_ret
;
}
zathura_page_t
*
page
=
NULL
;
/* init page */
zathura_page_t
*
page
=
g_malloc0
(
sizeof
(
zathura_page_t
));
if
(
document
->
functions
.
page_get
==
NULL
)
{
page
->
id
=
id
;
page
->
visible
=
false
;
page
->
document
=
document
;
page
->
widget
=
zathura_page_widget_new
(
page
);
if
(
page
->
widget
==
NULL
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_PLUGIN_ERROR_UNKNOWN
;
}
goto
error_free
;
}
/* init plugin */
if
(
document
->
functions
.
page_init
==
NULL
)
{
if
(
error
!=
NULL
)
{
girara_notify
(
page
->
document
->
zathura
->
ui
.
session
,
GIRARA_WARNING
,
_
(
"%s not implemented"
),
__FUNCTION__
);
girara_error
(
"%s not implemented"
,
__FUNCTION__
);
...
...
@@ -40,27 +54,20 @@ zathura_page_get(zathura_document_t* document, unsigned int page_id, zathura_plu
goto
error_ret
;
}
page
=
document
->
functions
.
page_get
(
document
,
page_id
,
error
);
if
(
page
!=
NULL
)
{
page
->
id
=
page_id
;
page
->
visible
=
false
;
page
->
document
=
document
;
page
->
widget
=
zathura_page_widget_new
(
page
);
if
(
page
->
widget
==
NULL
)
{
if
(
error
!=
NULL
)
{
*
error
=
ZATHURA_PLUGIN_ERROR_UNKNOWN
;
}
goto
error_free
;
zathura_plugin_error_t
ret
=
document
->
functions
.
page_init
(
page
);
if
(
ret
!=
ZATHURA_PLUGIN_ERROR_OK
)
{
if
(
error
!=
NULL
)
{
*
error
=
ret
;
}
goto
error_free
;
}
unsigned
int
page_height
=
0
;
unsigned
int
page_width
=
0
;
page_calc_height_width
(
page
,
&
page_height
,
&
page_width
,
true
);
/* set widget size */
unsigned
int
page_height
=
0
;
unsigned
int
page_width
=
0
;
page_calc_height_width
(
page
,
&
page_height
,
&
page_width
,
true
);
gtk_widget_set_size_request
(
page
->
widget
,
page_width
,
page_height
);
}
gtk_widget_set_size_request
(
page
->
widget
,
page_width
,
page_height
);
return
page
;
...
...
@@ -78,17 +85,26 @@ error_ret:
zathura_plugin_error_t
zathura_page_free
(
zathura_page_t
*
page
)
{
if
(
page
==
NULL
||
page
->
document
==
NULL
||
page
->
document
->
zathura
==
NULL
||
page
->
document
->
zathura
->
ui
.
session
==
NULL
)
{
if
(
page
==
NULL
)
{
return
ZATHURA_PLUGIN_ERROR_INVALID_ARGUMENTS
;
}
if
(
page
->
document
==
NULL
||
page
->
document
->
zathura
==
NULL
||
page
->
document
->
zathura
->
ui
.
session
==
NULL
)
{
g_free
(
page
);
return
ZATHURA_PLUGIN_ERROR_INVALID_ARGUMENTS
;
}
if
(
page
->
document
->
functions
.
page_
free
==
NULL
)
{
if
(
page
->
document
->
functions
.
page_
clear
==
NULL
)
{
girara_notify
(
page
->
document
->
zathura
->
ui
.
session
,
GIRARA_WARNING
,
_
(
"%s not implemented"
),
__FUNCTION__
);
girara_error
(
"%s not implemented"
,
__FUNCTION__
);
return
ZATHURA_PLUGIN_ERROR_NOT_IMPLEMENTED
;
}
return
page
->
document
->
functions
.
page_free
(
page
);
zathura_plugin_error_t
error
=
page
->
document
->
functions
.
page_clear
(
page
);
g_free
(
page
);
return
error
;
}
zathura_document_t
*
...
...
page.h
View file @
1133207a
...
...
@@ -12,11 +12,10 @@
*
* @param document The document
* @param id Page number
* @param error Set to an error value (see \ref zathura_plugin_error_t) if an
* error occured
* @param error Optional error
* @return Page object or NULL if an error occured
*/
zathura_page_t
*
zathura_page_
get
(
zathura_document_t
*
document
,
unsigned
int
page_
id
,
zathura_plugin_error_t
*
error
);
zathura_page_t
*
zathura_page_
new
(
zathura_document_t
*
document
,
unsigned
int
id
,
zathura_plugin_error_t
*
error
);
/**
* Frees the page object
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment