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-sidebar-links.c File Reference
#include <string.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "ev-document-links.h"
#include "ev-job-scheduler.h"
#include "ev-sidebar-links.h"
#include "ev-sidebar-page.h"
#include "ev-window.h"
+ Include dependency graph for ev-sidebar-links.c:

Go to the source code of this file.

Data Structures

struct  _EvSidebarLinksPrivate
 
struct  EvSidebarLinkPageSearch
 

Macros

#define EV_SIDEBAR_LINKS_GET_PRIVATE(object)   (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_SIDEBAR_LINKS, EvSidebarLinksPrivate))
 

Typedefs

typedef struct
EvSidebarLinkPageSearch 
EvSidebarLinkPageSearch
 

Enumerations

enum  { PROP_0, PROP_MODEL, PROP_WIDGET }
 
enum  { LINK_ACTIVATED, N_SIGNALS }
 

Functions

static void update_page_callback (EvSidebarLinks *sidebar_links, gint old_page, gint current_page)
 
static void row_activated_callback (GtkTreeView *treeview, GtkTreePath *arg1, GtkTreeViewColumn *arg2, gpointer user_data)
 
static void ev_sidebar_links_set_links_model (EvSidebarLinks *links, GtkTreeModel *model)
 
static void job_finished_callback (EvJobLinks *job, EvSidebarLinks *sidebar_links)
 
static void ev_sidebar_links_set_current_page (EvSidebarLinks *sidebar_links, gint current_page)
 
static void ev_sidebar_links_page_iface_init (EvSidebarPageInterface *iface)
 
static gboolean ev_sidebar_links_support_document (EvSidebarPage *sidebar_page, EvDocument *document)
 
static const gchar * ev_sidebar_links_get_label (EvSidebarPage *sidebar_page)
 
 G_DEFINE_TYPE_EXTENDED (EvSidebarLinks, ev_sidebar_links, GTK_TYPE_BOX, 0, G_IMPLEMENT_INTERFACE(EV_TYPE_SIDEBAR_PAGE, ev_sidebar_links_page_iface_init))
 
static void ev_sidebar_links_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
 
static void ev_sidebar_links_dispose (GObject *object)
 
static void ev_sidebar_links_map (GtkWidget *widget)
 
static void ev_sidebar_links_class_init (EvSidebarLinksClass *ev_sidebar_links_class)
 
static void selection_changed_callback (GtkTreeSelection *selection, EvSidebarLinks *ev_sidebar_links)
 
static GtkTreeModel * create_loading_model (void)
 
static void print_section_cb (GtkWidget *menuitem, EvSidebarLinks *sidebar)
 
static GtkMenu * build_popup_menu (EvSidebarLinks *sidebar)
 
static void popup_menu_cb (GtkWidget *treeview, EvSidebarLinks *sidebar)
 
static gboolean button_press_cb (GtkWidget *treeview, GdkEventButton *event, EvSidebarLinks *sidebar)
 
static void ev_sidebar_links_construct (EvSidebarLinks *ev_sidebar_links)
 
static void ev_sidebar_links_init (EvSidebarLinks *ev_sidebar_links)
 
GtkWidget * ev_sidebar_links_new (void)
 
static gint page_link_tree_search_best_page (gpointer page_ptr, EvSidebarLinkPageSearch *data)
 
static void expand_open_links (GtkTreeView *tree_view, GtkTreeModel *model, GtkTreeIter *parent)
 
static gint page_link_tree_sort (gconstpointer a, gconstpointer b, void *data)
 
static gboolean update_page_link_tree_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data)
 
static void ev_sidebar_links_document_changed_cb (EvDocumentModel *model, GParamSpec *pspec, EvSidebarLinks *sidebar_links)
 
static void ev_sidebar_links_set_model (EvSidebarPage *sidebar_page, EvDocumentModel *model)
 

Variables

static guint signals [N_SIGNALS]
 

Macro Definition Documentation

#define EV_SIDEBAR_LINKS_GET_PRIVATE (   object)    (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_SIDEBAR_LINKS, EvSidebarLinksPrivate))

Typedef Documentation

Enumeration Type Documentation

anonymous enum
Enumerator
PROP_0 
PROP_MODEL 
PROP_WIDGET 

