diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-11-02 17:31:00 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-11-02 17:31:00 (EDT) |
commit | 4c57581b61239cb7188a7f4c9948c5b130de1692 (patch) | |
tree | 41cab702623d9e13f8e656de0574a9d21c395810 /src/toolbars/navigation/bookmarks-button-box.c | |
parent | b8e8613a6d680f229d61acd8c1199d0c6aa565d5 (diff) | |
download | marquee-4c57581b61239cb7188a7f4c9948c5b130de1692.zip marquee-4c57581b61239cb7188a7f4c9948c5b130de1692.tar.gz marquee-4c57581b61239cb7188a7f4c9948c5b130de1692.tar.bz2 |
MqBookmarksButtonBox: New class
Diffstat (limited to 'src/toolbars/navigation/bookmarks-button-box.c')
-rw-r--r-- | src/toolbars/navigation/bookmarks-button-box.c | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/src/toolbars/navigation/bookmarks-button-box.c b/src/toolbars/navigation/bookmarks-button-box.c new file mode 100644 index 0000000..667c29a --- /dev/null +++ b/src/toolbars/navigation/bookmarks-button-box.c @@ -0,0 +1,106 @@ +/* + * 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 <http://www.gnu.org/licenses/>. + */ + +#include "bookmarks-button-box.h" + +#include <glib.h> +#include <gtk/gtk.h> +#include <webkit2/webkit2.h> + +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( + "starred", GTK_ICON_SIZE_SMALL_TOOLBAR); + gtk_button_set_relief(GTK_BUTTON(bookmarks_button_box->edit_button), + GTK_RELIEF_NONE); + 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_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); +} |