26 #include <glib/gi18n.h>
72 ev_toolbar->
priv->
window = g_value_get_object (value);
75 G_OBJECT_WARN_INVALID_PROPERTY_ID (
object, prop_id, pspec);
82 const gchar *action_name,
85 gtk_actionable_set_action_name (GTK_ACTIONABLE (button), action_name);
86 gtk_button_set_label (button, NULL);
87 gtk_button_set_focus_on_click (button,
FALSE);
88 gtk_widget_set_tooltip_text (GTK_WIDGET (button), tooltip);
93 const gchar *action_name,
94 const gchar *icon_name,
97 GtkWidget *button = gtk_button_new ();
100 image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
102 gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
103 gtk_button_set_image (GTK_BUTTON (button), image);
111 const gchar *action_name,
112 const gchar *icon_name,
113 const gchar *tooltip)
115 GtkWidget *button = gtk_toggle_button_new ();
118 image = gtk_image_new_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
120 gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
121 gtk_button_set_image (GTK_BUTTON (button), image);
129 const gchar *icon_name,
136 button = gtk_menu_button_new ();
137 gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
138 gtk_button_set_image (GTK_BUTTON (button), gtk_image_new ());
139 gtk_image_set_from_icon_name (GTK_IMAGE (gtk_button_get_image (GTK_BUTTON (button))),
140 icon_name, GTK_ICON_SIZE_MENU);
141 gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (button), menu);
142 popup = gtk_menu_button_get_popover (GTK_MENU_BUTTON (button));
143 gtk_popover_set_position (popup, GTK_POS_BOTTOM);
144 gtk_widget_set_halign (GTK_WIDGET (popup), menu_align);
151 GMenuModel *bookmarks_submenu_model)
159 if (g_menu_model_get_n_items (bookmarks_submenu_model) > 0) {
160 if (g_menu_model_get_n_items (G_MENU_MODEL (bookmarks_section)) == 1)
161 g_menu_append_submenu (bookmarks_section,
_(
"Bookmarks"), bookmarks_submenu_model);
163 if (g_menu_model_get_n_items (G_MENU_MODEL (bookmarks_section)) == 2)
164 g_menu_remove (bookmarks_section, 1);
190 GtkWidget *tool_item;
191 GtkWidget *hbox, *vbox;
194 GMenuModel *bookmarks_submenu_model;
196 G_OBJECT_CLASS (ev_toolbar_parent_class)->constructed (
object);
198 builder = gtk_builder_new_from_resource (
"/org/gnome/evince/gtk/menus.ui");
201 "document-open-symbolic",
202 _(
"Open an existing document"));
204 gtk_container_add (GTK_CONTAINER (ev_toolbar), button);
205 gtk_widget_set_margin_end (button, 6);
210 gtk_widget_set_tooltip_text (tool_item,
_(
"Select page or search in the index"));
211 atk_object_set_name (gtk_widget_get_accessible (tool_item),
_(
"Select page"));
215 gtk_widget_set_margin_end (tool_item, 6);
216 gtk_header_bar_pack_start (GTK_HEADER_BAR (ev_toolbar), tool_item);
221 gtk_widget_set_margin_end (hbox, 6);
222 gtk_header_bar_pack_start (GTK_HEADER_BAR (ev_toolbar), hbox);
226 _(
"Find a word or phrase in the document"));
228 gtk_widget_set_margin_end (button, 6);
229 gtk_header_bar_pack_start (GTK_HEADER_BAR (ev_toolbar), button);
234 _(
"Annotate the document"));
236 gtk_widget_set_margin_end (button, 6);
237 gtk_header_bar_pack_start (GTK_HEADER_BAR (ev_toolbar), button);
240 menu = G_MENU_MODEL (gtk_builder_get_object (builder,
"action-menu"));
242 menu, GTK_ALIGN_END);
243 gtk_widget_set_tooltip_text (button,
_(
"File options"));
244 atk_object_set_name (gtk_widget_get_accessible (button),
_(
"File options"));
247 gtk_header_bar_pack_end (GTK_HEADER_BAR (ev_toolbar), button);
250 menu = G_MENU_MODEL (gtk_builder_get_object (builder,
"view-menu"));
252 menu, GTK_ALIGN_END);
253 gtk_widget_set_tooltip_text (button,
_(
"View options"));
254 atk_object_set_name (gtk_widget_get_accessible (button),
_(
"View options"));
256 gtk_header_bar_pack_end (GTK_HEADER_BAR (ev_toolbar), button);
260 G_MENU (gtk_builder_get_object (builder,
"zoom-menu")));
262 gtk_widget_set_tooltip_text (vbox,
_(
"Select or set the zoom level of the document"));
263 atk_object_set_name (gtk_widget_get_accessible (vbox),
_(
"Set zoom level"));
264 g_signal_connect (vbox,
"activated",
267 gtk_widget_set_margin_end (vbox, 6);
268 gtk_header_bar_pack_end (GTK_HEADER_BAR (ev_toolbar), vbox);
272 g_signal_connect (bookmarks_submenu_model,
"items-changed",
277 g_object_unref (builder);
283 GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
288 g_object_class_install_property (g_object_class,
290 g_param_spec_object (
"window",
295 G_PARAM_CONSTRUCT_ONLY |
296 G_PARAM_STATIC_STRINGS));
326 priv = ev_toolbar->
priv;
328 popover = gtk_menu_button_get_popover (GTK_MENU_BUTTON (priv->
view_menu_button));
329 if (gtk_widget_get_visible (GTK_WIDGET (popover)))
333 if (gtk_widget_get_visible (GTK_WIDGET (popover)))
370 priv = ev_toolbar->
priv;