Definition at line 54 of file ev-sidebar-links.c.

54  {
55  PROP_0,
56  PROP_MODEL,
58 };
anonymous enum
Enumerator
LINK_ACTIVATED 
N_SIGNALS 

Definition at line 60 of file ev-sidebar-links.c.

60  {
62  N_SIGNALS
63 };

Function Documentation

static GtkMenu* build_popup_menu ( EvSidebarLinks sidebar)
static

Definition at line 337 of file ev-sidebar-links.c.

338 {
339  GtkWidget *menu;
340  GtkWidget *item;
341 
342  menu = gtk_menu_new ();
343  item = gtk_image_menu_item_new_from_stock (GTK_STOCK_PRINT, NULL);
344  gtk_label_set_label (GTK_LABEL (gtk_bin_get_child (GTK_BIN (item))), _("Print…"));
345  gtk_widget_show (item);
346  gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
347  g_signal_connect (item, "activate",
348  G_CALLBACK (print_section_cb), sidebar);
349 
350  return GTK_MENU (menu);
351 }

+ Here is the caller graph for this function:

static gboolean button_press_cb ( GtkWidget *  treeview,
GdkEventButton *  event,
EvSidebarLinks sidebar 
)
static

Definition at line 366 of file ev-sidebar-links.c.

369 {
370  GtkTreePath *path = NULL;
371 
372  if (event->button == 3) {
373  if (gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (treeview),
374  event->x,
375  event->y,
376  &path,
377  NULL, NULL, NULL)) {
378  gtk_tree_view_set_cursor (GTK_TREE_VIEW (treeview),
379  path, NULL, FALSE);
380  gtk_menu_popup (build_popup_menu (sidebar), NULL,
381  NULL, NULL, NULL, event->button,
382  gtk_get_current_event_time ());
383  gtk_tree_path_free (path);
384 
385  return TRUE;
386  }
387  }
388 
389  return FALSE;
390 }

+ Here is the caller graph for this function:

static GtkTreeModel* create_loading_model ( void  )
static

Definition at line 254 of file ev-sidebar-links.c.

255 {
256  GtkTreeModel *retval;
257  GtkTreeIter iter;
258  gchar *markup;
259 
260  /* Creates a fake model to indicate that we're loading */
261  retval = (GtkTreeModel *)gtk_list_store_new (EV_DOCUMENT_LINKS_COLUMN_NUM_COLUMNS,
262  G_TYPE_STRING,
263  G_TYPE_OBJECT,
264  G_TYPE_BOOLEAN,
265  G_TYPE_STRING);
266 
267  gtk_list_store_append (GTK_LIST_STORE (retval), &iter);
268  markup = g_strdup_printf ("<span size=\"larger\" style=\"italic\">%s</span>", _("Loading…"));
269  gtk_list_store_set (GTK_LIST_STORE (retval), &iter,
273  -1);
274  g_free (markup);
275 
276  return retval;
277 }

+ Here is the caller graph for this function:

static void ev_sidebar_links_class_init ( EvSidebarLinksClass ev_sidebar_links_class)
static

Definition at line 187 of file ev-sidebar-links.c.

188 {
189  GObjectClass *g_object_class;
190  GtkWidgetClass *widget_class;
191 
192  g_object_class = G_OBJECT_CLASS (ev_sidebar_links_class);
193  widget_class = GTK_WIDGET_CLASS (ev_sidebar_links_class);
194 
195  g_object_class->set_property = ev_sidebar_links_set_property;
196  g_object_class->get_property = ev_sidebar_links_get_property;
197  g_object_class->dispose = ev_sidebar_links_dispose;
198 
199  widget_class->map = ev_sidebar_links_map;
200 
201  signals[LINK_ACTIVATED] = g_signal_new ("link-activated",
202  G_TYPE_FROM_CLASS (g_object_class),
203  G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
204  G_STRUCT_OFFSET (EvSidebarLinksClass, link_activated),
205  NULL, NULL,
206  g_cclosure_marshal_VOID__OBJECT,
207  G_TYPE_NONE, 1, G_TYPE_OBJECT);
208 
209  g_object_class_install_property (g_object_class,
210  PROP_MODEL,
211  g_param_spec_object ("model",
212  "Model",
213  "Current Model",
214  GTK_TYPE_TREE_MODEL,
215  G_PARAM_READWRITE |
216  G_PARAM_STATIC_STRINGS));
217  g_object_class_override_property (g_object_class,
218  PROP_WIDGET,
219  "main-widget");
220 
221  g_type_class_add_private (g_object_class, sizeof (EvSidebarLinksPrivate));
222 }
static void ev_sidebar_links_construct ( EvSidebarLinks ev_sidebar_links)
static

Definition at line 394 of file ev-sidebar-links.c.

395 {
396  EvSidebarLinksPrivate *priv;
397  GtkWidget *swindow;
398  GtkTreeViewColumn *column;
399  GtkCellRenderer *renderer;
400  GtkTreeSelection *selection;
401  GtkTreeModel *loading_model;
402 
403  priv = ev_sidebar_links->priv;
404 
405  swindow = gtk_scrolled_window_new (NULL, NULL);
406 
407  /* Create tree view */
408  loading_model = create_loading_model ();
409  priv->tree_view = gtk_tree_view_new_with_model (loading_model);
410  g_object_unref (loading_model);
411 
412  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
413  gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);
414  gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->tree_view), FALSE);
415  gtk_container_add (GTK_CONTAINER (swindow), priv->tree_view);
416 
417  gtk_box_pack_start (GTK_BOX (ev_sidebar_links), swindow, TRUE, TRUE, 0);
418  gtk_widget_show_all (GTK_WIDGET (ev_sidebar_links));
419 
420  column = gtk_tree_view_column_new ();
421  gtk_tree_view_column_set_expand (GTK_TREE_VIEW_COLUMN (column), TRUE);
422  gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree_view), column);
423 
424  renderer = gtk_cell_renderer_text_new ();
425  g_object_set (G_OBJECT (renderer),
426  "ellipsize", PANGO_ELLIPSIZE_END,
427  NULL);
428  gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), renderer, TRUE);
429  gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,
431  NULL);
432 
433  column = gtk_tree_view_column_new ();
434  gtk_tree_view_append_column (GTK_TREE_VIEW (priv->tree_view), column);
435 
436  renderer = gtk_cell_renderer_text_new ();
437  g_object_set (G_OBJECT (renderer),
438  "ellipsize", PANGO_ELLIPSIZE_MIDDLE,
439  "width-chars", 6,
440  "style", PANGO_STYLE_ITALIC,
441  "xalign", 1.0,
442  NULL);
443  gtk_tree_view_column_pack_start (GTK_TREE_VIEW_COLUMN (column), renderer, FALSE);
444  gtk_tree_view_column_set_attributes (GTK_TREE_VIEW_COLUMN (column), renderer,
446  NULL);
447 
448  g_signal_connect (priv->tree_view,
449  "button_press_event",
450  G_CALLBACK (button_press_cb),
451  ev_sidebar_links);
452  g_signal_connect (priv->tree_view,
453  "popup_menu",
454  G_CALLBACK (popup_menu_cb),
455  ev_sidebar_links);
456 }

+ Here is the caller graph for this function:

static void ev_sidebar_links_dispose ( GObject *  object)
static

Definition at line 140 of file ev-sidebar-links.c.

141 {
142  EvSidebarLinks *sidebar = EV_SIDEBAR_LINKS (object);
143 
144  if (sidebar->priv->job) {
145  g_signal_handlers_disconnect_by_func (sidebar->priv->job,
146  job_finished_callback, sidebar);
147  ev_job_cancel (sidebar->priv->job);
148  g_object_unref (sidebar->priv->job);
149  sidebar->priv->job = NULL;
150  }
151 
152  if (sidebar->priv->model) {
153  g_object_unref (sidebar->priv->model);
154  sidebar->priv->model = NULL;
155  }
156 
157  if (sidebar->priv->page_link_tree) {
158  g_tree_unref (sidebar->priv->page_link_tree);
159  sidebar->priv->page_link_tree = NULL;
160  }
161 
162  if (sidebar->priv->document) {
163  g_object_unref (sidebar->priv->document);
164  sidebar->priv->document = NULL;
165  sidebar->priv->doc_model = NULL;
166  }
167 
168  G_OBJECT_CLASS (ev_sidebar_links_parent_class)->dispose (object);
169 }

+ Here is the caller graph for this function:

static void ev_sidebar_links_document_changed_cb ( EvDocumentModel model,
GParamSpec *  pspec,
EvSidebarLinks sidebar_links 
)
static

Definition at line 681 of file ev-sidebar-links.c.

684 {
685  EvDocument *document = ev_document_model_get_document (model);
686  EvSidebarLinksPrivate *priv = sidebar_links->priv;
687 
688  if (!EV_IS_DOCUMENT_LINKS (document))
689  return;
690 
692  return;
693 
694  if (priv->document) {
695  gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree_view), NULL);
696  g_object_unref (priv->document);
697  }
698 
699  priv->document = g_object_ref (document);
700 
701  if (priv->job) {
702  g_signal_handlers_disconnect_by_func (priv->job,
704  sidebar_links);
705  g_object_unref (priv->job);
706  }
707 
708  priv->job = ev_job_links_new (document);
709  g_signal_connect (priv->job,
710  "finished",
711  G_CALLBACK (job_finished_callback),
712  sidebar_links);
713  /* The priority doesn't matter for this job */
715 }

+ Here is the caller graph for this function:

static const gchar * ev_sidebar_links_get_label ( EvSidebarPage sidebar_page)
static

Definition at line 742 of file ev-sidebar-links.c.

743 {
744  /* Translators: This is the title for the sidebar pane that
745  * shows the Outline or Table of Contents of the document.
746  * Use a short text, otherwise it can make Evince unusable in
747  * your language. The sidebar cannot be shrinked smaller than
748  * the longest title in there.
749  */
750  return _("Outline");
751 }

+ Here is the caller graph for this function:

static void ev_sidebar_links_get_property ( GObject *  object,
guint  prop_id,
GValue *  value,
GParamSpec *  pspec 
)
static

Definition at line 116 of file ev-sidebar-links.c.

120 {
121  EvSidebarLinks *ev_sidebar_links;
122 
123  ev_sidebar_links = EV_SIDEBAR_LINKS (object);
124 
125  switch (prop_id)
126  {
127  case PROP_MODEL:
128  g_value_set_object (value, ev_sidebar_links->priv->model);
129  break;
130  case PROP_WIDGET:
131  g_value_set_object (value, ev_sidebar_links->priv->tree_view);
132  break;
133  default:
134  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
135  break;
136  }
137 }

+ Here is the caller graph for this function:

static void ev_sidebar_links_init ( EvSidebarLinks ev_sidebar_links)
static

Definition at line 459 of file ev-sidebar-links.c.

460 {
461  ev_sidebar_links->priv = EV_SIDEBAR_LINKS_GET_PRIVATE (ev_sidebar_links);
462 
463  ev_sidebar_links_construct (ev_sidebar_links);
464 }
static void ev_sidebar_links_map ( GtkWidget *  widget)
static

Definition at line 172 of file ev-sidebar-links.c.

173 {
174  EvSidebarLinks *links;
175 
176  links = EV_SIDEBAR_LINKS (widget);
177 
178  GTK_WIDGET_CLASS (ev_sidebar_links_parent_class)->map (widget);
179 
180  if (links->priv->model) {
182  ev_document_model_get_page (links->priv->doc_model));
183  }
184 }

+ Here is the caller graph for this function:

GtkWidget* ev_sidebar_links_new ( void  )

Definition at line 469 of file ev-sidebar-links.c.

470 {
471  GtkWidget *ev_sidebar_links;
472 
473  ev_sidebar_links = g_object_new (EV_TYPE_SIDEBAR_LINKS,
474  "orientation", GTK_ORIENTATION_VERTICAL,
475  NULL);
476 
477  return ev_sidebar_links;
478 }

+ Here is the caller graph for this function:

static void ev_sidebar_links_page_iface_init ( EvSidebarPageInterface iface)
static

Definition at line 754 of file ev-sidebar-links.c.

static void ev_sidebar_links_set_current_page ( EvSidebarLinks sidebar_links,
gint  current_page 
)
static

Definition at line 497 of file ev-sidebar-links.c.

