diff options
-rw-r--r-- | ChangeLog | 38 | ||||
-rw-r--r-- | data/ui/Makefile.am | 15 | ||||
-rw-r--r-- | data/ui/epiphany-bookmark-editor-ui.xml | 56 | ||||
-rw-r--r-- | data/ui/epiphany-fs-toolbar.xml | 10 | ||||
-rw-r--r-- | data/ui/epiphany-history-window-ui.xml | 40 | ||||
-rw-r--r-- | data/ui/epiphany-toolbar.xml | 46 | ||||
-rw-r--r-- | data/ui/epiphany-ui.xml | 159 | ||||
-rwxr-xr-x | lib/egg/egg-editable-toolbar.c | 68 | ||||
-rwxr-xr-x | lib/egg/egg-toolbars-model.c | 8 | ||||
-rw-r--r-- | src/ephy-shell.c | 43 | ||||
-rw-r--r-- | src/ephy-shell.h | 3 | ||||
-rw-r--r-- | src/ephy-window.c | 12 | ||||
-rwxr-xr-x | src/toolbar.c | 77 | ||||
-rw-r--r-- | src/toolbar.h | 1 | ||||
-rw-r--r-- | src/window-commands.c | 4 |
15 files changed, 517 insertions, 63 deletions
@@ -1,3 +1,41 @@ +2003-09-19 Marco Pesenti Gritti <marco@gnome.org> + + * data/ui/Makefile.am: + * data/ui/epiphany-bookmark-editor-ui.xml.in: + * data/ui/epiphany-fs-toolbar.xml: + * data/ui/epiphany-history-window-ui.xml.in: + * data/ui/epiphany-toolbar.xml.in: + * data/ui/epiphany-ui.xml.in: + + Do not use .in for not to translate files. + + * lib/egg/egg-editable-toolbar.c: (create_toolbar), + (toolbars_clean), (egg_editable_toolbar_construct), + (egg_editable_toolbar_set_model), (egg_editable_toolbar_set_merge): + * lib/egg/egg-toolbars-model.c: (parse_toolbars): + + Handle change of properties correctly. Add a toolbar + style property in the xml. + + * src/bookmarks/ephy-bookmark-properties.c: + (ephy_bookmark_properties_init): + * src/bookmarks/ephy-bookmarks-editor.c: + (ephy_bookmarks_editor_init): + * src/ephy-shell.c: (ephy_shell_init), (ephy_shell_finalize), + (ephy_shell_get_toolbars_model): + * src/ephy-shell.h: + * src/ephy-window.c: (ephy_window_fullscreen), + (ephy_window_unfullscreen): + * src/toolbar.c: (bookmark_destroy_cb), (toolbar_ensure_action), + (init_bookmarks_toolbar), (init_normal_mode), + (init_fullscreen_mode), (window_state_event_cb), + (toolbar_set_window), (toolbar_set_visibility): + * src/toolbar.h: + * src/window-commands.c: (toolbar_editor_response_cb), + (window_cmd_edit_toolbar): + + Special, more compact, toolbar layout for fullscreen. + 2003-09-18 Marco Pesenti Gritti <marco@gnome.org> * src/ephy-favicon-action.c: (ephy_favicon_action_class_init): diff --git a/data/ui/Makefile.am b/data/ui/Makefile.am index 76467e77c..a0123616d 100644 --- a/data/ui/Makefile.am +++ b/data/ui/Makefile.am @@ -1,12 +1,15 @@ uixmldir = $(pkgdatadir) -uixml_in_files = epiphany-ui.xml.in \ - epiphany-bookmark-editor-ui.xml.in \ - nautilus-epiphany-view.xml.in \ - epiphany-toolbar.xml.in \ - epiphany-history-window-ui.xml.in - +uixml_in_files = nautilus-epiphany-view.xml.in uixml_DATA = $(uixml_in_files:.xml.in=.xml) +xmldir = $(pkgdatadir) +xml_DATA = \ + epiphany-fs-toolbar.xml \ + epiphany-bookmark-editor-ui.xml \ + epiphany-ui.xml \ + epiphany-toolbar.xml \ + epiphany-history-window-ui.xml + @INTLTOOL_XML_RULE@ EXTRA_DIST = $(uixml_in_files) diff --git a/data/ui/epiphany-bookmark-editor-ui.xml b/data/ui/epiphany-bookmark-editor-ui.xml new file mode 100644 index 000000000..449229660 --- /dev/null +++ b/data/ui/epiphany-bookmark-editor-ui.xml @@ -0,0 +1,56 @@ +<ui> +<menubar> + +<menu name="FileMenu" action="File"> + <menuitem name="FileNewTopic" action="NewTopic"/> + <separator name="FileSep1"/> + <menuitem name="FileOpenInWindow" action="OpenInWindow"/> + <menuitem name="FileOpenInTab" action="OpenInTab"/> + <separator name="FileSep2"/> + <menuitem name="FileRename" action="Rename"/> + <menuitem name="FileDelete" action="Delete"/> + <separator name="FileSep3"/> + <menuitem name="FileShowInBookmarksBar" action="ShowInBookmarksBar"/> + <menuitem name="FileProperties" action="Properties"/> + <separator name="FileSep4"/> + <menuitem name="FileImport" action="Import"/> + <separator name="FileSep5"/> + <menuitem name="FileClose" action="Close"/> +</menu> + +<menu name="EditMenu" action="Edit"> + <menuitem name="EditCut" action="Cut"/> + <menuitem name="EditCopy" action="Copy"/> + <menuitem name="EditPaste" action="Paste"/> + <menuitem name="EditSelectAll" action="SelectAll"/> +</menu> + +<menu name="HelpMenu" action="Help"> + <menuitem name="HelpContents" action="HelpContents"/> + <menuitem name="HelpAbout" action="HelpAbout"/> +</menu> + +</menubar> + +<popup name="EphyBookmarkEditorPopup" action="PopupAction"> + <menuitem name="OpenInWindowBMK" action="OpenInWindow"/> + <menuitem name="OpenInTabBMK" action="OpenInTab"/> + <separator name="BookmarksPopupSep1"/> + <menuitem name="CopyBMK" action="Copy"/> + <separator name="BookmarksPopupSep2"/> + <menuitem name="RenameBMK" action="Rename"/> + <menuitem name="DeleteBMK" action="Delete"/> + <separator name="BookmarksPopupSep3"/> + <menuitem name="ShowInBookmarksBarBMK" action="ShowInBookmarksBar"/> + <separator name="BookmarksPopupSep4"/> + <menuitem name="BMKProperties" action="Properties"/> +</popup> + +<popup name="EphyBookmarkKeywordPopup" action="PopupAction"> + <menuitem name="RenameTPC" action="Rename"/> + <menuitem name="DeleteTPC" action="Delete"/> + <separator name="TopicPopupSep3"/> + <menuitem name="ShowInBookmarksBarTPC" action="ShowInBookmarksBar"/> +</popup> + +</ui> diff --git a/data/ui/epiphany-fs-toolbar.xml b/data/ui/epiphany-fs-toolbar.xml new file mode 100644 index 000000000..2eec09e81 --- /dev/null +++ b/data/ui/epiphany-fs-toolbar.xml @@ -0,0 +1,10 @@ +<editabletoolbar> +<toolbar name="Toolbar" style="icons-only"> + <toolitem name="NavigationBack"/> + <toolitem name="NavigationForward"/> + <toolitem name="ViewStop"/> + <toolitem name="ViewReload"/> + <toolitem name="Location"/> + <toolitem name="Spinner"/> +</toolbar> +</editabletoolbar> diff --git a/data/ui/epiphany-history-window-ui.xml b/data/ui/epiphany-history-window-ui.xml new file mode 100644 index 000000000..1d977b092 --- /dev/null +++ b/data/ui/epiphany-history-window-ui.xml @@ -0,0 +1,40 @@ +<ui> +<menubar> + +<menu name="FileMenu" action="File"> + <menuitem name="FileOpenInWindow" action="OpenInWindow"/> + <menuitem name="FileOpenInTab" action="OpenInTab"/> + <separator name="FileSep1"/> + <menuitem name="FileBookmarkLink" action="BookmarkLink"/> + <menuitem name="FileDelete" action="Delete"/> + <separator name="FileSep2"/> + <menuitem name="FileClose" action="Close"/> +</menu> + +<menu name="EditMenu" action="Edit"> + <menuitem name="EditCut" action="Cut"/> + <menuitem name="EditCopy" action="Copy"/> + <menuitem name="EditPaste" action="Paste"/> + <menuitem name="EditSelectAll" action="SelectAll"/> + <separator name="EditSep1"/> + <menuitem name="EditClear" action="Clear"/> +</menu> + +<menu name="HelpMenu" action="Help"> + <menuitem name="HelpContents" action="HelpContents"/> + <menuitem name="HelpAbout" action="HelpAbout"/> +</menu> + +</menubar> + +<popup name="EphyHistoryWindowPopup" action="PopupAction"> + <menuitem name="OpenInWindowHST" action="OpenInWindow"/> + <menuitem name="OpenInTabHST" action="OpenInTab"/> + <separator name="HistoryPopupSep1"/> + <menuitem name="CopyHST" action="Copy"/> + <separator name="HistoryPopupSep2"/> + <menuitem name="BookmarkLinkHST" action="BookmarkLink"/> + <menuitem name="DeleteHST" action="Delete"/> +</popup> + +</ui> diff --git a/data/ui/epiphany-toolbar.xml b/data/ui/epiphany-toolbar.xml new file mode 100644 index 000000000..6accae2fb --- /dev/null +++ b/data/ui/epiphany-toolbar.xml @@ -0,0 +1,46 @@ +<editabletoolbar> +<available> + <toolitem name="NavigationBack"/> + <toolitem name="NavigationForward"/> + <toolitem name="NavigationUp"/> + <toolitem name="ViewStop"/> + <toolitem name="ViewReload"/> + <toolitem name="GoHome"/> + <toolitem name="GoHistory"/> + <toolitem name="GoBookmarks"/> + <toolitem name="FileNewTab"/> + <toolitem name="FileNewWindow"/> + <toolitem name="FileOpen"/> + <toolitem name="FileSaveAs"/> + <toolitem name="FilePrint"/> + <toolitem name="FileBookmarkPage"/> + <toolitem name="ViewFullscreen"/> + <toolitem name="EditFind"/> + <toolitem name="Favicon"/> + <toolitem name="Location"/> + <toolitem name="Spinner"/> + <toolitem name="ToolbarGo"/> + <toolitem name="Zoom"/> +</available> +<toolbar name="DefaultToolbar"> + <toolitem name="NavigationBack"/> + <toolitem name="NavigationForward"/> + <toolitem name="ViewStop"/> + <toolitem name="ViewReload"/> + <separator/> + <toolitem name="GoHome"/> + <toolitem name="GoHistory"/> + <toolitem name="GoBookmarks"/> + <separator/> + <toolitem name="EditFind"/> + <toolitem name="Spinner"/> +</toolbar> +<toolbar name="EntryToolbar"> + <toolitem name="Favicon"/> + <toolitem name="Location"/> + <toolitem name="ToolbarGo"/> +</toolbar> +<toolbar name="BookmarksBar"> +</toolbar> +</editabletoolbar> + diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml new file mode 100644 index 000000000..d4fbb636a --- /dev/null +++ b/data/ui/epiphany-ui.xml @@ -0,0 +1,159 @@ +<ui> +<menubar> +<menu name="FileMenu" action="File"> + <menuitem name="FileNewWindowMenu" action="FileNewWindow"/> + <menuitem name="FileNewTabMenu" action="FileNewTab"/> + <menuitem name="FileOpenMenu" action="FileOpen"/> + <separator name="FileSep1"/> + <menuitem name="FileSaveAsMenu" action="FileSaveAs"/> + <separator name="FileSep2"/> + <menuitem name="FilePrintMenu" action="FilePrint"/> + <menuitem name="FileSendToMenu" action="FileSendTo"/> + <separator name="FileSep3"/> + <menuitem name="FileCloseWindowMenu" action="FileCloseWindow"/> +</menu> + +<menu name="EditMenu" action="Edit"> + <menuitem name="EditCutMenu" action="EditCut"/> + <menuitem name="EditCopyMenu" action="EditCopy"/> + <menuitem name="EditPasteMenu" action="EditPaste"/> + <separator name="EditSep1"/> + <menuitem name="EditSelectAllMenu" action="EditSelectAll"/> + <separator name="EditSep2"/> + <menuitem name="EditFindMenu" action="EditFind"/> + <menuitem name="EditFindNextMenu" action="EditFindNext"/> + <menuitem name="EditFindPrevMenu" action="EditFindPrev"/> + <separator name="EditSep3"/> + <menuitem name="EditPersonalDataMenu" action="EditPersonalData"/> + <menuitem name="EditToolbarMenu" action="EditToolbar"/> + <menuitem name="EditPrefsMenu" action="EditPrefs"/> +</menu> + +<menu name="ViewMenu" action="View"> + <menuitem name="ViewToolbarMenu" action="ViewToolbar"/> + <menuitem name="ViewBookmarksBarMenu" action="ViewBookmarksBar"/> + <menuitem name="ViewStatusbarMenu" action="ViewStatusbar"/> + <menuitem name="ViewFullscreenMenu" action="ViewFullscreen"/> + <separator name="ViewSep1"/> + <menuitem name="ViewZoomInMenu" action="ViewZoomIn"/> + <menuitem name="ViewZoomOutMenu" action="ViewZoomOut"/> + <menuitem name="ViewZoomNormalMenu" action="ViewZoomNormal"/> + <separator name="ViewSep2"/> + <placeholder name="ViewEncodingsPlaceholder"/> + <menuitem name="ViewPageSourceMenu" action="ViewPageSource"/> + <separator name="ViewSep3"/> + <menuitem name="ViewStopMenu" action="ViewStop"/> + <menuitem name="ViewReloadMenu" action="ViewReload"/> +</menu> + +<menu name="GoMenu" action="Go"> + <menuitem name="GoBackMenu" action="GoBack"/> + <menuitem name="GoForwardMenu" action="GoForward"/> + <menuitem name="GoUpMenu" action="GoUp"/> + <separator name="GoSep1"/> + <menuitem name="GoHomeMenu" action="GoHome"/> + <menuitem name="GoHistoryMenu" action="GoHistory"/> + <separator name="GoSep2"/> + <menuitem name="GoLocationMenu" action="GoLocation"/> + <separator name="GoSep3"/> +</menu> + +<menu name="BookmarksMenu" action="Bookmarks"> + <menuitem name="BookmarksAddBookmarkMenu" action="FileBookmarkPage"/> + <menuitem name="BookmarksEditMenu" action="GoBookmarks"/> + <separator name="BookmarksSep1"/> +</menu> + +<menu name="TabsMenu" action="Tabs"> + <menuitem name="TabsPreviousMenu" action="TabsPrevious"/> + <menuitem name="TabsNextMenu" action="TabsNext"/> + <separator name="TabsSep1"/> + <menuitem name="TabsMoveLeftMenu" action="TabsMoveLeft"/> + <menuitem name="TabsMoveRightMenu" action="TabsMoveRight"/> + <menuitem name="TabsDetachMenu" action="TabsDetach"/> + <placeholder name="TabsOpen"> + <separator name="TabsSep2"/> + </placeholder> +</menu> + +<menu name="HelpMenu" action="Help"> + <menuitem name="HelpContentsMenu" action="HelpContents"/> + <menuitem name="HelpAboutMenu" action="HelpAbout"/> +</menu> +</menubar> + +<popup name="EphyInputPopup" action="PopupAction"> + <menuitem name="EditCutIP" action="EditCut"/> + <menuitem name="EditCopyIP" action="EditCopy"/> + <menuitem name="EditPasteIP" action="EditPaste"/> +</popup> +<popup name="EphyTextPopup" action="PopupAction"> + <menuitem name="EditCopyTP" action="EditCopy"/> +</popup> +<popup name="EphyDocumentPopup" action="PopupAction"> + <menuitem name="GoBackDP" action="GoBack"/> + <menuitem name="GoForwardDP" action="GoForward"/> + <menuitem name="GoReloadDP" action="ViewReload"/> + <separator name="DPSep1"/> + <menuitem name="EditCopyDP" action="EditCopy"/> + <separator name="DPSep2"/> + <menuitem name="SavePageAsDP" action="FileSaveAs"/> + <menuitem name="SaveBackgroundAsDP" action="SaveBackgroundAs"/> + <menuitem name="BookmarkPageDP" action="ContextBookmarkPage"/> +</popup> + +<popup name="EphyFramedDocumentPopup" action="PopupAction"> + <menuitem name="GoBackFDP" action="GoBack"/> + <menuitem name="GoForwardFDP" action="GoForward"/> + <menuitem name="GoReloadFDP" action="ViewReload"/> + <separator name="FDPSep1"/> + <menuitem name="EditCopyFDP" action="EditCopy"/> + <separator name="FDPSep2"/> + <menuitem name="SavePageAsFDP" action="FileSaveAs"/> + <menuitem name="SaveBackgroundAsFDP" action="SaveBackgroundAs"/> + <menuitem name="BookmarkPageFDP" action="ContextBookmarkPage"/> + <separator name="FDBSep3"/> + <menuitem name="OpenFrameFDP" action="OpenFrame"/> + <menuitem name="OpenFrameInNewWindowFDP" action="OpenFrameInNewWindow"/> + <menuitem name="OpenFrameInNewTabFDP" action="OpenFrameInNewTab"/> +</popup> + +<popup name="EphyLinkPopup" action="PopupAction"> + <menuitem name="OpenLinkLP" action="OpenLink"/> + <menuitem name="OpenLinkInNewWindowLP" action="OpenLinkInNewWindow"/> + <menuitem name="OpenLinkInNewTabLP" action="OpenLinkInNewTab"/> + <separator name="LPSep1"/> + <menuitem name="DownloadLinkLP" action="DownloadLink"/> + <menuitem name="BookmarkLinkLP" action="BookmarkLink"/> + <menuitem name="CopyLinkAddressLP" action="CopyLinkAddress"/> +</popup> + +<popup name="EphyImagePopup" action="PopupAction"> + <menuitem name="OpenImageIP" action="OpenImage"/> + <menuitem name="OpenImageInNewWindowIP" action="OpenImageInNewWindow"/> + <menuitem name="OpenImageInNewTabIP" action="OpenImageInNewTab"/> + <separator name="IPSep1"/> + <menuitem name="SaveImageAsIP" action="SaveImageAs"/> + <menuitem name="SetImageAsBackgroundIP" action="SetImageAsBackground"/> + <menuitem name="CopyImageLocationIP" action="CopyImageLocation"/> +</popup> + +<popup name="EphyImageLinkPopup" action="PopupAction"> + <menuitem name="OpenLinkILP" action="OpenLink"/> + <menuitem name="OpenLinkInNewWindowILP" action="OpenLinkInNewWindow"/> + <menuitem name="OpenLinkInNewTabILP" action="OpenLinkInNewTab"/> + <separator name="ILPSep1"/> + <menuitem name="DownloadLinkILP" action="DownloadLink"/> + <menuitem name="BookmarkLinkILP" action="BookmarkLink"/> + <menuitem name="CopyLinkAddressILP" action="CopyLinkAddress"/> + <separator name="ILPSep2"/> + <menuitem name="OpenImageILP" action="OpenImage"/> + <menuitem name="OpenImageInNewWindowILP" action="OpenImageInNewWindow"/> + <menuitem name="OpenImageInNewTabILP" action="OpenImageInNewTab"/> + <separator name="ILPSep3"/> + <menuitem name="SaveImageAsILP" action="SaveImageAs"/> + <menuitem name="SetImageAsBackgroundILP" action="SetImageAsBackground"/> + <menuitem name="CopyImageLocationILP" action="CopyImageLocation"/> +</popup> + +</ui> diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c index 85537c9bd..d69088200 100755 --- a/lib/egg/egg-editable-toolbar.c +++ b/lib/egg/egg-editable-toolbar.c @@ -309,6 +309,7 @@ create_toolbar (EggEditableToolbar *t) toolbar = gtk_toolbar_new (); gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), TRUE); + gtk_widget_show (toolbar); gtk_drag_dest_set (toolbar, GTK_DEST_DEFAULT_DROP, dest_drag_types, n_dest_drag_types, @@ -482,24 +483,18 @@ item_removed_cb (EggToolbarsModel *model, } static void -egg_editable_toolbar_set_model (EggEditableToolbar *t, - EggToolbarsModel *model) +toolbars_clean (EggEditableToolbar *t) { - g_return_if_fail (IS_EGG_TOOLBARS_MODEL (model)); - g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (t)); + GList *children, *l; - t->priv->model = model; + children = gtk_container_get_children (GTK_CONTAINER (t)); - g_signal_connect_object (model, "item_added", - G_CALLBACK (item_added_cb), t, 0); - g_signal_connect_object (model, "item_removed", - G_CALLBACK (item_removed_cb), t, 0); - g_signal_connect_object (model, "toolbar_added", - G_CALLBACK (toolbar_added_cb), t, 0); - g_signal_connect_object (model, "toolbar_removed", - G_CALLBACK (toolbar_removed_cb), t, 0); - g_signal_connect_object (model, "toolbar_changed", - G_CALLBACK (toolbar_changed_cb), t, 0); + for (l = children; l != NULL; l = l->next) + { + gtk_widget_destroy (GTK_WIDGET (l->data)); + } + + g_list_free (children); } static void @@ -515,10 +510,17 @@ egg_editable_toolbar_construct (EggEditableToolbar *t) for (i = 0; i < n_toolbars; i++) { GtkWidget *toolbar; + EggTbModelFlags flags; toolbar = create_toolbar (t); gtk_box_pack_start (GTK_BOX (t), toolbar, FALSE, FALSE, 0); + flags = egg_toolbars_model_get_flags (model, i); + if (flags & EGG_TB_MODEL_ICONS_ONLY) + { + gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS); + } + n_items = egg_toolbars_model_n_items (model, i); for (l = 0; l < n_items; l++) { @@ -537,15 +539,47 @@ egg_editable_toolbar_construct (EggEditableToolbar *t) } static void +egg_editable_toolbar_set_model (EggEditableToolbar *t, + EggToolbarsModel *model) +{ + g_return_if_fail (IS_EGG_TOOLBARS_MODEL (model)); + g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (t)); + + if (t->priv->model == model) return; + + t->priv->model = model; + + toolbars_clean (t); + egg_editable_toolbar_construct (t); + + g_signal_connect_object (model, "item_added", + G_CALLBACK (item_added_cb), t, 0); + g_signal_connect_object (model, "item_removed", + G_CALLBACK (item_removed_cb), t, 0); + g_signal_connect_object (model, "toolbar_added", + G_CALLBACK (toolbar_added_cb), t, 0); + g_signal_connect_object (model, "toolbar_removed", + G_CALLBACK (toolbar_removed_cb), t, 0); + g_signal_connect_object (model, "toolbar_changed", + G_CALLBACK (toolbar_changed_cb), t, 0); +} + +static void egg_editable_toolbar_set_merge (EggEditableToolbar *t, GtkUIManager *merge) { g_return_if_fail (GTK_IS_UI_MANAGER (merge)); g_return_if_fail (IS_EGG_EDITABLE_TOOLBAR (t)); - t->priv->merge = merge; + if (t->priv->merge != merge) + { + t->priv->merge = merge; - egg_editable_toolbar_construct (t); + if (t->priv->model != NULL) + { + egg_editable_toolbar_construct (t); + } + } } static void diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c index 85ed145ab..fc74aa174 100755 --- a/lib/egg/egg-toolbars-model.c +++ b/lib/egg/egg-toolbars-model.c @@ -410,12 +410,20 @@ parse_toolbars (EggToolbarsModel *t, if (xmlStrEqual (child->name, "toolbar")) { xmlChar *name; + xmlChar *style; int position; name = xmlGetProp (child, "name"); position = egg_toolbars_model_add_toolbar (t, -1, name); xmlFree (name); + style = xmlGetProp (child, "style"); + if (style && strcmp (style, "icons-only") == 0) + { + egg_toolbars_model_set_flags (t, EGG_TB_MODEL_ICONS_ONLY, 0); + } + xmlFree (style); + parse_item_list (t, child->children, position); } diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 7e29fd293..2be34fdf6 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -69,6 +69,7 @@ struct EphyShellPrivate EphyAutocompletion *autocompletion; EphyBookmarks *bookmarks; EphyToolbarsModel *toolbars_model; + EggToolbarsModel *fs_toolbars_model; GtkWidget *bme; GtkWidget *history_window; GList *plugins; @@ -204,6 +205,7 @@ ephy_shell_init (EphyShell *gs) gs->priv->bme = NULL; gs->priv->history_window = NULL; gs->priv->toolbars_model = NULL; + gs->priv->fs_toolbars_model = NULL; gs->priv->plugins = NULL; ephy_shell = gs; @@ -263,6 +265,12 @@ ephy_shell_finalize (GObject *object) g_object_unref (G_OBJECT (gs->priv->toolbars_model)); } + LOG ("Unref fullscreen toolbars model") + if (gs->priv->fs_toolbars_model) + { + g_object_unref (G_OBJECT (gs->priv->fs_toolbars_model)); + } + LOG ("Unref session") if (gs->priv->session) { @@ -563,21 +571,38 @@ ephy_shell_get_bookmarks (EphyShell *gs) } GObject * -ephy_shell_get_toolbars_model (EphyShell *gs) +ephy_shell_get_toolbars_model (EphyShell *gs, gboolean fullscreen) { - if (gs->priv->toolbars_model == NULL) + if (fullscreen) { - EphyBookmarks *bookmarks; - - bookmarks = ephy_shell_get_bookmarks (gs); + if (gs->priv->fs_toolbars_model == NULL) + { + const char *xml; - gs->priv->toolbars_model = ephy_toolbars_model_new (bookmarks); + gs->priv->fs_toolbars_model = egg_toolbars_model_new (); + xml = ephy_file ("epiphany-fs-toolbar.xml"); + egg_toolbars_model_load (gs->priv->fs_toolbars_model, xml); + } - g_object_set (bookmarks, "toolbars_model", - gs->priv->toolbars_model, NULL); + return G_OBJECT (gs->priv->fs_toolbars_model); } + else + { + if (gs->priv->toolbars_model == NULL) + { + EphyBookmarks *bookmarks; + + bookmarks = ephy_shell_get_bookmarks (gs); - return G_OBJECT (gs->priv->toolbars_model); + gs->priv->toolbars_model = ephy_toolbars_model_new (bookmarks); + + g_object_set (bookmarks, "toolbars_model", + gs->priv->toolbars_model, NULL); + } + + + return G_OBJECT (gs->priv->toolbars_model); + } } static void diff --git a/src/ephy-shell.h b/src/ephy-shell.h index aad9f3808..6f0f1fd10 100644 --- a/src/ephy-shell.h +++ b/src/ephy-shell.h @@ -97,7 +97,8 @@ GObject *ephy_shell_get_autocompletion (EphyShell *gs); EphyBookmarks *ephy_shell_get_bookmarks (EphyShell *gs); -GObject *ephy_shell_get_toolbars_model (EphyShell *gs); +GObject *ephy_shell_get_toolbars_model (EphyShell *gs, + gboolean fullscreen); void ephy_shell_show_bookmarks_editor (EphyShell *gs, GtkWidget *parent); diff --git a/src/ephy-window.c b/src/ephy-window.c index f64f310be..1c6ebf531 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -42,7 +42,6 @@ #include "ephy-encoding-menu.h" #include "ephy-tabs-menu.h" #include "ephy-stock-icons.h" -#include "ephy-toolbars-model.h" #include "session.h" #include "ephy-favicon-cache.h" @@ -497,14 +496,9 @@ static void ephy_window_fullscreen (EphyWindow *window) { GtkWidget *popup, *button, *icon, *label, *hbox; - EphyToolbarsModel *tmodel; window->priv->is_fullscreen = TRUE; - tmodel = EPHY_TOOLBARS_MODEL - (ephy_shell_get_toolbars_model (ephy_shell)); - ephy_toolbars_model_set_flag (tmodel, EGG_TB_MODEL_ICONS_ONLY); - popup = gtk_window_new (GTK_WINDOW_POPUP); window->priv->exit_fullscreen_popup = popup; @@ -541,14 +535,8 @@ ephy_window_fullscreen (EphyWindow *window) static void ephy_window_unfullscreen (EphyWindow *window) { - EphyToolbarsModel *tmodel; - window->priv->is_fullscreen = FALSE; - tmodel = EPHY_TOOLBARS_MODEL - (ephy_shell_get_toolbars_model (ephy_shell)); - ephy_toolbars_model_unset_flag (tmodel, EGG_TB_MODEL_ICONS_ONLY); - g_signal_handlers_disconnect_by_func (G_OBJECT (gdk_screen_get_default ()), G_CALLBACK (size_changed_cb), window); diff --git a/src/toolbar.c b/src/toolbar.c index dc905c427..326a47f71 100755 --- a/src/toolbar.c +++ b/src/toolbar.c @@ -144,7 +144,7 @@ bookmark_destroy_cb (EphyNode *node, long id; model = EPHY_TOOLBARS_MODEL - (ephy_shell_get_toolbars_model (ephy_shell)); + (ephy_shell_get_toolbars_model (ephy_shell, FALSE)); id = ephy_node_get_id (node); name = ephy_toolbars_model_get_action_name (model, id); @@ -167,7 +167,7 @@ toolbar_ensure_action (Toolbar *t, EphyNode *bmks, *topics; model = EPHY_TOOLBARS_MODEL - (ephy_shell_get_toolbars_model (ephy_shell)); + (ephy_shell_get_toolbars_model (ephy_shell, FALSE)); bookmarks = ephy_shell_get_bookmarks (ephy_shell); bmks = ephy_bookmarks_get_bookmarks (bookmarks); topics = ephy_bookmarks_get_keywords (bookmarks); @@ -373,7 +373,7 @@ init_bookmarks_toolbar (Toolbar *t) int i, n_toolbars; model = EPHY_TOOLBARS_MODEL - (ephy_shell_get_toolbars_model (ephy_shell)); + (ephy_shell_get_toolbars_model (ephy_shell, FALSE)); n_toolbars = egg_toolbars_model_n_toolbars (EGG_TOOLBARS_MODEL (model)); @@ -461,10 +461,61 @@ location_user_changed_cb (GtkWidget *entry, Toolbar *t) } static void -toolbar_set_window (Toolbar *t, EphyWindow *window) +init_normal_mode (Toolbar *t) { EphyToolbarsModel *model; + model = EPHY_TOOLBARS_MODEL + (ephy_shell_get_toolbars_model (ephy_shell, FALSE)); + g_signal_connect (EGG_TOOLBARS_MODEL (model), "toolbar_added", + G_CALLBACK (update_toolbar_remove_flag), + NULL); + g_signal_connect (EGG_TOOLBARS_MODEL (model), "toolbar_removed", + G_CALLBACK (update_toolbar_remove_flag), + NULL); + g_object_set (G_OBJECT (t), + "ToolbarsModel", model, + NULL); + init_bookmarks_toolbar (t); +} + +static void +init_fullscreen_mode (Toolbar *t) +{ + EggToolbarsModel *model; + + model = EGG_TOOLBARS_MODEL + (ephy_shell_get_toolbars_model (ephy_shell, TRUE)); + + g_object_set (G_OBJECT (t), + "ToolbarsModel", model, + NULL); +} + +static gboolean +window_state_event_cb (GtkWidget *widget, GdkEventWindowState *event, Toolbar *t) +{ + if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) + { + gboolean fullscreen; + + fullscreen = event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN; + if (fullscreen) + { + init_fullscreen_mode (t); + } + else + { + init_normal_mode (t); + } + } + + return FALSE; +} + +static void +toolbar_set_window (Toolbar *t, EphyWindow *window) +{ g_return_if_fail (t->priv->window == NULL); t->priv->window = window; @@ -473,24 +524,18 @@ toolbar_set_window (Toolbar *t, EphyWindow *window) toolbar_setup_actions (t); gtk_ui_manager_insert_action_group (t->priv->ui_merge, t->priv->action_group, 1); - g_signal_connect (t, "action_request", G_CALLBACK (action_request_cb), NULL); + g_signal_connect_object (window, "window-state-event", + G_CALLBACK (window_state_event_cb), + t, 0); - model = EPHY_TOOLBARS_MODEL - (ephy_shell_get_toolbars_model (ephy_shell)); - g_signal_connect (EGG_TOOLBARS_MODEL (model), "toolbar_added", - G_CALLBACK (update_toolbar_remove_flag), - NULL); - g_signal_connect (EGG_TOOLBARS_MODEL (model), "toolbar_removed", - G_CALLBACK (update_toolbar_remove_flag), - NULL); g_object_set (G_OBJECT (t), - "ToolbarsModel", model, "MenuMerge", t->priv->ui_merge, NULL); - init_bookmarks_toolbar (t); + + init_normal_mode (t); g_signal_connect_object (get_location_entry (t), "user_changed", G_CALLBACK (location_user_changed_cb), @@ -673,7 +718,7 @@ toolbar_set_visibility (Toolbar *t, int i, n_toolbars; model = EPHY_TOOLBARS_MODEL - (ephy_shell_get_toolbars_model (ephy_shell)); + (ephy_shell_get_toolbars_model (ephy_shell, FALSE)); n_toolbars = egg_toolbars_model_n_toolbars (EGG_TOOLBARS_MODEL (model)); diff --git a/src/toolbar.h b/src/toolbar.h index 1ca62e439..a9d598ae8 100644 --- a/src/toolbar.h +++ b/src/toolbar.h @@ -71,6 +71,7 @@ void toolbar_update_navigation_actions (Toolbar *t, gboolean back, gboolean forward, gboolean up); + void toolbar_update_zoom (Toolbar *t, float zoom); diff --git a/src/window-commands.c b/src/window-commands.c index e922c3dbc..b111ef50f 100644 --- a/src/window-commands.c +++ b/src/window-commands.c @@ -663,7 +663,7 @@ toolbar_editor_response_cb (GtkDialog *dialog, break; case RESPONSE_ADD_TOOLBAR: model = EPHY_TOOLBARS_MODEL - (ephy_shell_get_toolbars_model (ephy_shell)); + (ephy_shell_get_toolbars_model (ephy_shell, FALSE)); n = egg_toolbars_model_n_toolbars (EGG_TOOLBARS_MODEL (model)); egg_toolbars_model_add_toolbar (EGG_TOOLBARS_MODEL (model), n - 1, "UserCreated"); @@ -684,7 +684,7 @@ window_cmd_edit_toolbar (GtkAction *action, GtkWidget *dialog; model = EPHY_TOOLBARS_MODEL - (ephy_shell_get_toolbars_model (ephy_shell)); + (ephy_shell_get_toolbars_model (ephy_shell, FALSE)); t = ephy_window_get_toolbar (window); dialog = gtk_dialog_new (); |