Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ev-history.h File Reference
#include <glib-object.h>
#include <evince-document.h>
#include <evince-view.h>
+ Include dependency graph for ev-history.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _EvHistory
 
struct  _EvHistoryClass
 

Macros

#define EV_TYPE_HISTORY   (ev_history_get_type ())
 
#define EV_HISTORY(obj)   (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_HISTORY, EvHistory))
 
#define EV_HISTORY_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_HISTORY, EvHistoryClass))
 
#define EV_IS_HISTORY(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EV_TYPE_HISTORY))
 
#define EV_IS_HISTORY_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((obj), EV_TYPE_HISTORY))
 
#define EV_HISTORY_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS((obj), EV_TYPE_HISTORY, EvHistoryClass))
 

Typedefs

typedef struct _EvHistory EvHistory
 
typedef struct _EvHistoryPrivate EvHistoryPrivate
 
typedef struct _EvHistoryClass EvHistoryClass
 

Functions

GType ev_history_get_type (void)
 
EvHistoryev_history_new (EvDocumentModel *model)
 
void ev_history_add_link (EvHistory *history, EvLink *link)
 
gboolean ev_history_can_go_back (EvHistory *history)
 
void ev_history_go_back (EvHistory *history)
 
gboolean ev_history_can_go_forward (EvHistory *history)
 
void ev_history_go_forward (EvHistory *history)
 
gboolean ev_history_go_to_link (EvHistory *history, EvLink *link)
 
GList * ev_history_get_back_list (EvHistory *history)
 
GList * ev_history_get_forward_list (EvHistory *history)
 
void ev_history_freeze (EvHistory *history)
 
void ev_history_thaw (EvHistory *history)
 
gboolean ev_history_is_frozen (EvHistory *history)
 

Macro Definition Documentation

#define EV_HISTORY (   obj)    (G_TYPE_CHECK_INSTANCE_CAST ((obj), EV_TYPE_HISTORY, EvHistory))

Definition at line 30 of file ev-history.h.

#define EV_HISTORY_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), EV_TYPE_HISTORY, EvHistoryClass))

Definition at line 31 of file ev-history.h.

#define EV_HISTORY_GET_CLASS (   obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), EV_TYPE_HISTORY, EvHistoryClass))

Definition at line 34 of file ev-history.h.

#define EV_IS_HISTORY (   obj)    (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EV_TYPE_HISTORY))

Definition at line 32 of file ev-history.h.

#define EV_IS_HISTORY_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE ((obj), EV_TYPE_HISTORY))

Definition at line 33 of file ev-history.h.

#define EV_TYPE_HISTORY   (ev_history_get_type ())

Definition at line 29 of file ev-history.h.

Typedef Documentation

typedef struct _EvHistory EvHistory

Definition at line 36 of file ev-history.h.

Definition at line 38 of file ev-history.h.

Definition at line 37 of file ev-history.h.

Function Documentation

void ev_history_add_link ( EvHistory history,
EvLink link 
)

Definition at line 147 of file ev-history.c.

149 {
150  EvHistoryPrivate *priv;
151 
152  g_return_if_fail (EV_IS_HISTORY (history));
153  g_return_if_fail (EV_IS_LINK (link));
154 
155  if (ev_history_is_frozen (history))
156  return;
157 
158  priv = history->priv;
159 
160  if (priv->current) {
161  /* Truncate forward history at @current */
162  clear_list (priv->current->next);
163  priv->current->next = NULL;
164  }
165 
166  /* Push @link to the list */
167  priv->current = g_list_append (NULL, g_object_ref (link));
168  priv->list = g_list_concat (priv->list, priv->current);
169 
170  ev_history_prune (history);
171 
172  g_signal_emit (history, signals[CHANGED], 0);
173 }

+ Here is the caller graph for this function:

gboolean ev_history_can_go_back ( EvHistory history)

Definition at line 190 of file ev-history.c.

191 {
192  EvHistoryPrivate *priv;
193 
194  g_return_val_if_fail (EV_IS_HISTORY (history), FALSE);
195 
196  if (ev_history_is_frozen (history))
197  return FALSE;
198 
199  priv = history->priv;
200  return priv->current && priv->current->prev;
201 }

+ Here is the caller graph for this function:

gboolean ev_history_can_go_forward ( EvHistory history)

Definition at line 222 of file ev-history.c.

