/*
* Bookmarks button box
*
* Copyright (C) 2017 Patrick McDermott
*
* This file is part of Marquee.
*
* Marquee is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Marquee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Marquee. If not, see .
*/
#include "bookmarks-button-box.h"
#include
#include
#include
struct _MqBookmarksButtonBox {
GtkToolItem parent_instance;
GtkWidget *edit_button;
GtkWidget *show_button;
};
struct _MqBookmarksButtonBoxClass {
GtkToolItemClass parent_class;
};
G_DEFINE_TYPE(MqBookmarksButtonBox, mq_bookmarks_button_box, GTK_TYPE_TOOL_ITEM)
static void
edit_clicked_cb(GtkButton G_GNUC_UNUSED *toolbutton,
MqBookmarksButtonBox G_GNUC_UNUSED *bookmarks_button_box)
{
/* TODO */
}
static void
show_clicked_cb(GtkButton G_GNUC_UNUSED *toolbutton,
MqBookmarksButtonBox G_GNUC_UNUSED *bookmarks_button_box)
{
/* TODO */
}
static void
mq_bookmarks_button_box_class_init(
MqBookmarksButtonBoxClass G_GNUC_UNUSED *klass)
{
}
static void
mq_bookmarks_button_box_init(MqBookmarksButtonBox *bookmarks_button_box)
{
GtkWidget *box;
/* Add/edit bookmark button */
bookmarks_button_box->edit_button = gtk_button_new_from_icon_name(
"non-starred", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_button_set_relief(GTK_BUTTON(bookmarks_button_box->edit_button),
GTK_RELIEF_NONE);
gtk_widget_set_can_focus(GTK_WIDGET(bookmarks_button_box->edit_button),
FALSE);
gtk_widget_set_tooltip_text(bookmarks_button_box->edit_button,
"Bookmark this page");
/* TODO: */
gtk_widget_set_sensitive(bookmarks_button_box->edit_button, FALSE);
g_signal_connect(bookmarks_button_box->edit_button, "clicked",
G_CALLBACK(edit_clicked_cb), bookmarks_button_box);
/* Show bookmarks button */
bookmarks_button_box->show_button = gtk_button_new_from_icon_name(
"edit-paste", GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_button_set_relief(GTK_BUTTON(bookmarks_button_box->show_button),
GTK_RELIEF_NONE);
gtk_widget_set_can_focus(GTK_WIDGET(bookmarks_button_box->show_button),
FALSE);
gtk_widget_set_tooltip_text(bookmarks_button_box->show_button,
"Show bookmarks");
/* TODO: */
gtk_widget_set_sensitive(bookmarks_button_box->show_button, FALSE);
g_signal_connect(bookmarks_button_box->show_button, "clicked",
G_CALLBACK(show_clicked_cb), bookmarks_button_box);
/* Box */
box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_box_pack_start(GTK_BOX(box),
bookmarks_button_box->edit_button, FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(box),
bookmarks_button_box->show_button, FALSE, FALSE, 0);
gtk_style_context_add_class(gtk_widget_get_style_context(box),
"linked");
gtk_container_add(GTK_CONTAINER(bookmarks_button_box), box);
}
GtkToolItem *
mq_bookmarks_button_box_new(void)
{
return g_object_new(MQ_TYPE_BOOKMARKS_BUTTON_BOX,
NULL);
}