499 {
500  GtkTreeSelection *selection;
501  GtkTreePath *path;
502  EvSidebarLinkPageSearch search_data;
503 
504  /* Widget is not currently visible */
505  if (!gtk_widget_is_visible (GTK_WIDGET (sidebar_links)))
506  return;
507 
508  search_data.page = current_page;
509  search_data.best_existing = G_MININT;
510 
511  path = g_tree_search (sidebar_links->priv->page_link_tree, (GCompareFunc) page_link_tree_search_best_page, &search_data);
512  /* No direct hit, try a lookup on the best match. */
513  if (!path)
514  path = g_tree_lookup (sidebar_links->priv->page_link_tree, GINT_TO_POINTER (search_data.best_existing));
515 
516  /* Still no hit, give up. */
517  if (!path)
518  return;
519 
520  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (sidebar_links->priv->tree_view));
521 
522  g_signal_handler_block (selection, sidebar_links->priv->selection_id);
523  g_signal_handler_block (sidebar_links->priv->tree_view, sidebar_links->priv->row_activated_id);
524 
525  gtk_tree_view_expand_to_path (GTK_TREE_VIEW (sidebar_links->priv->tree_view),
526  path);
527  gtk_tree_view_set_cursor (GTK_TREE_VIEW (sidebar_links->priv->tree_view),
528  path, NULL, FALSE);
529 
530  g_signal_handler_unblock (selection, sidebar_links->priv->selection_id);
531  g_signal_handler_unblock (sidebar_links->priv->tree_view, sidebar_links->priv->row_activated_id);
532 }

+ Here is the caller graph for this function:

static void ev_sidebar_links_set_links_model ( EvSidebarLinks links,
GtkTreeModel *  model 
)
static

Definition at line 616 of file ev-sidebar-links.c.

618 {
619  EvSidebarLinksPrivate *priv = sidebar_links->priv;
620 
621  if (priv->model == model)
622  return;
623 
624  if (priv->model)
625  g_object_unref (priv->model);
626  priv->model = g_object_ref (model);
627 
628  /* Rebuild the binary search tree for finding links on pages. */
629  if (priv->page_link_tree)
630  g_tree_unref (priv->page_link_tree);
631  priv->page_link_tree = g_tree_new_full (page_link_tree_sort, NULL, NULL, (GDestroyNotify) gtk_tree_path_free);
632 
633  gtk_tree_model_foreach (model,
635  sidebar_links);
636 
637  g_object_notify (G_OBJECT (sidebar_links), "model");
638 }

+ Here is the caller graph for this function:

static void ev_sidebar_links_set_model ( EvSidebarPage sidebar_page,
EvDocumentModel model 
)
static

Definition at line 718 of file ev-sidebar-links.c.

720 {
721  EvSidebarLinks *sidebar_links = EV_SIDEBAR_LINKS (sidebar_page);
722  EvSidebarLinksPrivate *priv = sidebar_links->priv;
723 
724  if (priv->doc_model == model)
725  return;
726 
727  priv->doc_model = model;
728  g_signal_connect (model, "notify::document",
730  sidebar_page);
731 }

+ Here is the caller graph for this function:

static gboolean ev_sidebar_links_support_document ( EvSidebarPage sidebar_page,
EvDocument document 
)
static

Definition at line 734 of file ev-sidebar-links.c.