223 {
224  EvHistoryPrivate *priv;
225 
226  g_return_val_if_fail (EV_IS_HISTORY (history), FALSE);
227 
228  if (ev_history_is_frozen (history))
229  return FALSE;
230 
231  priv = history->priv;
232  return priv->current && priv->current->next;
233 }

+ Here is the caller graph for this function:

void ev_history_freeze ( EvHistory history)

Definition at line 340 of file ev-history.c.

341 {
342  g_return_if_fail (EV_IS_HISTORY (history));
343 
344  history->priv->frozen++;
345 }

+ Here is the caller graph for this function:

GList* ev_history_get_back_list ( EvHistory history)

ev_history_get_back_list: : a EvHistory

Returns: (transfer container): the back history

Definition at line 306 of file ev-history.c.

307 {
308  EvHistoryPrivate *priv;
309  GList *list, *l;
310 
311  g_return_val_if_fail (EV_IS_HISTORY (history), NULL);
312 
313  priv = history->priv;
314 
315  if (priv->current == NULL)
316  return NULL;
317 
318  list = NULL;
319  for (l = priv->current->prev; l != NULL; l = l->prev)
320  list = g_list_prepend (list, l->data);
321 
322  return g_list_reverse (list);
323 }

+ Here is the caller graph for this function:

GList* ev_history_get_forward_list ( EvHistory history)

ev_history_get_forward_list: : a EvHistory

Returns: (transfer container): the forward history

Definition at line 332 of file ev-history.c.

333 {
334  g_return_val_if_fail (EV_IS_HISTORY (history), NULL);
335 
336  return g_list_copy (history->priv->current->next);
337 }

+ Here is the caller graph for this function:

GType ev_history_get_type ( void  )
void ev_history_go_back ( EvHistory history)

Definition at line 204 of file ev-history.c.

205 {
206  EvHistoryPrivate *priv;
207 
208  g_return_if_fail (EV_IS_HISTORY (history));
209 
210  if (!ev_history_can_go_back (history))
211  return;
212 
213  priv = history->priv;
214 
215  /* Move current back one step */
216  priv->current = priv->current->prev;
217 
219 }

+ Here is the caller graph for this function:

void ev_history_go_forward ( EvHistory history)

Definition at line 236 of file ev-history.c.

237 {
238  EvHistoryPrivate *priv;
239 
240  g_return_if_fail (EV_IS_HISTORY (history));
241 
242  if (!ev_history_can_go_forward (history))
243  return;
244 
245  priv = history->priv;
246 
247  /* Move current forward one step */
248  priv->current = priv->current->next;
249 
251 }

+ Here is the caller graph for this function:

gboolean ev_history_go_to_link ( EvHistory history,
EvLink link 
)

Definition at line 273 of file ev-history.c.

275 {
276  EvHistoryPrivate *priv;
277  GList *l;
278 
279  g_return_val_if_fail (EV_IS_HISTORY (history), FALSE);
280  g_return_val_if_fail (EV_IS_LINK (link), FALSE);
281 
282  if (ev_history_is_frozen (history))
283  return FALSE;
284 
285  priv = history->priv;
286 
287  l = g_list_find_custom (priv->list, link, (GCompareFunc) compare_link);
288  if (l == NULL)
289  return FALSE;
290 
291  /* Set the link as current */
292  priv->current = l;
293 
295 
296  return TRUE;
297 }

+ Here is the caller graph for this function:

gboolean ev_history_is_frozen ( EvHistory history)

Definition at line 141 of file ev-history.c.

142 {
143  return history->priv->frozen > 0;
144 }

+ Here is the caller graph for this function:

EvHistory* ev_history_new ( EvDocumentModel model)

Definition at line 495 of file ev-history.c.

496 {
497  EvHistory *history;
498 
499  g_return_val_if_fail (EV_IS_DOCUMENT_MODEL (model), NULL);
500 
501  history = EV_HISTORY (g_object_new (EV_TYPE_HISTORY, NULL));
502  ev_history_set_model (history, model);
503 
504  return history;
505 }

+ Here is the caller graph for this function:

void ev_history_thaw ( EvHistory history)

Definition at line 348 of file ev-history.c.

349 {
350  g_return_if_fail (EV_IS_HISTORY (history));
351  g_return_if_fail (history->priv->frozen > 0);
352 
353  history->priv->frozen--;
354 }

+ Here is the caller graph for this function: