diff options
-rw-r--r-- | src/toolbars/navigation/bookmarks-button-box.c | 106 | ||||
-rw-r--r-- | src/toolbars/navigation/bookmarks-button-box.h | 57 | ||||
-rw-r--r-- | src/toolbars/navigation/local.mk | 1 |
3 files changed, 164 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); +} diff --git a/src/toolbars/navigation/bookmarks-button-box.h b/src/toolbars/navigation/bookmarks-button-box.h new file mode 100644 index 0000000..ea804d9 --- /dev/null +++ b/src/toolbars/navigation/bookmarks-button-box.h @@ -0,0 +1,57 @@ +/* + * 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/>. + */ + +#ifndef MQ_TOOLBARS_NAVIGATION_BOOKMARKS_BUTTON_BOX_H +#define MQ_TOOLBARS_NAVIGATION_BOOKMARKS_BUTTON_BOX_H + +typedef struct _MqBookmarksButtonBox MqBookmarksButtonBox; +typedef struct _MqBookmarksButtonBoxClass MqBookmarksButtonBoxClass; + +#include <glib.h> +#include <gtk/gtk.h> + +G_BEGIN_DECLS + +#define MQ_TYPE_BOOKMARKS_BUTTON_BOX \ + (mq_bookmarks_button_box_get_type()) +#define MQ_BOOKMARKS_BUTTON_BOX(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), MQ_TYPE_BOOKMARKS_BUTTON_BOX, \ + MqBookmarksButtonBox)) +#define MQ_IS_BOOKMARKS_BUTTON_BOX(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), MQ_TYPE_BOOKMARKS_BUTTON_BOX)) +#define MQ_BOOKMARKS_BUTTON_BOX_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), MQ_TYPE_BOOKMARKS_BUTTON_BOX, \ + MqBookmarksButtonBoxClass)) +#define MQ_IS_BOOKMARKS_BUTTON_BOX_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), MQ_TYPE_BOOKMARKS_BUTTON_BOX)) +#define MQ_BOOKMARKS_BUTTON_BOX_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS((obj), MQ_TYPE_BOOKMARKS_BUTTON_BOX, \ + MqBookmarksButtonBoxClass)) + +GType +mq_bookmarks_button_box_get_type(void); + +GtkToolItem * +mq_bookmarks_button_box_new(void); + +G_END_DECLS + +#endif /* MQ_TOOLBARS_NAVIGATION_BOOKMARKS_BUTTON_BOX_H */ diff --git a/src/toolbars/navigation/local.mk b/src/toolbars/navigation/local.mk index 083f4ce..9cf7c4f 100644 --- a/src/toolbars/navigation/local.mk +++ b/src/toolbars/navigation/local.mk @@ -1,5 +1,6 @@ marquee_SOURCES += \ %reldir%/back-forward-button-box.c \ + %reldir%/bookmarks-button-box.c \ %reldir%/downloads-button.c \ %reldir%/history-button.c \ %reldir%/home-button.c \ |