summaryrefslogtreecommitdiffstats
path: root/src/toolbars/navigation/bookmarks-button-box.c
blob: 87f19fcf1673e3d0193a151db9127390b40cb91f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*
 * 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>

#include "../../i18n.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(
		"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);
}