736 {
737  return (EV_IS_DOCUMENT_LINKS (document) &&
739 }

+ Here is the caller graph for this function:

static void expand_open_links ( GtkTreeView *  tree_view,
GtkTreeModel *  model,
GtkTreeIter *  parent 
)
static

Definition at line 556 of file ev-sidebar-links.c.

557 {
558  GtkTreeIter iter;
559  gboolean expand;
560 
561  if (gtk_tree_model_iter_children (model, &iter, parent)) {
562  do {
563  gtk_tree_model_get (model, &iter,
565  -1);
566  if (expand) {
567  GtkTreePath *path;
568 
569  path = gtk_tree_model_get_path (model, &iter);
570  gtk_tree_view_expand_row (tree_view, path, FALSE);
571  gtk_tree_path_free (path);
572  }
573 
574  expand_open_links (tree_view, model, &iter);
575  } while (gtk_tree_model_iter_next (model, &iter));
576  }
577 }

+ Here is the caller graph for this function:

G_DEFINE_TYPE_EXTENDED ( EvSidebarLinks  ,
ev_sidebar_links  ,
GTK_TYPE_BOX  ,
,
G_IMPLEMENT_INTERFACE(EV_TYPE_SIDEBAR_PAGE,ev_sidebar_links_page_iface_init  
)

Definition at line 85 of file ev-sidebar-links.c.

101 {
102  EvSidebarLinks *ev_sidebar_links = EV_SIDEBAR_LINKS (object);
103 
104  switch (prop_id)
105  {
106  case PROP_MODEL:
107  ev_sidebar_links_set_links_model (ev_sidebar_links, g_value_get_object (value));
108  break;
109  default:
110  G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
111  break;
112  }
113 }
static void job_finished_callback ( EvJobLinks job,
EvSidebarLinks sidebar_links 
)
static

Definition at line 641 of file ev-sidebar-links.c.

643 {
644  EvSidebarLinksPrivate *priv = sidebar_links->priv;
645  GtkTreeSelection *selection;
646 
647  ev_sidebar_links_set_links_model (sidebar_links, job->model);
648 
649  gtk_tree_view_set_model (GTK_TREE_VIEW (priv->tree_view), job->model);
650 
651  g_object_unref (job);
652  priv->job = NULL;
653 
654  expand_open_links (GTK_TREE_VIEW (priv->tree_view), priv->model, NULL);
655 
656  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->tree_view));
657  gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
658 
659  if (priv->selection_id <= 0) {
660  priv->selection_id =
661  g_signal_connect (selection, "changed",
662  G_CALLBACK (selection_changed_callback),
663  sidebar_links);
664  }
665  priv->page_changed_id =
666  g_signal_connect_swapped (priv->doc_model, "page-changed",
667  G_CALLBACK (update_page_callback),
668  sidebar_links);
669  if (priv->row_activated_id <= 0) {
670  priv->row_activated_id =
671  g_signal_connect (priv->tree_view, "row-activated",
672  G_CALLBACK (row_activated_callback),
673  sidebar_links);
674  }
675 
676  ev_sidebar_links_set_current_page (sidebar_links,
678 }

+ Here is the caller graph for this function:

static gint page_link_tree_search_best_page ( gpointer  page_ptr,
EvSidebarLinkPageSearch data 
)
static

Definition at line 486 of file ev-sidebar-links.c.

487 {
488  gint page = GPOINTER_TO_INT (page_ptr);
489 
490  if (page <= data->page && page > data->best_existing)
491  data->best_existing = page;
492 
493  return data->page - page;
494 }

+ Here is the caller graph for this function:

static gint page_link_tree_sort ( gconstpointer  a,
gconstpointer  b,
void *  data 
)
static

Definition at line 581 of file ev-sidebar-links.c.

582 {
583  return GPOINTER_TO_INT (a) - GPOINTER_TO_INT (b);
584 }

+ Here is the caller graph for this function:

static void popup_menu_cb ( GtkWidget *  treeview,
EvSidebarLinks sidebar 
)
static

Definition at line 354 of file ev-sidebar-links.c.

355 {
356  GtkMenu *menu = build_popup_menu (sidebar);
357 
358  gtk_menu_popup (menu, NULL, NULL,
360  sidebar->priv->tree_view, 0,
361  gtk_get_current_event_time ());
362  gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE);
363 }

+ Here is the caller graph for this function:

static void print_section_cb ( GtkWidget *  menuitem,
EvSidebarLinks sidebar 
)
static

Definition at line 280 of file ev-sidebar-links.c.

