zathura
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros
Functions
utils.c File Reference
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <math.h>
#include <gtk/gtk.h>
#include <girara/datastructures.h>
#include <girara/session.h>
#include <girara/settings.h>
#include <girara/utils.h>
#include "links.h"
#include "utils.h"
#include "zathura.h"
#include "internal.h"
#include "document.h"
#include "page.h"
#include "plugin.h"
#include "content-type.h"

Go to the source code of this file.

Functions

bool file_valid_extension (zathura_t *zathura, const char *path)
void document_index_build (GtkTreeModel *model, GtkTreeIter *parent, girara_tree_node_t *tree)
zathura_rectangle_t rotate_rectangle (zathura_rectangle_t rectangle, unsigned int degree, double height, double width)
zathura_rectangle_t recalc_rectangle (zathura_page_t *page, zathura_rectangle_t rectangle)
GtkWidget * zathura_page_get_widget (zathura_t *zathura, zathura_page_t *page)
void document_draw_search_results (zathura_t *zathura, bool value)
char * zathura_get_version_string (zathura_t *zathura, bool markup)
char * replace_substring (const char *string, const char *old, const char *new)
GdkAtom * get_selection (zathura_t *zathura)

Function Documentation

void document_draw_search_results ( zathura_t *  zathura,
bool  value 
)

Set if the search results should be drawn or not

Parameters
zathuraZathura instance
valuetrue if they should be drawn, otherwise false

Definition at line 151 of file utils.c.

void document_index_build ( GtkTreeModel *  model,
GtkTreeIter *  parent,
girara_tree_node_t *  tree 
)

Generates the document index based upon the list retreived from the document object.

Parameters
modelThe tree model
parentThe tree iterator parent
treeThe Tree iterator

Definition at line 45 of file utils.c.

bool file_valid_extension ( zathura_t *  zathura,
const char *  path 
)

This function checks if the file has a valid extension. A extension is evaluated as valid if it matches a supported filetype.

Parameters
zathuraZathura object
pathThe path to the file
Returns
true if the extension is valid, otherwise false

Definition at line 27 of file utils.c.

GdkAtom* get_selection ( zathura_t *  zathura)

Get a pointer to the GdkAtom of the current clipboard.

Parameters
zathuraThe zathura instance
Returns
A pointer to a GdkAtom object correspoinding to the current clipboard, or NULL.

Definition at line 248 of file utils.c.

zathura_rectangle_t recalc_rectangle ( zathura_page_t *  page,
zathura_rectangle_t  rectangle 
)

Calculates the new coordinates based on the rotation and scale level of the document for the given rectangle

Parameters
pagePage where the rectangle should be
rectangleThe rectangle
Returns
New rectangle

Definition at line 109 of file utils.c.

char* replace_substring ( const char *  string,
const char *  old,
const char *  new 
)

Replaces all occurences of old in string with new and returns a new allocated string

Parameters
stringThe original string
oldString to replace
newReplacement string
Returns
new allocated string

Definition at line 204 of file utils.c.

zathura_rectangle_t rotate_rectangle ( zathura_rectangle_t  rectangle,
unsigned int  degree,
double  height,
double  width 
)

Rotate a rectangle by 0, 90, 180 or 270 degree

Parameters
rectanglethe rectangle to rotate
degreerotation degree
heightthe height of the enclosing rectangle
widththe width of the enclosing rectangle
Returns
the rotated rectangle

Definition at line 76 of file utils.c.

char* zathura_get_version_string ( zathura_t *  zathura,
bool  markup 
)

Create zathura version string

Parameters
zathuraThe zathura instance
markupEnable markup
Returns
Version string

Definition at line 164 of file utils.c.

GtkWidget* zathura_page_get_widget ( zathura_t *  zathura,
zathura_page_t *  page 
)

Returns the page widget of the page

Parameters
zathuraThe zathura instance
pageThe page object
Returns
The page widget of the page
NULL if an error occured

Definition at line 139 of file utils.c.