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.h File Reference
#include <gtk/gtk.h>
#include "ev-document-model.h"
+ Include dependency graph for ev-sidebar.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _EvSidebar
 
struct  _EvSidebarClass
 

Macros

#define EV_TYPE_SIDEBAR   (ev_sidebar_get_type())
 
#define EV_SIDEBAR(object)   (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_SIDEBAR, EvSidebar))
 
#define EV_SIDEBAR_CLASS(klass)   (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_SIDEBAR, EvSidebarClass))
 
#define EV_IS_SIDEBAR(object)   (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_SIDEBAR))
 
#define EV_IS_SIDEBAR_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_SIDEBAR))
 
#define EV_SIDEBAR_GET_CLASS(object)   (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_SIDEBAR, EvSidebarClass))
 

Typedefs

typedef typedefG_BEGIN_DECLS
struct _EvSidebar 
EvSidebar
 
typedef struct _EvSidebarClass EvSidebarClass
 
typedef struct _EvSidebarPrivate EvSidebarPrivate
 

Functions

GType ev_sidebar_get_type (void) G_GNUC_CONST
 
GtkWidget * ev_sidebar_new (void)
 
void ev_sidebar_add_page (EvSidebar *ev_sidebar, GtkWidget *main_widget)
 
void ev_sidebar_set_page (EvSidebar *ev_sidebar, GtkWidget *main_widget)
 
void ev_sidebar_set_model (EvSidebar *sidebar, EvDocumentModel *model)
 

Macro Definition Documentation

#define EV_IS_SIDEBAR (   object)    (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_SIDEBAR))

Definition at line 40 of file ev-sidebar.h.

#define EV_IS_SIDEBAR_CLASS (   klass)    (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_SIDEBAR))

Definition at line 41 of file ev-sidebar.h.

#define EV_SIDEBAR (   object)    (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_SIDEBAR, EvSidebar))

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

#define EV_SIDEBAR_CLASS (   klass)    (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_SIDEBAR, EvSidebarClass))

Definition at line 39 of file ev-sidebar.h.

#define EV_SIDEBAR_GET_CLASS (   object)    (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_SIDEBAR, EvSidebarClass))

Definition at line 42 of file ev-sidebar.h.

#define EV_TYPE_SIDEBAR   (ev_sidebar_get_type())

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

Typedef Documentation

typedef typedefG_BEGIN_DECLS struct _EvSidebar EvSidebar

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

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

Definition at line 35 of file ev-sidebar.h.

Function Documentation

void ev_sidebar_add_page ( EvSidebar ev_sidebar,
GtkWidget *  main_widget 
)

Definition at line 432 of file ev-sidebar.c.

434 {
435  GtkTreeIter iter;
436  GtkWidget *menu_item;
437  gchar *label_title;
438  const gchar *title;
439  int index;
440 
441  g_return_if_fail (EV_IS_SIDEBAR (ev_sidebar));
442  g_return_if_fail (EV_IS_SIDEBAR_PAGE (main_widget));
443  g_return_if_fail (GTK_IS_WIDGET (main_widget));
444 
446  ev_sidebar->priv->model);
447  title = ev_sidebar_page_get_label (EV_SIDEBAR_PAGE (main_widget));
448 
449  index = gtk_notebook_append_page (GTK_NOTEBOOK (ev_sidebar->priv->notebook),
450  main_widget, NULL);
451 
452  menu_item = gtk_image_menu_item_new_with_label (title);
453  g_signal_connect (menu_item, "activate",
455  ev_sidebar);
456  gtk_widget_show (menu_item);
457  gtk_menu_shell_append (GTK_MENU_SHELL (ev_sidebar->priv->menu),
458  menu_item);
459 
460  /* Insert and move to end */
461  gtk_list_store_insert_with_values (GTK_LIST_STORE (ev_sidebar->priv->page_model),
462  &iter, 0,
463  PAGE_COLUMN_TITLE, title,
464  PAGE_COLUMN_MENU_ITEM, menu_item,
465  PAGE_COLUMN_MAIN_WIDGET, main_widget,
467  -1);
468  gtk_list_store_move_before(GTK_LIST_STORE(ev_sidebar->priv->page_model),
469  &iter, NULL);
470 
471 
472  /* Set the first item added as active */
473  gtk_tree_model_get_iter_first (ev_sidebar->priv->page_model, &iter);
474  gtk_tree_model_get (ev_sidebar->priv->page_model,
475  &iter,
476  PAGE_COLUMN_TITLE, &label_title,
478  -1);
479 
480  gtk_menu_set_active (GTK_MENU (ev_sidebar->priv->menu), index);
481  gtk_label_set_text (GTK_LABEL (ev_sidebar->priv->label), label_title);
482  gtk_notebook_set_current_page (GTK_NOTEBOOK (ev_sidebar->priv->notebook),
483  index);
484  g_free (label_title);
485 }

+ Here is the caller graph for this function:

GType ev_sidebar_get_type ( void  )
GtkWidget* ev_sidebar_new ( void  )

Definition at line 420 of file ev-sidebar.c.

421 {
422  GtkWidget *ev_sidebar;
423 
424  ev_sidebar = g_object_new (EV_TYPE_SIDEBAR,
425  "orientation", GTK_ORIENTATION_VERTICAL,
426  NULL);
427 
428  return ev_sidebar;
429 }

+ Here is the caller graph for this function:

void ev_sidebar_set_model ( EvSidebar sidebar,
EvDocumentModel model 
)

Definition at line 542 of file ev-sidebar.c.

544 {
545  g_return_if_fail (EV_IS_SIDEBAR (sidebar));
546  g_return_if_fail (EV_IS_DOCUMENT_MODEL (model));
547 
548  if (model == sidebar->priv->model)
549  return;
550 
551  sidebar->priv->model = model;
552  g_signal_connect (model, "notify::document",
553  G_CALLBACK (ev_sidebar_document_changed_cb),
554  sidebar);
555 }

+ Here is the caller graph for this function:

void ev_sidebar_set_page ( EvSidebar ev_sidebar,
GtkWidget *  main_widget 
)

Definition at line 103 of file ev-sidebar.c.

105 {
106  GtkTreeIter iter;
107  gboolean valid;
108 
109  valid = gtk_tree_model_get_iter_first (ev_sidebar->priv->page_model, &iter);
110 
111  while (valid) {
112  GtkWidget *widget;
113 
114  gtk_tree_model_get (ev_sidebar->priv->page_model, &iter,
115  PAGE_COLUMN_MAIN_WIDGET, &widget,
116  -1);
117 
118  if (widget == main_widget) {
119  ev_sidebar_select_page (ev_sidebar, &iter);
120  valid = FALSE;
121  } else {
122  valid = gtk_tree_model_iter_next (ev_sidebar->priv->page_model, &iter);
123  }
124  g_object_unref (widget);
125  }
126 
127  g_object_notify (G_OBJECT (ev_sidebar), "current-page");
128 }

+ Here is the caller graph for this function: