24 #include <glib/gi18n-lib.h>
47 toolbar->priv->plugin->goToPreviousPage();
138 gtk_popover_set_position (GTK_POPOVER (toolbar->
priv->
searchPopover), GTK_POS_BOTTOM);
141 g_signal_connect_swapped(searchBox,
"started", G_CALLBACK(
searchStarted), toolbar);
142 g_signal_connect_swapped(searchBox,
"cleared", G_CALLBACK(
searchCleared), toolbar);
143 g_signal_connect_swapped(searchBox,
"next", G_CALLBACK(
searchNext), toolbar);
144 g_signal_connect_swapped(searchBox,
"previous", G_CALLBACK(
searchPrevious), toolbar);
146 gtk_widget_show(searchBox);
154 const char *searchString = gtk_entry_get_text(GTK_ENTRY(entry));
155 if (searchString && searchString[0])
167 ,
m_closure(reinterpret_cast<gpointer>(closure))
228 G_OBJECT_WARN_INVALID_PROPERTY_ID(
object, propID, paramSpec);
234 GtkWidget *button = gtk_button_new();
236 gtk_widget_set_valign(button, GTK_ALIGN_CENTER);
237 gtk_widget_set_tooltip_text(button, description);
238 gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_MENU));
239 gtk_button_set_label(GTK_BUTTON(button),
nullptr);
240 gtk_button_set_focus_on_click(GTK_BUTTON(button),
FALSE);
241 g_signal_connect_swapped(button,
"clicked", callback, toolbar);
248 GtkWidget *button = gtk_toggle_button_new();
250 gtk_widget_set_valign(button, GTK_ALIGN_CENTER);
251 gtk_widget_set_tooltip_text(button, description);
252 gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_MENU));
253 gtk_button_set_label(GTK_BUTTON(button),
nullptr);
254 gtk_button_set_focus_on_click(GTK_BUTTON(button),
FALSE);
255 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), initialState);
256 g_signal_connect_swapped(button,
"toggled", callback, toolbar);
263 GtkWidget *button = gtk_menu_button_new();
265 gtk_widget_set_valign(button, GTK_ALIGN_CENTER);
266 gtk_button_set_image(GTK_BUTTON(button), gtk_image_new_from_icon_name(iconName, GTK_ICON_SIZE_MENU));
267 gtk_widget_set_halign(menu, menuAlign);
268 gtk_menu_button_set_popup(GTK_MENU_BUTTON(button), menu);
275 GtkWidget *box = gtk_box_new(gtk_orientable_get_orientation(GTK_ORIENTABLE(toolbar)), 0);
277 GtkStyleContext *styleContext = gtk_widget_get_style_context(box);
278 gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_RAISED);
279 gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_LINKED);
286 GtkWidget *menu = gtk_menu_new();
288 GtkWidget *menuItem = gtk_check_menu_item_new_with_mnemonic(
_(
"Fit Pa_ge"));
290 gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(menuItem),
TRUE);
291 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuItem),
293 g_signal_connect_swapped(menuItem,
"toggled", G_CALLBACK(
zoomFitPageToggled), toolbar);
294 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuItem);
295 gtk_widget_show(menuItem);
297 menuItem = gtk_check_menu_item_new_with_mnemonic(
_(
"Fit _Width"));
299 gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(menuItem),
TRUE);
300 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuItem),
303 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuItem);
304 gtk_widget_show(menuItem);
306 menuItem = gtk_check_menu_item_new_with_mnemonic(
_(
"_Automatic"));
308 gtk_check_menu_item_set_draw_as_radio(GTK_CHECK_MENU_ITEM(menuItem),
TRUE);
309 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuItem),
312 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuItem);
313 gtk_widget_show(menuItem);
315 g_signal_connect(toolbar->
priv->
plugin->
model(),
"notify::sizing-mode",
323 G_OBJECT_CLASS(ev_browser_plugin_toolbar_parent_class)->constructed(
object);
326 bool rtl = gtk_widget_get_direction(GTK_WIDGET(toolbar)) == GTK_TEXT_DIR_RTL;
332 gtk_container_add(GTK_CONTAINER(hbox), button);
333 gtk_widget_show(button);
336 gtk_container_add(GTK_CONTAINER(hbox), button);
337 gtk_widget_show(button);
339 GtkWidget *toolItem = GTK_WIDGET(gtk_tool_item_new());
341 gtk_widget_set_margin_left(toolItem, 12);
343 gtk_widget_set_margin_right(toolItem, 12);
344 gtk_container_add(GTK_CONTAINER(toolItem), hbox);
345 gtk_widget_show(hbox);
347 gtk_container_add(GTK_CONTAINER(toolbar), toolItem);
348 gtk_widget_show(toolItem);
353 g_signal_connect_swapped(toolItem,
"activate-link", G_CALLBACK(
activateLink), toolbar);
355 gtk_widget_set_margin_left(toolItem, 12);
357 gtk_widget_set_margin_right(toolItem, 12);
358 gtk_container_add(GTK_CONTAINER(toolbar), toolItem);
359 gtk_widget_show(toolItem);
362 button =
createToggleButton(toolbar,
"edit-find-symbolic",
_(
"Find a word or phrase in the document"),
365 toolItem = GTK_WIDGET(gtk_tool_item_new());
366 gtk_container_add(GTK_CONTAINER(toolItem), button);
367 gtk_widget_show(button);
369 gtk_container_add(GTK_CONTAINER(toolbar), toolItem);
370 gtk_widget_show(toolItem);
373 toolItem = GTK_WIDGET(gtk_tool_item_new());
374 gtk_tool_item_set_expand(GTK_TOOL_ITEM(toolItem),
TRUE);
375 gtk_container_add(GTK_CONTAINER(toolbar), toolItem);
376 gtk_widget_show(toolItem);
381 button =
createToggleButton(toolbar,
"view-continuous-symbolic",
_(
"Show the entire document"),
386 gtk_container_add(GTK_CONTAINER(hbox), button);
387 gtk_widget_show(button);
394 gtk_container_add(GTK_CONTAINER(hbox), button);
395 gtk_widget_show(button);
397 toolItem = GTK_WIDGET(gtk_tool_item_new());
399 gtk_widget_set_margin_left(toolItem, 12);
401 gtk_widget_set_margin_right(toolItem, 12);
402 gtk_container_add(GTK_CONTAINER(toolItem), hbox);
403 gtk_widget_show(hbox);
405 gtk_container_add(GTK_CONTAINER(toolbar), toolItem);
406 gtk_widget_show(toolItem);
411 button =
createButton(toolbar,
"zoom-in-symbolic",
_(
"Enlarge the document"), G_CALLBACK(
zoomIn));
412 gtk_container_add(GTK_CONTAINER(hbox), button);
413 gtk_widget_show(button);
415 button =
createButton(toolbar,
"zoom-out-symbolic",
_(
"Shrink the document"), G_CALLBACK(
zoomOut));
416 gtk_container_add(GTK_CONTAINER(hbox), button);
417 gtk_widget_show(button);
420 gtk_container_add(GTK_CONTAINER(hbox), button);
421 gtk_widget_show(button);
423 toolItem = GTK_WIDGET(gtk_tool_item_new());
425 gtk_widget_set_margin_left(toolItem, 12);
427 gtk_widget_set_margin_right(toolItem, 12);
428 gtk_container_add(GTK_CONTAINER(toolItem), hbox);
429 gtk_widget_show(hbox);
431 gtk_container_add(GTK_CONTAINER(toolbar), toolItem);
432 gtk_widget_show(toolItem);
438 toolItem = GTK_WIDGET(gtk_tool_item_new());
439 gtk_container_add(GTK_CONTAINER(toolItem), button);
440 gtk_widget_show(button);
442 gtk_widget_set_margin_left(toolItem, 6);
444 gtk_widget_set_margin_right(toolItem, 6);
446 gtk_container_add(GTK_CONTAINER(toolbar), toolItem);
447 gtk_widget_show(toolItem);
451 toolItem = GTK_WIDGET(gtk_tool_item_new());
452 gtk_container_add(GTK_CONTAINER(toolItem), button);
453 gtk_widget_show(button);
455 gtk_container_add(GTK_CONTAINER(toolbar), toolItem);
456 gtk_widget_show(toolItem);
467 G_OBJECT_CLASS(ev_browser_plugin_toolbar_parent_class)->dispose(
object);
472 GObjectClass *gObjectClass = G_OBJECT_CLASS(klass);
477 g_object_class_install_property(gObjectClass,
479 g_param_spec_pointer(
"plugin",
482 static_cast<GParamFlags>(G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)));