281 {
282  GtkWidget *window;
283  GtkTreeSelection *selection;
284  GtkTreeModel *model;
285  GtkTreeIter iter;
286 
287  selection = gtk_tree_view_get_selection
288  (GTK_TREE_VIEW (sidebar->priv->tree_view));
289 
290  if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
291  EvLink *link;
292  int first_page, last_page = -1;
293  EvDocumentLinks *document_links;
294 
295  gtk_tree_model_get (model, &iter,
297  -1);
298 
299  if (!link)
300  return;
301 
302  document_links = EV_DOCUMENT_LINKS (sidebar->priv->document);
303 
304  first_page = ev_document_links_get_link_page (document_links, link);
305  if (first_page == -1) {
306  g_object_unref (link);
307  return;
308  }
309 
310  first_page++;
311  g_object_unref (link);
312 
313  if (gtk_tree_model_iter_next (model, &iter)) {
314  gtk_tree_model_get (model, &iter,
316  -1);
317 
318  if (link) {
319  last_page = ev_document_links_get_link_page (document_links, link);;
320  g_object_unref (link);
321  }
322  } else {
323  last_page = ev_document_get_n_pages (sidebar->priv->document);
324  }
325 
326  if (last_page == -1)
327  last_page = ev_document_get_n_pages (sidebar->priv->document);
328 
329  window = gtk_widget_get_toplevel (GTK_WIDGET (sidebar));
330  if (EV_IS_WINDOW (window)) {
331  ev_window_print_range (EV_WINDOW (window), first_page, last_page);
332  }
333  }
334 }

+ Here is the caller graph for this function:

static void row_activated_callback ( GtkTreeView *  treeview,
GtkTreePath *  arg1,
GtkTreeViewColumn *  arg2,
gpointer  user_data 
)
static

Definition at line 543 of file ev-sidebar-links.c.

547 {
548  if (gtk_tree_view_row_expanded (GTK_TREE_VIEW (treeview), arg1)) {
549  gtk_tree_view_collapse_row (GTK_TREE_VIEW (treeview), arg1);
550  } else {
551  gtk_tree_view_expand_row (GTK_TREE_VIEW (treeview), arg1, FALSE);
552  }
553 }

+ Here is the caller graph for this function:

static void selection_changed_callback ( GtkTreeSelection *  selection,
EvSidebarLinks ev_sidebar_links 
)
static

Definition at line 225 of file ev-sidebar-links.c.

227 {
228  GtkTreeModel *model;
229  GtkTreeIter iter;
230 
231  g_return_if_fail (ev_sidebar_links->priv->document != NULL);
232 
233  if (gtk_tree_selection_get_selected (selection, &model, &iter)) {
234  EvLink *link;
235 
236  gtk_tree_model_get (model, &iter,
238  -1);
239 
240  if (link == NULL)
241  return;
242 
243  g_signal_handler_block (ev_sidebar_links->priv->doc_model,
244  ev_sidebar_links->priv->page_changed_id);
245  g_signal_emit (ev_sidebar_links, signals[LINK_ACTIVATED], 0, link);
246  g_signal_handler_unblock (ev_sidebar_links->priv->doc_model,
247  ev_sidebar_links->priv->page_changed_id);
248 
249  g_object_unref (link);
250  }
251 }

+ Here is the caller graph for this function:

static void update_page_callback ( EvSidebarLinks sidebar_links,
gint  old_page,
gint  current_page 
)
static

Definition at line 535 of file ev-sidebar-links.c.

538 {
539  ev_sidebar_links_set_current_page (sidebar_links, new_page);
540 }

+ Here is the caller graph for this function:

static gboolean update_page_link_tree_foreach ( GtkTreeModel *  model,
GtkTreePath *  path,
GtkTreeIter *  iter,
gpointer  data 
)
static

Definition at line 587 of file ev-sidebar-links.c.

591 {
592  EvSidebarLinks *sidebar_links = data;
593  EvSidebarLinksPrivate *priv = sidebar_links->priv;
594  EvDocumentLinks *document_links = EV_DOCUMENT_LINKS (priv->document);
595  EvLink *link;
596  int page;
597 
598  gtk_tree_model_get (model, iter,
600  -1);
601 
602  if (!link)
603  return FALSE;
604 
605  page = ev_document_links_get_link_page (document_links, link);
606  g_object_unref (link);
607 
608  /* Only save the first link we find per page. */
609  if (!g_tree_lookup (priv->page_link_tree, GINT_TO_POINTER (page)))
610  g_tree_insert (priv->page_link_tree, GINT_TO_POINTER (page), gtk_tree_path_copy (path));
611 
612  return FALSE;
613 }

+ Here is the caller graph for this function:

Variable Documentation

guint signals[N_SIGNALS]
static

Definition at line 83 of file ev-sidebar-links.c.