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-annotations-toolbar.c File Reference
#include "config.h"
#include "ev-annotations-toolbar.h"
#include <evince-document.h>
#include <glib/gi18n.h>
+ Include dependency graph for ev-annotations-toolbar.c:

Go to the source code of this file.

Data Structures

struct  _EvAnnotationsToolbar
 
struct  _EvAnnotationsToolbarClass
 

Enumerations

enum  { BEGIN_ADD_ANNOT, CANCEL_ADD_ANNOT, N_SIGNALS }
 

Functions

static void ev_annotations_toolbar_annot_button_toggled (GtkWidget *button, EvAnnotationsToolbar *toolbar)
 
static gboolean ev_annotations_toolbar_toggle_button_if_active (EvAnnotationsToolbar *toolbar, GtkToggleToolButton *button)
 
static GtkWidget * ev_annotations_toolbar_create_toggle_button (EvAnnotationsToolbar *toolbar, const gchar *icon_name, const gchar *tooltip)
 
static void ev_annotations_toolbar_init (EvAnnotationsToolbar *toolbar)
 
static void ev_annotations_toolbar_class_init (EvAnnotationsToolbarClass *klass)
 
GtkWidget * ev_annotations_toolbar_new (void)
 
void ev_annotations_toolbar_add_annot_finished (EvAnnotationsToolbar *toolbar)
 

Variables

static guint signals [N_SIGNALS]
 

Enumeration Type Documentation

anonymous enum
Enumerator
BEGIN_ADD_ANNOT 
CANCEL_ADD_ANNOT 
N_SIGNALS 

Definition at line 27 of file ev-annotations-toolbar.c.

27  {
30  N_SIGNALS
31 };

Function Documentation

void ev_annotations_toolbar_add_annot_finished ( EvAnnotationsToolbar toolbar)

Definition at line 165 of file ev-annotations-toolbar.c.

166 {
167  g_return_if_fail (EV_IS_ANNOTATIONS_TOOLBAR (toolbar));
168 
169  if (ev_annotations_toolbar_toggle_button_if_active (toolbar, GTK_TOGGLE_TOOL_BUTTON (toolbar->text_button)))
170  return;
171 
172  ev_annotations_toolbar_toggle_button_if_active (toolbar, GTK_TOGGLE_TOOL_BUTTON (toolbar->highlight_button));
173 }

+ Here is the caller graph for this function:

static void ev_annotations_toolbar_annot_button_toggled ( GtkWidget *  button,
EvAnnotationsToolbar toolbar 
)
static

Definition at line 50 of file ev-annotations-toolbar.c.

52 {
53  EvAnnotationType annot_type;
54 
55  if (!gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (button))) {
56  g_signal_emit (toolbar, signals[CANCEL_ADD_ANNOT], 0, NULL);
57  return;
58  }
59 
60  if (button == toolbar->text_button) {
61  annot_type = EV_ANNOTATION_TYPE_TEXT;
62  gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (toolbar->highlight_button), FALSE);
63  } else if (button == toolbar->highlight_button) {
64  annot_type = EV_ANNOTATION_TYPE_TEXT_MARKUP;
65  gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (toolbar->text_button), FALSE);
66  } else {
67  g_assert_not_reached ();
68  }
69 
70  g_signal_emit (toolbar, signals[BEGIN_ADD_ANNOT], 0, annot_type);
71 }

+ Here is the caller graph for this function:

static void ev_annotations_toolbar_class_init ( EvAnnotationsToolbarClass klass)
static

Definition at line 133 of file ev-annotations-toolbar.c.

134 {
135  GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
136 
138  g_signal_new ("begin-add-annot",
139  G_TYPE_FROM_CLASS (g_object_class),
140  G_SIGNAL_RUN_LAST,
141  0,
142  NULL, NULL,
143  g_cclosure_marshal_VOID__ENUM,
144  G_TYPE_NONE, 1,
145  EV_TYPE_ANNOTATION_TYPE);
146 
148  g_signal_new ("cancel-add-annot",
149  G_TYPE_FROM_CLASS (g_object_class),
150  G_SIGNAL_RUN_LAST,
151  0,
152  NULL, NULL,
153  g_cclosure_marshal_VOID__VOID,
154  G_TYPE_NONE, 0,
155  G_TYPE_NONE);
156 }
static GtkWidget* ev_annotations_toolbar_create_toggle_button ( EvAnnotationsToolbar toolbar,
const gchar *  icon_name,
const gchar *  tooltip 
)
static

Definition at line 92 of file ev-annotations-toolbar.c.

95 {
96  GtkWidget *button = GTK_WIDGET (gtk_toggle_tool_button_new ());
97 
98  gtk_widget_set_tooltip_text (button, tooltip);
99  gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (button), icon_name);
100  /* For some reason adding text-button class to the GtkToogleButton makes the button smaller */
101  gtk_style_context_add_class (gtk_widget_get_style_context (gtk_bin_get_child (GTK_BIN (button))), "text-button");
102  g_signal_connect (button, "toggled",
104  toolbar);
105 
106  return button;
107 }

+ Here is the caller graph for this function:

static void ev_annotations_toolbar_init ( EvAnnotationsToolbar toolbar)
static

Definition at line 110 of file ev-annotations-toolbar.c.

111 {
112  gtk_orientable_set_orientation (GTK_ORIENTABLE (toolbar), GTK_ORIENTATION_HORIZONTAL);
113 
114  gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
115  gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (toolbar)),
116  GTK_STYLE_CLASS_INLINE_TOOLBAR);
117 
119  "document-new-symbolic",
120  _("Add text annotation"));
121  gtk_container_add (GTK_CONTAINER(toolbar), toolbar->text_button);
122  gtk_widget_show (toolbar->text_button);
123 
124  /* FIXME: use a better icon than select-all */
126  "edit-select-all-symbolic",
127  _("Add highlight annotation"));
128  gtk_container_add (GTK_CONTAINER (toolbar), toolbar->highlight_button);
129  gtk_widget_show (toolbar->highlight_button);
130 }
GtkWidget* ev_annotations_toolbar_new ( void  )

Definition at line 159 of file ev-annotations-toolbar.c.

160 {
161  return GTK_WIDGET (g_object_new (EV_TYPE_ANNOTATIONS_TOOLBAR, NULL));
162 }

+ Here is the caller graph for this function:

static gboolean ev_annotations_toolbar_toggle_button_if_active ( EvAnnotationsToolbar toolbar,
GtkToggleToolButton *  button 
)
static

Definition at line 74 of file ev-annotations-toolbar.c.

76 {
77  if (!gtk_toggle_tool_button_get_active (button))
78  return FALSE;
79 
80  g_signal_handlers_block_by_func (button,
82  toolbar);
83  gtk_toggle_tool_button_set_active (button, FALSE);
84  g_signal_handlers_unblock_by_func (button,
86  toolbar);
87 
88  return TRUE;
89 }

+ Here is the caller graph for this function:

Variable Documentation

guint signals[N_SIGNALS]
static

Definition at line 45 of file ev-annotations-toolbar.c.