diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-04-20 19:03:42 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-04-20 19:03:42 +0800 |
commit | d5eed5f210049e0b3b4332ddb36b0fde6b50a76e (patch) | |
tree | 060439e101e1399c1f0cf05cc6b37a2af90f4128 | |
parent | 1ae8286ebfe005b34e1ebe7068fc364aa3a4cb09 (diff) | |
download | gsoc2013-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 ....
-rw-r--r-- | ChangeLog | 28 | ||||
-rw-r--r-- | data/epiphany.schemas.in | 11 | ||||
-rw-r--r-- | data/ui/epiphany-ui.xml.in | 1 | ||||
-rwxr-xr-x | lib/egg/egg-editable-toolbar.c | 52 | ||||
-rwxr-xr-x | lib/egg/egg-editable-toolbar.h | 2 | ||||
-rw-r--r-- | lib/ephy-prefs.h | 1 | ||||
-rw-r--r-- | src/bookmarks/Makefile.am | 10 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmark-properties.c | 50 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.h | 3 | ||||
-rw-r--r-- | src/ephy-window.c | 46 | ||||
-rw-r--r-- | src/window-commands.c | 19 | ||||
-rw-r--r-- | src/window-commands.h | 3 |
12 files changed, 197 insertions, 29 deletions
@@ -1,5 +1,33 @@ 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 .... + +2003-04-20 Marco Pesenti Gritti <marco@it.gnome.org> + * data/ui/epiphany-history-window-ui.xml.in: Looks like Erich forgot the xml changes diff --git a/data/epiphany.schemas.in b/data/epiphany.schemas.in index 12ce4bb60..b795f33dc 100644 --- a/data/epiphany.schemas.in +++ b/data/epiphany.schemas.in @@ -260,6 +260,17 @@ </locale> </schema> <schema> + <key>/schemas/apps/epiphany/interface/show_personal_toolbar</key> + <applyto>/apps/epiphany/interface/show_personal_toolbar</applyto> + <owner>epiphany</owner> + <type>bool</type> + <default>0</default> + <locale name="C"> + <short>Show bookmarks toolbar by default</short> + <long>Show bookmarks toolbar by default.</long> + </locale> + </schema> + <schema> <key>/schemas/apps/epiphany/interface/show_statusbar</key> <applyto>/apps/epiphany/interface/show_statusbar</applyto> <owner>epiphany</owner> diff --git a/data/ui/epiphany-ui.xml.in b/data/ui/epiphany-ui.xml.in index dc8e97242..0da96aa19 100644 --- a/data/ui/epiphany-ui.xml.in +++ b/data/ui/epiphany-ui.xml.in @@ -33,6 +33,7 @@ <submenu name="ViewMenu" verb="View"> <menuitem name="ViewToolbarMenu" verb="ViewToolbar"/> + <menuitem name="ViewBookmarksToolbarMenu" verb="ViewBookmarksToolbar"/> <menuitem name="ViewStatusbarMenu" verb="ViewStatusbar"/> <menuitem name="ViewFullscreenMenu" verb="ViewFullscreen"/> <separator name="ViewSep1"/> diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c index 8e875842e..73528b96d 100755 --- a/lib/egg/egg-editable-toolbar.c +++ b/lib/egg/egg-editable-toolbar.c @@ -1169,6 +1169,58 @@ set_action_sensitive (EggToolbarsItem *item, } } +static void +hide_toolbar (EggToolbarsToolbar *t, + EggEditableToolbar *etoolbar) +{ + GtkWidget *tb; + + g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (etoolbar)); + g_return_if_fail (t != NULL); + + tb = get_item_widget (etoolbar, t); + + g_return_if_fail (tb != NULL); + + gtk_widget_hide (tb); +} + +static void +show_toolbar (EggToolbarsToolbar *t, + EggEditableToolbar *etoolbar) +{ + GtkWidget *tb; + + g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (etoolbar)); + g_return_if_fail (t != NULL); + + tb = get_item_widget (etoolbar, t); + + g_return_if_fail (tb != NULL); + + gtk_widget_show (tb); +} + +void +egg_editable_toolbar_show (EggEditableToolbar *etoolbar) +{ + g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (etoolbar)); + + egg_toolbars_group_foreach_toolbar (etoolbar->priv->group, + (EggToolbarsGroupForeachToolbarFunc) + show_toolbar, etoolbar); +} + +void +egg_editable_toolbar_hide (EggEditableToolbar *etoolbar) +{ + g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (etoolbar)); + + egg_toolbars_group_foreach_toolbar (etoolbar->priv->group, + (EggToolbarsGroupForeachToolbarFunc) + hide_toolbar, etoolbar); +} + void egg_editable_toolbar_edit (EggEditableToolbar *etoolbar, GtkWidget *window) diff --git a/lib/egg/egg-editable-toolbar.h b/lib/egg/egg-editable-toolbar.h index 29ccf8200..f4f8aff64 100755 --- a/lib/egg/egg-editable-toolbar.h +++ b/lib/egg/egg-editable-toolbar.h @@ -62,6 +62,8 @@ EggEditableToolbar *egg_editable_toolbar_new (EggMenuMerge *merge, EggToolbarsGroup *group); void egg_editable_toolbar_edit (EggEditableToolbar *etoolbar, GtkWidget *window); +void egg_editable_toolbar_show (EggEditableToolbar *etoolbar); +void egg_editable_toolbar_hide (EggEditableToolbar *etoolbar); char *egg_editable_toolbar_get_action_name (EggEditableToolbar *etoolbar, const char *drag_type, const char *data); diff --git a/lib/ephy-prefs.h b/lib/ephy-prefs.h index f4d4cf286..cd52d34b4 100644 --- a/lib/ephy-prefs.h +++ b/lib/ephy-prefs.h @@ -36,6 +36,7 @@ G_BEGIN_DECLS #define CONF_WINDOWS_FS_SHOW_STATUSBAR "/apps/epiphany/interface/show_statusbar_in_fullscreen" #define CONF_WINDOWS_SHOW_SIDEBAR "/apps/epiphany/interface/show_sidebar" #define CONF_WINDOWS_SHOW_TOOLBARS "/apps/epiphany/interface/show_toolbars" +#define CONF_WINDOWS_SHOW_PERSONAL_TOOLBAR "/apps/epiphany/interface/show_personal_toolbar" #define CONF_WINDOWS_SHOW_STATUSBAR "/apps/epiphany/interface/show_statusbar" #define CONF_TOOLBAR_SETUP "/apps/epiphany/interface/toolbar_setup" #define CONF_TOOLBAR_SPINNER_THEME "/apps/epiphany/interface/spinner_theme" 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); |