aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-04-20 19:03:42 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-04-20 19:03:42 +0800
commitd5eed5f210049e0b3b4332ddb36b0fde6b50a76e (patch)
tree060439e101e1399c1f0cf05cc6b37a2af90f4128 /src
parent1ae8286ebfe005b34e1ebe7068fc364aa3a4cb09 (diff)
downloadgsoc2013-epiphany-d5eed5f210049e0b3b4332ddb36b0fde6b50a76e.tar
gsoc2013-epiphany-d5eed5f210049e0b3b4332ddb36b0fde6b50a76e.tar.gz
gsoc2013-epiphany-d5eed5f210049e0b3b4332ddb36b0fde6b50a76e.tar.bz2
gsoc2013-epiphany-d5eed5f210049e0b3b4332ddb36b0fde6b50a76e.tar.lz
gsoc2013-epiphany-d5eed5f210049e0b3b4332ddb36b0fde6b50a76e.tar.xz
gsoc2013-epiphany-d5eed5f210049e0b3b4332ddb36b0fde6b50a76e.tar.zst
gsoc2013-epiphany-d5eed5f210049e0b3b4332ddb36b0fde6b50a76e.zip
Update
2003-04-20 Marco Pesenti Gritti <marco@it.gnome.org> * lib/egg/egg-editable-toolbar.c: Update * data/epiphany.schemas.in: * data/ui/epiphany-ui.xml.in: * lib/egg/egg-editable-toolbar.h: * lib/ephy-prefs.h: * src/bookmarks/Makefile.am: * src/bookmarks/ephy-bookmark-properties.c: (update_checkbox), (update_window_title), (toolbar_checkbox_changed_cb), (set_window_icon), (build_ui): * src/bookmarks/ephy-bookmarks.h: * src/ephy-window.c: (add_widget), (ephy_window_init), (save_window_chrome), (ephy_window_finalize), (translate_default_chrome), (update_layout_toggles), (ephy_window_set_chrome): * src/window-commands.c: (window_cmd_view_bookmarks_toolbar): * src/window-commands.h: First implementation of the new bookmarks toolbar thing. Still doesnt work properly ... old bmk toolbars are still there though. Dave I dont like much the position of the checkbox in properties :/ Maybe a different tab dunno ....
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/Makefile.am10
-rw-r--r--src/bookmarks/ephy-bookmark-properties.c50
-rw-r--r--src/bookmarks/ephy-bookmarks.h3
-rw-r--r--src/ephy-window.c46
-rw-r--r--src/window-commands.c19
-rw-r--r--src/window-commands.h3
6 files changed, 102 insertions, 29 deletions
diff --git a/src/bookmarks/Makefile.am b/src/bookmarks/Makefile.am
index 8da75c248..bc0e7a85f 100644
--- a/src/bookmarks/Makefile.am
+++ b/src/bookmarks/Makefile.am
@@ -18,16 +18,18 @@ INCLUDES = \
noinst_LTLIBRARIES = libephybookmarks.la
libephybookmarks_la_SOURCES = \
- ephy-bookmark-action.c \
- ephy-bookmark-action.h \
- ephy-bookmark-properties.c \
- ephy-bookmark-properties.h \
ephy-bookmarks.c \
ephy-bookmarks.h \
+ ephy-bookmark-action.c \
+ ephy-bookmark-action.h \
ephy-bookmarks-editor.c \
ephy-bookmarks-editor.h \
ephy-bookmarks-import.c \
ephy-bookmarks-import.h \
+ ephy-bookmark-properties.c \
+ ephy-bookmark-properties.h \
+ ephy-bookmarks-toolbar.c \
+ ephy-bookmarks-toolbar.h \
ephy-keywords-entry.c \
ephy-keywords-entry.h \
ephy-new-bookmark.c \
diff --git a/src/bookmarks/ephy-bookmark-properties.c b/src/bookmarks/ephy-bookmark-properties.c
index 7d9d8c2be..1de14b433 100644
--- a/src/bookmarks/ephy-bookmark-properties.c
+++ b/src/bookmarks/ephy-bookmark-properties.c
@@ -23,6 +23,8 @@
#include "ephy-shell.h"
#include "ephy-state.h"
+#include <gtk/gtkcheckbutton.h>
+#include <gtk/gtktogglebutton.h>
#include <gtk/gtkstock.h>
#include <gtk/gtkentry.h>
#include <gtk/gtkvbox.h>
@@ -213,6 +215,22 @@ bookmark_properties_response_cb (GtkDialog *dialog,
}
static void
+update_checkbox (EphyBookmarkProperties *props, GtkWidget *checkbox, gulong prop)
+{
+ GValue value = { 0, };
+ gboolean state;
+
+ state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
+
+ g_value_init (&value, G_TYPE_BOOLEAN);
+ g_value_set_boolean (&value, state);
+ ephy_node_set_property (props->priv->bookmark,
+ prop,
+ &value);
+ g_value_unset (&value);
+}
+
+static void
update_entry (EphyBookmarkProperties *props, GtkWidget *entry, guint prop)
{
GValue value = { 0, };
@@ -233,7 +251,7 @@ update_window_title(EphyBookmarkProperties *editor)
{
char *title;
const char *tmp;
-
+
tmp = ephy_node_get_property_string (editor->priv->bookmark,
EPHY_NODE_BMK_PROP_TITLE);
title = g_strdup_printf (_("%s Properties"), tmp);
@@ -256,6 +274,12 @@ location_entry_changed_cb (GtkWidget *entry, EphyBookmarkProperties *props)
}
static void
+toolbar_checkbox_changed_cb (GtkWidget *checkbox, EphyBookmarkProperties *props)
+{
+ update_checkbox (props, checkbox, EPHY_NODE_BMK_PROP_SHOW_IN_TOOLBAR);
+}
+
+static void
set_window_icon (EphyBookmarkProperties *editor)
{
EphyFaviconCache *cache;
@@ -275,10 +299,10 @@ set_window_icon (EphyBookmarkProperties *editor)
else
{
- icon = gtk_widget_render_icon (GTK_WIDGET (editor),
- GTK_STOCK_PROPERTIES,
- GTK_ICON_SIZE_MENU,
- NULL);
+ icon = gtk_widget_render_icon (GTK_WIDGET (editor),
+ GTK_STOCK_PROPERTIES,
+ GTK_ICON_SIZE_MENU,
+ NULL);
}
gtk_window_set_icon (GTK_WINDOW (editor), icon);
@@ -288,9 +312,11 @@ set_window_icon (EphyBookmarkProperties *editor)
static void
build_ui (EphyBookmarkProperties *editor)
{
- GtkWidget *table, *label, *entry, *topics_selector, *scrolled_window;
+ GtkWidget *table, *label, *entry, *topics_selector;
+ GtkWidget *checkbox, *scrolled_window;
char *str;
const char *tmp;
+ gboolean state;
g_signal_connect (G_OBJECT (editor),
"response",
@@ -312,7 +338,7 @@ build_ui (EphyBookmarkProperties *editor)
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 6);
gtk_widget_show (table);
-
+
entry = gtk_entry_new ();
tmp = ephy_node_get_property_string (editor->priv->bookmark,
EPHY_NODE_BMK_PROP_TITLE);
@@ -376,6 +402,16 @@ build_ui (EphyBookmarkProperties *editor)
gtk_table_attach (GTK_TABLE (table), scrolled_window, 1, 2, 2, 3,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
+ checkbox = gtk_check_button_new_with_mnemonic (_("Show in the bookmarks _toolbar"));
+ state = ephy_node_get_property_boolean (editor->priv->bookmark,
+ EPHY_NODE_BMK_PROP_SHOW_IN_TOOLBAR);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox), state);
+ g_signal_connect (checkbox, "toggled",
+ G_CALLBACK (toolbar_checkbox_changed_cb), editor);
+ gtk_table_attach (GTK_TABLE (table), checkbox, 0, 2, 3, 4, GTK_FILL, 0, 0, 0);
+ gtk_widget_show (checkbox);
+
+
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (editor)->vbox),
table, TRUE, TRUE, 0);
gtk_dialog_add_button (GTK_DIALOG (editor),
diff --git a/src/bookmarks/ephy-bookmarks.h b/src/bookmarks/ephy-bookmarks.h
index 0ab70af8e..bb22e1a5c 100644
--- a/src/bookmarks/ephy-bookmarks.h
+++ b/src/bookmarks/ephy-bookmarks.h
@@ -44,7 +44,8 @@ enum
EPHY_NODE_KEYWORD_PROP_NAME = 5,
EPHY_NODE_BMK_PROP_SMART_LOCATION = 6,
EPHY_NODE_BMK_PROP_ICON = 7,
- EPHY_NODE_KEYWORD_PROP_PRIORITY = 8
+ EPHY_NODE_KEYWORD_PROP_PRIORITY = 8,
+ EPHY_NODE_BMK_PROP_SHOW_IN_TOOLBAR = 9
};
struct EphyBookmarks
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 610356357..433b18288 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -21,6 +21,7 @@
#endif
#include "ephy-window.h"
+#include "ephy-bookmarks-toolbar.h"
#include "ephy-favorites-menu.h"
#include "ephy-state.h"
#include "ephy-gobject-misc.h"
@@ -129,6 +130,9 @@ static EggActionGroupEntry ephy_menu_entries [] = {
{ "ViewToolbar", N_("_Toolbar"), NULL, "<shift><control>T",
N_("Show or hide toolbar"),
G_CALLBACK (window_cmd_view_toolbar), NULL, TOGGLE_ACTION },
+ { "ViewBookmarksToolbar", N_("_Bookmarks Toolbar"), NULL, NULL,
+ N_("Show or hide bookmarks toolbar"),
+ G_CALLBACK (window_cmd_view_bookmarks_toolbar), NULL, TOGGLE_ACTION },
{ "ViewStatusbar", N_("St_atusbar"), NULL, NULL,
N_("Show or hide statusbar"),
G_CALLBACK (window_cmd_view_statusbar), NULL, TOGGLE_ACTION },
@@ -253,10 +257,10 @@ struct EphyWindowPrivate
GtkWidget *menu_dock;
GtkWidget *menubar;
Toolbar *toolbar;
- GList *toolbars;
GtkWidget *statusbar;
EggActionGroup *action_group;
EggActionGroup *popups_action_group;
+ EphyBookmarksToolbar *bmk_toolbar;
EphyFavoritesMenu *fav_menu;
EphyEncodingMenu *enc_menu;
PPViewToolbar *ppview_toolbar;
@@ -390,11 +394,6 @@ add_widget (EggMenuMerge *merge, GtkWidget *widget, EphyWindow *window)
{
window->priv->menubar = widget;
}
- else
- {
- window->priv->toolbars = g_list_append
- (window->priv->toolbars, widget);
- }
gtk_box_pack_start (GTK_BOX (window->priv->menu_dock),
widget, FALSE, FALSE, 0);
@@ -567,11 +566,11 @@ ephy_window_init (EphyWindow *window)
window->priv->chrome_mask = 0;
window->priv->closing = FALSE;
window->priv->ppview_toolbar = NULL;
- window->priv->toolbars = NULL;
/* Setup the window and connect verbs */
setup_window (window);
+ window->priv->bmk_toolbar = ephy_bookmarks_toolbar_new (window);
window->priv->fav_menu = ephy_favorites_menu_new (window);
window->priv->enc_menu = ephy_encoding_menu_new (window);
@@ -613,6 +612,8 @@ save_window_chrome (EphyWindow *window)
}
else
{
+ eel_gconf_set_boolean (CONF_WINDOWS_SHOW_PERSONAL_TOOLBAR,
+ flags & EMBED_CHROME_PERSONALTOOLBARON);
eel_gconf_set_boolean (CONF_WINDOWS_SHOW_TOOLBARS,
flags & EMBED_CHROME_TOOLBARON);
eel_gconf_set_boolean (CONF_WINDOWS_SHOW_STATUSBAR,
@@ -662,11 +663,6 @@ ephy_window_finalize (GObject *object)
g_object_unref (window->priv->ppview_toolbar);
}
- if (window->priv->toolbars)
- {
- g_list_free (window->priv->toolbars);
- }
-
g_object_unref (window->priv->action_group);
egg_menu_merge_remove_action_group (EGG_MENU_MERGE (window->ui_merge),
window->priv->action_group);
@@ -778,8 +774,11 @@ translate_default_chrome (EmbedChromeMask *chrome_mask)
{
*chrome_mask |= EMBED_CHROME_TOOLBARON;
}
+ if (eel_gconf_get_boolean (CONF_WINDOWS_SHOW_PERSONAL_TOOLBAR))
+ {
+ *chrome_mask |= EMBED_CHROME_PERSONALTOOLBARON;
+ }
- *chrome_mask |= EMBED_CHROME_PERSONALTOOLBARON;
*chrome_mask |= EMBED_CHROME_MENUBARON;
}
}
@@ -795,6 +794,10 @@ update_layout_toggles (EphyWindow *window)
egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action),
mask & EMBED_CHROME_TOOLBARON);
+ action = egg_action_group_get_action (action_group, "ViewBookmarksToolbar");
+ egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action),
+ mask & EMBED_CHROME_PERSONALTOOLBARON);
+
action = egg_action_group_get_action (action_group, "ViewStatusbar");
egg_toggle_action_set_active (EGG_TOGGLE_ACTION (action),
mask & EMBED_CHROME_STATUSBARON);
@@ -822,15 +825,24 @@ ephy_window_set_chrome (EphyWindow *window,
gtk_widget_hide (window->priv->menubar);
}
+ if (flags & EMBED_CHROME_PERSONALTOOLBARON)
+ {
+ ephy_bookmarks_toolbar_show (window->priv->bmk_toolbar);
+ }
+ else
+ {
+ ephy_bookmarks_toolbar_hide (window->priv->bmk_toolbar);
+ }
+
if (flags & EMBED_CHROME_TOOLBARON)
{
- g_list_foreach (window->priv->toolbars,
- (GFunc)gtk_widget_show, NULL);
+ egg_editable_toolbar_show
+ (EGG_EDITABLE_TOOLBAR (window->priv->toolbar));
}
else
{
- g_list_foreach (window->priv->toolbars,
- (GFunc)gtk_widget_hide, NULL);
+ egg_editable_toolbar_hide
+ (EGG_EDITABLE_TOOLBAR (window->priv->toolbar));
}
if (flags & EMBED_CHROME_STATUSBARON)
diff --git a/src/window-commands.c b/src/window-commands.c
index 79fcb1a79..07efcdf6d 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -479,6 +479,25 @@ window_cmd_edit_find_prev (EggAction *action,
}
void
+window_cmd_view_bookmarks_toolbar (EggAction *action,
+ EphyWindow *window)
+{
+ EmbedChromeMask mask;
+ gboolean active;
+ gboolean current_state;
+
+ mask = ephy_window_get_chrome (window);
+ active = EGG_TOGGLE_ACTION (action)->active;
+ current_state = (mask & EMBED_CHROME_PERSONALTOOLBARON) > 0;
+
+ if (active != current_state)
+ {
+ mask ^= EMBED_CHROME_PERSONALTOOLBARON;
+ ephy_window_set_chrome (window, mask);
+ }
+}
+
+void
window_cmd_view_toolbar (EggAction *action,
EphyWindow *window)
{
diff --git a/src/window-commands.h b/src/window-commands.h
index 37740a2a9..8594e791f 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -104,6 +104,9 @@ void window_cmd_view_statusbar (EggAction *action,
void window_cmd_view_toolbar (EggAction *action,
EphyWindow *window);
+void window_cmd_view_bookmarks_toolbar (EggAction *action,
+ EphyWindow *window);
+
void window_cmd_view_fullscreen (EggAction *action,
EphyWindow *window);