aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Harvey <peter.a.harvey@gmail.com>2006-02-21 21:44:16 +0800
committerPeter Anthony Harvey <paharvey@src.gnome.org>2006-02-21 21:44:16 +0800
commitc66ab87ed9b35bfafa1ad6aba79419d153e29de7 (patch)
treeb79583242bc9e7387724f658f061fb687c0bc8fb
parent6dd4bf1e1ebfee184ebfa38781ab6418c42e652a (diff)
downloadgsoc2013-epiphany-c66ab87ed9b35bfafa1ad6aba79419d153e29de7.tar
gsoc2013-epiphany-c66ab87ed9b35bfafa1ad6aba79419d153e29de7.tar.gz
gsoc2013-epiphany-c66ab87ed9b35bfafa1ad6aba79419d153e29de7.tar.bz2
gsoc2013-epiphany-c66ab87ed9b35bfafa1ad6aba79419d153e29de7.tar.lz
gsoc2013-epiphany-c66ab87ed9b35bfafa1ad6aba79419d153e29de7.tar.xz
gsoc2013-epiphany-c66ab87ed9b35bfafa1ad6aba79419d153e29de7.tar.zst
gsoc2013-epiphany-c66ab87ed9b35bfafa1ad6aba79419d153e29de7.zip
data/ui/epiphany-fs-toolbar.xml lib/egg/egg-toolbars-model.c
2006-02-21 Peter Harvey <peter.a.harvey@gmail.com> * data/ui/epiphany-fs-toolbar.xml * lib/egg/egg-toolbars-model.c * lib/egg/egg-toolbars-model.h Added "editable" attribute for toolbars. * data/ui/epiphany-ui.xml * lib/egg/egg-editable-toolbar.c * lib/egg/egg-editable-toolbar.h * src/ephy-toolbar.c * src/ephy-window.c Many improvements to toolbar menus. Includes changes to show visibility toggles in multiple locations. * lib/ephy-stock-icons.c * lib/ephy-stock-icons.h Additional stock icon for drag and drop. * src/bookmarks/ephy-bookmarks-ui.c Make 'customize toolbar' invisible when editing. * src/ephy-shell.c Mark the full-screen toolbar as non-removable.
-rw-r--r--ChangeLog31
-rw-r--r--data/ui/epiphany-fs-toolbar.xml2
-rw-r--r--data/ui/epiphany-ui.xml18
-rwxr-xr-xlib/egg/egg-editable-toolbar.c235
-rwxr-xr-xlib/egg/egg-editable-toolbar.h3
-rwxr-xr-xlib/egg/egg-toolbars-model.c7
-rwxr-xr-xlib/egg/egg-toolbars-model.h15
-rw-r--r--lib/ephy-stock-icons.c1
-rw-r--r--lib/ephy-stock-icons.h1
-rw-r--r--src/bookmarks/ephy-bookmarks-ui.c29
-rw-r--r--src/ephy-shell.c7
-rwxr-xr-xsrc/ephy-toolbar.c20
-rw-r--r--src/ephy-window.c12
13 files changed, 264 insertions, 117 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ae679267..ea511c4c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,36 @@
2006-02-21 Peter Harvey <peter.a.harvey@gmail.com>
+ * data/ui/epiphany-fs-toolbar.xml
+ * lib/egg/egg-toolbars-model.c
+ * lib/egg/egg-toolbars-model.h
+
+ Added "editable" attribute for toolbars.
+
+ * data/ui/epiphany-ui.xml
+ * lib/egg/egg-editable-toolbar.c
+ * lib/egg/egg-editable-toolbar.h
+ * src/ephy-toolbar.c
+ * src/ephy-window.c
+
+ Many improvements to toolbar menus. Includes
+ changes to show visibility toggles in multiple
+ locations.
+
+ * lib/ephy-stock-icons.c
+ * lib/ephy-stock-icons.h
+
+ Additional stock icon for drag and drop.
+
+ * src/bookmarks/ephy-bookmarks-ui.c
+
+ Make 'customize toolbar' invisible when editing.
+
+ * src/ephy-shell.c
+
+ Mark the full-screen toolbar as non-removable.
+
+2006-02-21 Peter Harvey <peter.a.harvey@gmail.com>
+
* src/bookmarks/ephy-bookmarks-menu.c
* src/bookmarks/ephy-nodes-cover.c
diff --git a/data/ui/epiphany-fs-toolbar.xml b/data/ui/epiphany-fs-toolbar.xml
index 67ca03ff4..db1648422 100644
--- a/data/ui/epiphany-fs-toolbar.xml
+++ b/data/ui/epiphany-fs-toolbar.xml
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<toolbars version="1.0">
-<toolbar name="Toolbar" style="icons-only">
+<toolbar name="Toolbar" style="icons-only" editable="false">
<toolitem name="NavigationBack"/>
<toolitem name="NavigationForward"/>
<toolitem name="ViewStop"/>
diff --git a/data/ui/epiphany-ui.xml b/data/ui/epiphany-ui.xml
index 45a520e34..4887cbb07 100644
--- a/data/ui/epiphany-ui.xml
+++ b/data/ui/epiphany-ui.xml
@@ -38,9 +38,13 @@
<menu name="ViewMenu" action="View">
<placeholder name="ViewTogglesGroup" position="top">
<menu name="ToolbarMenu" action="Toolbar">
- <menuitem name="ViewToolbarEditorMenu" action="ViewToolbarEditor"/>
+ <separator/>
+ <placeholder name="ViewToolbarsGroup" position="top">
+ </placeholder>
+ <separator/>
<menuitem name="ViewToolbarMenu" action="ViewToolbar"/>
- <separator name="ToolbarSep1"/>
+ <menuitem name="ViewToolbarEditorMenu" action="ViewToolbarEditor"/>
+ <separator/>
</menu>
<menuitem name="ViewStatusbarMenu" action="ViewStatusbar"/>
</placeholder>
@@ -169,6 +173,16 @@
</popup>
<popup name="ToolbarPopup">
+ <placeholder name="SpecificItemsGroup">
+ </placeholder>
+ <separator/>
+ <menuitem action="MoveToolItem"/>
+ <menuitem action="RemoveToolItem"/>
+ <separator/>
+ <menuitem action="RemoveToolbar"/>
+ <separator/>
+ <placeholder name="ViewToolbarsGroup">
+ </placeholder>
<separator/>
<menuitem action="ViewToolbarEditor"/>
<separator/>
diff --git a/lib/egg/egg-editable-toolbar.c b/lib/egg/egg-editable-toolbar.c
index 42fa32ee3..e0d87be9c 100755
--- a/lib/egg/egg-editable-toolbar.c
+++ b/lib/egg/egg-editable-toolbar.c
@@ -52,6 +52,7 @@ static void egg_editable_toolbar_init (EggEditableToolbar *etoolbar);
#define MIN_TOOLBAR_HEIGHT 20
#define EGG_ITEM_NAME "egg-item-name"
+#define STOCK_DRAG_MODE "stock_drag-mode"
static const GtkTargetEntry dest_drag_types[] = {
{EGG_TOOLBAR_ITEM_TYPE, GTK_TARGET_SAME_APP, 0},
@@ -62,8 +63,9 @@ enum
PROP_0,
PROP_TOOLBARS_MODEL,
PROP_UI_MANAGER,
- PROP_VISIBILITY_PATH,
- PROP_SELECTED
+ PROP_POPUP_PATH,
+ PROP_SELECTED,
+ PROP_EDIT_MODE
};
enum
@@ -88,12 +90,13 @@ struct _EggEditableToolbarPrivate
GtkWidget *selected;
GtkActionGroup *actions;
- guint popup_id;
guint visibility_id;
- char *visibility_path;
+ GList *visibility_paths;
GPtrArray *visibility_actions;
+ char *popup_path;
+
guint dnd_pending;
GtkToolbar *dnd_toolbar;
GtkToolItem *dnd_toolitem;
@@ -369,20 +372,34 @@ remove_toolbar_cb (GtkAction *action,
}
static void
+popup_context_deactivate (GtkMenuShell *menu,
+ EggEditableToolbar *etoolbar)
+{
+ egg_editable_toolbar_set_selected (etoolbar, NULL);
+ g_object_notify (G_OBJECT (etoolbar), "selected");
+}
+
+static void
popup_context_menu_cb (GtkWidget *toolbar,
gint x,
gint y,
gint button_number,
EggEditableToolbar *etoolbar)
{
- if (etoolbar->priv->popup_id != 0)
+ if (etoolbar->priv->popup_path != NULL)
{
GtkMenu *menu;
+
egg_editable_toolbar_set_selected (etoolbar, toolbar);
g_object_notify (G_OBJECT (etoolbar), "selected");
-
- menu = GTK_MENU (gtk_ui_manager_get_widget (etoolbar->priv->manager, "/ToolbarPopup"));
+
+ menu = GTK_MENU (gtk_ui_manager_get_widget (etoolbar->priv->manager,
+ etoolbar->priv->popup_path));
+ g_return_if_fail (menu != NULL);
gtk_menu_popup (menu, NULL, NULL, NULL, NULL, button_number, gtk_get_current_event_time ());
+ g_signal_connect_object (menu, "selection-done",
+ G_CALLBACK (popup_context_deactivate),
+ etoolbar, 0);
}
}
@@ -391,14 +408,20 @@ button_press_event_cb (GtkWidget *widget,
GdkEventButton *event,
EggEditableToolbar *etoolbar)
{
- if (event->button == 3 && etoolbar->priv->popup_id != 0)
+ if (event->button == 3 && etoolbar->priv->popup_path != NULL)
{
GtkMenu *menu;
+
egg_editable_toolbar_set_selected (etoolbar, widget);
g_object_notify (G_OBJECT (etoolbar), "selected");
- menu = GTK_MENU (gtk_ui_manager_get_widget (etoolbar->priv->manager, "/ToolbarPopup"));
+ menu = GTK_MENU (gtk_ui_manager_get_widget (etoolbar->priv->manager,
+ etoolbar->priv->popup_path));
+ g_return_val_if_fail (menu != NULL, FALSE);
gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, event->time);
+ g_signal_connect_object (menu, "selection-done",
+ G_CALLBACK (popup_context_deactivate),
+ etoolbar, 0);
return TRUE;
}
@@ -752,7 +775,7 @@ toggled_visibility_cb (GtkToggleAction *action,
gboolean visible;
gint i;
- visible = !gtk_toggle_action_get_active (action);
+ visible = gtk_toggle_action_get_active (action);
for (i = 0; i < priv->visibility_actions->len; i++)
if (g_ptr_array_index (priv->visibility_actions, i) == action)
break;
@@ -792,13 +815,14 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar)
EggEditableToolbarPrivate *priv = etoolbar->priv;
gint n_toolbars, n_items, i, j, k;
GtkToggleAction *action;
+ GList *list;
GString *string;
char action_name[40];
char *action_label;
char *tmp;
if (priv == NULL || priv->model == NULL || priv->manager == NULL ||
- priv->visibility_path == NULL || priv->actions == NULL)
+ priv->visibility_paths == NULL || priv->actions == NULL)
{
return;
}
@@ -843,7 +867,7 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar)
if (j > 0)
{
g_string_append (string, ", ");
- if (k > 25)
+ if (j > 1 && k > 25)
{
g_value_unset (&value);
break;
@@ -865,7 +889,7 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar)
k++;
}
tmp[k] = 0;
- action_label = g_strdup_printf (_("Hide ā€œ%sā€"), tmp);
+ action_label = g_strdup_printf (_("Show ā€œ_%sā€"), tmp);
g_free (tmp);
sprintf(action_name, "ToolbarToggle%d", i);
@@ -884,13 +908,18 @@ toolbar_visibility_refresh (EggEditableToolbar *etoolbar)
action = g_ptr_array_index (priv->visibility_actions, i);
g_object_set (action, "label", action_label, NULL);
}
-
- gtk_toggle_action_set_active (action, !GTK_WIDGET_VISIBLE
+
+ gtk_action_set_visible (GTK_ACTION (action), (egg_toolbars_model_get_flags (priv->model, i)
+ & EGG_TB_MODEL_NOT_REMOVABLE) == 0);
+ gtk_toggle_action_set_active (action, GTK_WIDGET_VISIBLE
(get_dock_nth (etoolbar, i)));
- gtk_ui_manager_add_ui (priv->manager, priv->visibility_id,
- priv->visibility_path, action_name, action_name,
- GTK_UI_MANAGER_MENUITEM, FALSE);
+ for (list = priv->visibility_paths; list != NULL; list = g_list_next (list))
+ {
+ gtk_ui_manager_add_ui (priv->manager, priv->visibility_id,
+ (const char *)list->data, action_name, action_name,
+ GTK_UI_MANAGER_MENUITEM, FALSE);
+ }
g_free (action_label);
}
@@ -1222,6 +1251,10 @@ egg_editable_toolbar_deconstruct (EggEditableToolbar *toolbar)
children = gtk_container_get_children (GTK_CONTAINER (toolbar));
g_list_foreach (children, (GFunc) gtk_widget_destroy, NULL);
g_list_free (children);
+
+ children = toolbar->priv->visibility_paths;
+ g_list_foreach (children, (GFunc) g_free, NULL);
+ g_list_free (children);
}
void
@@ -1301,11 +1334,11 @@ egg_editable_toolbar_set_ui_manager (EggEditableToolbar *etoolbar,
GtkUIManager *manager)
{
static const GtkActionEntry actions[] = {
- { "MoveToolItem", NULL, N_("_Move on Toolbar"), NULL,
+ { "MoveToolItem", STOCK_DRAG_MODE, N_("_Move on Toolbar"), NULL,
N_("Move the selected item on the toolbar"), G_CALLBACK (move_item_cb) },
{ "RemoveToolItem", GTK_STOCK_REMOVE, N_("_Remove from Toolbar"), NULL,
N_("Remove the selected item from the toolbar"), G_CALLBACK (remove_item_cb) },
- { "RemoveToolbar", GTK_STOCK_REMOVE, N_("_Remove Toolbar"), NULL,
+ { "RemoveToolbar", GTK_STOCK_DELETE, N_("_Delete Toolbar"), NULL,
N_("Remove the selected toolbar"), G_CALLBACK (remove_toolbar_cb) },
};
@@ -1318,13 +1351,6 @@ egg_editable_toolbar_set_ui_manager (EggEditableToolbar *etoolbar,
gtk_ui_manager_insert_action_group (manager, etoolbar->priv->actions, -1);
g_object_unref (etoolbar->priv->actions);
- etoolbar->priv->popup_id = gtk_ui_manager_add_ui_from_string (manager,
- "<popup name=\"ToolbarPopup\">"
- "<menuitem action=\"MoveToolItem\"/>"
- "<menuitem action=\"RemoveToolItem\"/>"
- "<menuitem action=\"RemoveToolbar\"/>"
- "</popup>", -1, NULL);
-
toolbar_visibility_refresh (etoolbar);
}
@@ -1337,18 +1363,75 @@ void
egg_editable_toolbar_set_selected (EggEditableToolbar *etoolbar,
GtkWidget *widget)
{
- gboolean toolitem, toolbar;
+ GtkWidget *toolbar, *toolitem;
+ gboolean editable;
etoolbar->priv->selected = widget;
- toolitem = (gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM) != 0);
- toolbar = (gtk_widget_get_ancestor (widget, GTK_TYPE_TOOLBAR) != 0);
+ toolbar = (widget != NULL) ? gtk_widget_get_ancestor (widget, GTK_TYPE_TOOLBAR) : NULL;
+ toolitem = (widget != NULL) ? gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM) : NULL;
- gtk_action_set_visible (find_action (etoolbar, "RemoveToolbar"), toolbar && (etoolbar->priv->edit_mode > 0));
- gtk_action_set_visible (find_action (etoolbar, "RemoveToolItem"), toolitem);
- gtk_action_set_visible (find_action (etoolbar, "MoveToolItem"), toolitem);
+ if(toolbar != NULL)
+ {
+ gint tpos = get_toolbar_position (etoolbar, toolbar);
+ editable = ((egg_toolbars_model_get_flags (etoolbar->priv->model, tpos) & EGG_TB_MODEL_NOT_EDITABLE) == 0);
+ }
+ else
+ {
+ editable = FALSE;
+ }
- toolbar_visibility_refresh (etoolbar);
+ gtk_action_set_visible (find_action (etoolbar, "RemoveToolbar"), (toolbar != NULL) && (etoolbar->priv->edit_mode > 0));
+ gtk_action_set_visible (find_action (etoolbar, "RemoveToolItem"), (toolitem != NULL) && editable);
+ gtk_action_set_visible (find_action (etoolbar, "MoveToolItem"), (toolitem != NULL) && editable);
+}
+
+static void
+set_edit_mode (EggEditableToolbar *etoolbar,
+ gboolean mode)
+{
+ EggEditableToolbarPrivate *priv = etoolbar->priv;
+ int i, l, n_items;
+
+ i = priv->edit_mode;
+ if (mode)
+ {
+ priv->edit_mode++;
+ }
+ else
+ {
+ g_return_if_fail (priv->edit_mode > 0);
+ priv->edit_mode--;
+ }
+ i *= priv->edit_mode;
+
+ if (i == 0)
+ {
+ for (i = get_n_toolbars (etoolbar)-1; i >= 0; i--)
+ {
+ GtkWidget *toolbar;
+
+ toolbar = get_toolbar_nth (etoolbar, i);
+ n_items = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar));
+
+ if (n_items == 0 && priv->edit_mode == 0)
+ {
+ egg_toolbars_model_remove_toolbar (priv->model, i);
+ }
+ else
+ {
+ for (l = 0; l < n_items; l++)
+ {
+ GtkToolItem *item;
+
+ item = gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), l);
+
+ configure_item_cursor (item, etoolbar);
+ configure_item_sensitivity (item, etoolbar);
+ }
+ }
+ }
+ }
}
static void
@@ -1370,8 +1453,11 @@ egg_editable_toolbar_set_property (GObject *object,
case PROP_SELECTED:
egg_editable_toolbar_set_selected (etoolbar, g_value_get_object (value));
break;
- case PROP_VISIBILITY_PATH:
- etoolbar->priv->visibility_path = g_strdup (g_value_get_string (value));
+ case PROP_POPUP_PATH:
+ etoolbar->priv->popup_path = g_strdup (g_value_get_string (value));
+ break;
+ case PROP_EDIT_MODE:
+ set_edit_mode (etoolbar, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -1398,6 +1484,9 @@ egg_editable_toolbar_get_property (GObject *object,
case PROP_SELECTED:
g_value_set_object (value, etoolbar->priv->selected);
break;
+ case PROP_EDIT_MODE:
+ g_value_set_boolean (value, etoolbar->priv->edit_mode>0);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1446,35 +1535,43 @@ egg_editable_toolbar_class_init (EggEditableToolbarClass *klass)
G_PARAM_READABLE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_object_class_install_property (object_class,
- PROP_VISIBILITY_PATH,
- g_param_spec_string ("visibility-path",
- "visibility-path",
- "visibility-path",
+ PROP_POPUP_PATH,
+ g_param_spec_string ("popup-path",
+ "popup-path",
+ "popup-path",
NULL,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+ g_object_class_install_property (object_class,
+ PROP_EDIT_MODE,
+ g_param_spec_boolean ("edit-mode",
+ "Edit-Mode",
+ "Edit Mode",
+ FALSE,
+ G_PARAM_READWRITE | G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
+
g_type_class_add_private (object_class, sizeof (EggEditableToolbarPrivate));
}
GtkWidget *
egg_editable_toolbar_new (GtkUIManager *manager,
- const char *visibility_path)
+ const char *popup_path)
{
return GTK_WIDGET (g_object_new (EGG_TYPE_EDITABLE_TOOLBAR,
"ui-manager", manager,
- "visibility-path", visibility_path,
+ "popup-path", popup_path,
NULL));
}
GtkWidget *
egg_editable_toolbar_new_with_model (GtkUIManager *manager,
EggToolbarsModel *model,
- const char *visibility_path)
+ const char *popup_path)
{
return GTK_WIDGET (g_object_new (EGG_TYPE_EDITABLE_TOOLBAR,
"ui-manager", manager,
"model", model,
- "visibility-path", visibility_path,
+ "popup-path", popup_path,
NULL));
}
@@ -1490,48 +1587,16 @@ void
egg_editable_toolbar_set_edit_mode (EggEditableToolbar *etoolbar,
gboolean mode)
{
- EggEditableToolbarPrivate *priv = etoolbar->priv;
- int i, l, n_items;
-
- i = priv->edit_mode;
- if (mode)
- {
- priv->edit_mode++;
- }
- else
- {
- g_return_if_fail (priv->edit_mode > 0);
- priv->edit_mode--;
- }
- i *= priv->edit_mode;
-
- if (i == 0)
- {
- for (i = get_n_toolbars (etoolbar)-1; i >= 0; i--)
- {
- GtkWidget *toolbar;
-
- toolbar = get_toolbar_nth (etoolbar, i);
- n_items = gtk_toolbar_get_n_items (GTK_TOOLBAR (toolbar));
+ set_edit_mode (etoolbar, mode);
+ g_object_notify (G_OBJECT (etoolbar), "edit-mode");
+}
- if (n_items == 0 && priv->edit_mode == 0)
- {
- egg_toolbars_model_remove_toolbar (priv->model, i);
- }
- else
- {
- for (l = 0; l < n_items; l++)
- {
- GtkToolItem *item;
-
- item = gtk_toolbar_get_nth_item (GTK_TOOLBAR (toolbar), l);
-
- configure_item_cursor (item, etoolbar);
- configure_item_sensitivity (item, etoolbar);
- }
- }
- }
- }
+void
+egg_editable_toolbar_add_visibility (EggEditableToolbar *etoolbar,
+ const char *path)
+{
+ etoolbar->priv->visibility_paths = g_list_prepend
+ (etoolbar->priv->visibility_paths, g_strdup (path));
}
void
diff --git a/lib/egg/egg-editable-toolbar.h b/lib/egg/egg-editable-toolbar.h
index 36b89a305..8a4e85e71 100755
--- a/lib/egg/egg-editable-toolbar.h
+++ b/lib/egg/egg-editable-toolbar.h
@@ -84,6 +84,9 @@ GtkWidget * egg_editable_toolbar_get_selected (EggEditableToolbar *
void egg_editable_toolbar_set_selected (EggEditableToolbar *etoolbar,
GtkWidget *widget);
+void egg_editable_toolbar_add_visibility (EggEditableToolbar *etoolbar,
+ const char *path);
+
/* Private Functions */
GtkWidget *_egg_editable_toolbar_new_separator_image (void);
diff --git a/lib/egg/egg-toolbars-model.c b/lib/egg/egg-toolbars-model.c
index 3162c304a..f0a5b0fa0 100755
--- a/lib/egg/egg-toolbars-model.c
+++ b/lib/egg/egg-toolbars-model.c
@@ -123,6 +123,8 @@ egg_toolbars_model_to_xml (EggToolbarsModel *model)
xmlSetProp (tnode, (const xmlChar*) "name", (const xmlChar*) toolbar->name);
xmlSetProp (tnode, (const xmlChar*) "hidden",
(toolbar->flags&EGG_TB_MODEL_HIDDEN) ? (const xmlChar*) "true" : (const xmlChar*) "false");
+ xmlSetProp (tnode, (const xmlChar*) "editable",
+ (toolbar->flags&EGG_TB_MODEL_NOT_EDITABLE) ? (const xmlChar*) "false" : (const xmlChar*) "true");
for (l2 = l1->children; l2 != NULL; l2 = l2->next)
{
@@ -588,6 +590,11 @@ parse_toolbars (EggToolbarsModel *model,
flags = egg_toolbars_model_get_flags (model, position);
xmlFree (string);
+ string = xmlGetProp (child, (const xmlChar*) "editable");
+ if (string && xmlStrEqual (string, (const xmlChar*) "false"))
+ flags |= EGG_TB_MODEL_NOT_EDITABLE;
+ xmlFree (string);
+
string = xmlGetProp (child, (const xmlChar*) "hidden");
if (string && xmlStrEqual (string, (const xmlChar*) "true"))
flags |= EGG_TB_MODEL_HIDDEN;
diff --git a/lib/egg/egg-toolbars-model.h b/lib/egg/egg-toolbars-model.h
index 415328948..6961ee4ec 100755
--- a/lib/egg/egg-toolbars-model.h
+++ b/lib/egg/egg-toolbars-model.h
@@ -43,13 +43,14 @@ typedef struct EggToolbarsModelClass EggToolbarsModelClass;
typedef enum
{
EGG_TB_MODEL_NOT_REMOVABLE = 1 << 0,
- EGG_TB_MODEL_BOTH = 1 << 1,
- EGG_TB_MODEL_BOTH_HORIZ = 1 << 2,
- EGG_TB_MODEL_ICONS = 1 << 3,
- EGG_TB_MODEL_TEXT = 1 << 4,
- EGG_TB_MODEL_STYLES_MASK = 0x1F,
- EGG_TB_MODEL_ACCEPT_ITEMS_ONLY = 1 << 5,
- EGG_TB_MODEL_HIDDEN = 1 << 6
+ EGG_TB_MODEL_NOT_EDITABLE = 1 << 1,
+ EGG_TB_MODEL_BOTH = 1 << 2,
+ EGG_TB_MODEL_BOTH_HORIZ = 1 << 3,
+ EGG_TB_MODEL_ICONS = 1 << 4,
+ EGG_TB_MODEL_TEXT = 1 << 5,
+ EGG_TB_MODEL_STYLES_MASK = 0x3C,
+ EGG_TB_MODEL_ACCEPT_ITEMS_ONLY = 1 << 6,
+ EGG_TB_MODEL_HIDDEN = 1 << 7
} EggTbModelFlags;
typedef enum
diff --git a/lib/ephy-stock-icons.c b/lib/ephy-stock-icons.c
index 80fb3a5a2..119206b17 100644
--- a/lib/ephy-stock-icons.c
+++ b/lib/ephy-stock-icons.c
@@ -48,6 +48,7 @@ ephy_stock_icons_init (void)
STOCK_LOCK_INSECURE,
STOCK_LOCK_SECURE,
STOCK_LOCK_BROKEN,
+ STOCK_DRAG_MODE,
};
static const GtkStockItem items[] =
diff --git a/lib/ephy-stock-icons.h b/lib/ephy-stock-icons.h
index 73e74b3e1..b90a58bea 100644
--- a/lib/ephy-stock-icons.h
+++ b/lib/ephy-stock-icons.h
@@ -38,6 +38,7 @@ G_BEGIN_DECLS
#define STOCK_LOCK_INSECURE "stock_lock-open"
#define STOCK_LOCK_SECURE "stock_lock"
#define STOCK_LOCK_BROKEN "stock_lock-broken"
+#define STOCK_DRAG_MODE "stock_drag-mode"
void ephy_stock_icons_init (void);
diff --git a/src/bookmarks/ephy-bookmarks-ui.c b/src/bookmarks/ephy-bookmarks-ui.c
index 2baeb7167..93ff1425b 100644
--- a/src/bookmarks/ephy-bookmarks-ui.c
+++ b/src/bookmarks/ephy-bookmarks-ui.c
@@ -161,12 +161,19 @@ selected_bookmark_action (EggEditableToolbar *etoolbar,
{
GtkAction *baction;
GtkWidget *widget;
-
- widget = gtk_widget_get_ancestor (egg_editable_toolbar_get_selected (etoolbar),
- GTK_TYPE_TOOL_ITEM);
- baction = widget ? g_object_get_data (G_OBJECT (widget), "gtk-action") : NULL;
-
- gtk_action_set_visible (action, EPHY_IS_BOOKMARK_ACTION (baction));
+ gboolean visible;
+
+ visible = FALSE;
+
+ if (!egg_editable_toolbar_get_edit_mode (etoolbar))
+ {
+ widget = egg_editable_toolbar_get_selected (etoolbar);
+ widget = widget ? gtk_widget_get_ancestor (widget, GTK_TYPE_TOOL_ITEM) : NULL;
+ baction = widget ? g_object_get_data (G_OBJECT (widget), "gtk-action") : NULL;
+ visible = EPHY_IS_BOOKMARK_ACTION (baction);
+ }
+
+ gtk_action_set_visible (action, visible);
}
static void
@@ -287,7 +294,7 @@ ephy_bookmarks_ui_attach_window (EphyWindow *window)
g_object_unref (action);
/* Add popup menu actions that are specific to the bookmark widgets */
- action = gtk_action_new ("ToolbarBookmarkProperties", _("Properties"),
+ action = gtk_action_new ("ToolbarBookmarkProperties", _("_Properties"),
_("Show properties for this bookmark"), GTK_STOCK_PROPERTIES);
g_signal_connect_object (action, "activate",
G_CALLBACK (activate_bookmark_properties),
@@ -300,7 +307,7 @@ ephy_bookmarks_ui_attach_window (EphyWindow *window)
/* FIXME ngettext */
action = gtk_action_new ("ToolbarBookmarkOpenInTab", _("Open in New _Tab"),
- _("Open this bookmark in a new tab"), NULL);
+ _("Open this bookmark in a new tab"), STOCK_NEW_TAB);
g_signal_connect_object (action, "activate",
G_CALLBACK (activate_bookmark_open_tab),
G_OBJECT (etoolbar), 0);
@@ -312,7 +319,7 @@ ephy_bookmarks_ui_attach_window (EphyWindow *window)
/* FIXME ngettext */
action = gtk_action_new ("ToolbarBookmarkOpenInWindow", _("Open in New _Window"),
- _("Open this bookmark in a new window"), NULL);
+ _("Open this bookmark in a new window"), GTK_STOCK_NEW);
g_signal_connect_object (action, "activate",
G_CALLBACK (activate_bookmark_open_window),
G_OBJECT (etoolbar), 0);
@@ -324,11 +331,11 @@ ephy_bookmarks_ui_attach_window (EphyWindow *window)
data->toolbar_menu = gtk_ui_manager_add_ui_from_string (manager,
"<popup name=\"ToolbarPopup\">"
- "<separator/>"
+ "<placeholder name=\"SpecificItemsGroup\">"
"<menuitem action=\"ToolbarBookmarkOpenInTab\"/>"
"<menuitem action=\"ToolbarBookmarkOpenInWindow\"/>"
- "<separator/>"
"<menuitem action=\"ToolbarBookmarkProperties\"/>"
+ "</placeholder>"
"</popup>", -1, NULL);
/* Add signal handlers for the bookmark database */
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 5af43c5a0..3938d5eb2 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -668,6 +668,7 @@ ephy_shell_get_toolbars_model (EphyShell *shell, gboolean fullscreen)
{
if (shell->priv->fs_toolbars_model == NULL)
{
+ EggTbModelFlags flags;
gboolean success;
const char *xml;
@@ -678,6 +679,12 @@ ephy_shell_get_toolbars_model (EphyShell *shell, gboolean fullscreen)
success = egg_toolbars_model_load_toolbars
(shell->priv->fs_toolbars_model, xml);
g_return_val_if_fail (success, NULL);
+
+ flags = egg_toolbars_model_get_flags
+ (shell->priv->fs_toolbars_model, 0);
+ egg_toolbars_model_set_flags
+ (shell->priv->fs_toolbars_model, 0,
+ flags | EGG_TB_MODEL_NOT_REMOVABLE);
}
return G_OBJECT (shell->priv->fs_toolbars_model);
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index f69d25a3c..2524764bd 100755
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -736,9 +736,19 @@ ephy_toolbar_get_type (void)
EphyToolbar *
ephy_toolbar_new (EphyWindow *window)
{
- return EPHY_TOOLBAR (g_object_new (EPHY_TYPE_TOOLBAR,
- "window", window,
- "ui-manager", ephy_window_get_ui_manager (window),
- "visibility-path", "/menubar/ViewMenu/ViewTogglesGroup/ToolbarMenu",
- NULL));
+ EggEditableToolbar *etoolbar;
+
+ etoolbar = EGG_EDITABLE_TOOLBAR
+ (g_object_new (EPHY_TYPE_TOOLBAR,
+ "window", window,
+ "ui-manager", ephy_window_get_ui_manager (window),
+ "popup-path", "/ToolbarPopup",
+ NULL));
+
+ egg_editable_toolbar_add_visibility
+ (etoolbar, "/menubar/ViewMenu/ViewTogglesGroup/ToolbarMenu/ViewToolbarsGroup");
+ egg_editable_toolbar_add_visibility
+ (etoolbar, "/ToolbarPopup/ViewToolbarsGroup");
+
+ return EPHY_TOOLBAR (etoolbar);
}
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 06e0767c3..0bddd0f2c 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -280,9 +280,9 @@ static const GtkToggleActionEntry ephy_menu_toggle_entries [] =
/* View Menu */
- { "ViewToolbar", NULL, N_("_Show Toolbars"), "<shift><control>T",
+ { "ViewToolbar", NULL, N_("_Hide Toolbars"), "<shift><control>T",
N_("Show or hide toolbar"),
- G_CALLBACK (ephy_window_view_toolbar_cb), TRUE },
+ G_CALLBACK (ephy_window_view_toolbar_cb), FALSE },
{ "ViewStatusbar", NULL, N_("St_atusbar"), NULL,
N_("Show or hide statusbar"),
G_CALLBACK (ephy_window_view_statusbar_cb), TRUE },
@@ -674,7 +674,7 @@ ephy_window_fullscreen (EphyWindow *window)
ephy_toolbar_set_show_leave_fullscreen (window->priv->toolbar,
!lockdown_fs);
-
+
sync_chromes_visibility (window);
}
@@ -1228,7 +1228,7 @@ update_chromes_actions (EphyWindow *window)
g_signal_handlers_block_by_func (G_OBJECT (action),
G_CALLBACK (ephy_window_view_toolbar_cb),
window);
- gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), show_toolbar);
+ gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), !show_toolbar);
g_signal_handlers_unblock_by_func (G_OBJECT (action),
G_CALLBACK (ephy_window_view_toolbar_cb),
window);
@@ -3652,8 +3652,8 @@ sync_chrome_with_view_toggle (GtkAction *action, EphyWindow *window,
gboolean active;
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- window->priv->chrome = active ? window->priv->chrome | chrome_flag :
- window->priv->chrome & (~chrome_flag);
+ window->priv->chrome = active ? window->priv->chrome & (~chrome_flag) :
+ window->priv->chrome | chrome_flag;
sync_chromes_visibility (window);
sync_prefs_with_chrome (window);