diff options
author | Peter Harvey <peter.a.harvey@gmail.com> | 2006-02-04 18:43:25 +0800 |
---|---|---|
committer | Peter Anthony Harvey <paharvey@src.gnome.org> | 2006-02-04 18:43:25 +0800 |
commit | aa0171e76962bcdc240f3a0b3b25b15855803b7b (patch) | |
tree | 2e7015eca562bed70b63ee6b122887834c6ada9e /src | |
parent | be7c992ff6b3a05d6facf24e42826fe14a94ad89 (diff) | |
download | gsoc2013-epiphany-aa0171e76962bcdc240f3a0b3b25b15855803b7b.tar.gz gsoc2013-epiphany-aa0171e76962bcdc240f3a0b3b25b15855803b7b.tar.zst gsoc2013-epiphany-aa0171e76962bcdc240f3a0b3b25b15855803b7b.zip |
lib/egg/egg-editable-toolbar.c lib/egg/egg-toolbar-editor.c
2006-02-04 Peter Harvey <peter.a.harvey@gmail.com>
* lib/egg/egg-editable-toolbar.c
* lib/egg/egg-toolbar-editor.c
* lib/egg/egg-toolbars-model.c
* lib/egg/egg-toolbars-model.h
* src/bookmarks/ephy-bookmark-factory-action.c
* src/bookmarks/ephy-topic-factory-action.c
* src/ephy-toolbars-model.c
* src/epiphany.defs
Improve the system for testing whether an item has already
been used on the toolbar.
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/ephy-bookmark-factory-action.c | 5 | ||||
-rw-r--r-- | src/bookmarks/ephy-topic-factory-action.c | 5 | ||||
-rwxr-xr-x | src/ephy-toolbars-model.c | 34 | ||||
-rw-r--r-- | src/epiphany.defs | 29 |
4 files changed, 32 insertions, 41 deletions
diff --git a/src/bookmarks/ephy-bookmark-factory-action.c b/src/bookmarks/ephy-bookmark-factory-action.c index 2d3de0c73..2547c8b8f 100644 --- a/src/bookmarks/ephy-bookmark-factory-action.c +++ b/src/bookmarks/ephy-bookmark-factory-action.c @@ -98,7 +98,7 @@ build_menu_for_topic (GtkWidget *placeholder, EggToolbarsModel *model, EphyNode EphyNode *node; GPtrArray *children, *bookmarks; const char *name, *action; - gint i; + gint i, flags; children = ephy_node_get_children (topic); bookmarks = g_ptr_array_sized_new (children->len); @@ -113,7 +113,8 @@ build_menu_for_topic (GtkWidget *placeholder, EggToolbarsModel *model, EphyNode node = g_ptr_array_index (bookmarks, i); action = ephy_bookmark_action_name (node); - if (egg_toolbars_model_get_n_avail (model, action) < 0) + flags = egg_toolbars_model_get_name_flags (model, action); + if (flags & EGG_TB_MODEL_NAME_USED) continue; name = ephy_node_get_property_string (node, EPHY_NODE_BMK_PROP_TITLE); diff --git a/src/bookmarks/ephy-topic-factory-action.c b/src/bookmarks/ephy-topic-factory-action.c index 524a97ae7..44e9e0dd9 100644 --- a/src/bookmarks/ephy-topic-factory-action.c +++ b/src/bookmarks/ephy-topic-factory-action.c @@ -143,7 +143,7 @@ build_menu (GtkWidget *placeholder, EggToolbarsModel *model) GPtrArray *children, *topics; const char *name, *action; - gint i, priority = -1, ptmp; + gint i, priority = -1, ptmp, flags; /* Get a sorted list of topics. */ eb = ephy_shell_get_bookmarks (ephy_shell); @@ -160,7 +160,8 @@ build_menu (GtkWidget *placeholder, EggToolbarsModel *model) node = g_ptr_array_index (topics, i); action = ephy_topic_action_name (node); - if (egg_toolbars_model_get_n_avail (model, action) < 0) + flags = egg_toolbars_model_get_name_flags (model, action); + if (flags & EGG_TB_MODEL_NAME_USED) continue; ptmp = ephy_node_get_property_int (node, EPHY_NODE_KEYWORD_PROP_PRIORITY); diff --git a/src/ephy-toolbars-model.c b/src/ephy-toolbars-model.c index dec18628e..103ebc4c6 100755 --- a/src/ephy-toolbars-model.c +++ b/src/ephy-toolbars-model.c @@ -80,7 +80,7 @@ save_changes_idle (EphyToolbarsModel *model) { LOG ("Saving toolbars model"); - egg_toolbars_model_save + egg_toolbars_model_save_toolbars (EGG_TOOLBARS_MODEL (model), model->priv->xml_file, EPHY_TOOLBARS_XML_VERSION); @@ -182,29 +182,9 @@ ephy_toolbars_model_load (EphyToolbarsModel *model) gboolean success; int i; - egg_toolbars_model_set_n_avail (eggmodel, "NavigationBack", 1); - egg_toolbars_model_set_n_avail (eggmodel, "NavigationForward", 1); - egg_toolbars_model_set_n_avail (eggmodel, "NavigationUp", 1); - egg_toolbars_model_set_n_avail (eggmodel, "ViewStop", 1); - egg_toolbars_model_set_n_avail (eggmodel, "ViewReload", 1); - egg_toolbars_model_set_n_avail (eggmodel, "GoHome", 1); - egg_toolbars_model_set_n_avail (eggmodel, "GoHistory", 1); - egg_toolbars_model_set_n_avail (eggmodel, "GoBookmarks", 1); - egg_toolbars_model_set_n_avail (eggmodel, "FileNewTab", 1); - egg_toolbars_model_set_n_avail (eggmodel, "FileNewWindow", 1); - egg_toolbars_model_set_n_avail (eggmodel, "FileOpen", 1); - egg_toolbars_model_set_n_avail (eggmodel, "FileSaveAs", 1); - egg_toolbars_model_set_n_avail (eggmodel, "FilePrint", 1); - egg_toolbars_model_set_n_avail (eggmodel, "FileBookmarkPage", 1); - egg_toolbars_model_set_n_avail (eggmodel, "ViewFullscreen", 1); - egg_toolbars_model_set_n_avail (eggmodel, "EditFind", 1); - egg_toolbars_model_set_n_avail (eggmodel, "Location", 1); - egg_toolbars_model_set_n_avail (eggmodel, "ToolbarGo", 1); - egg_toolbars_model_set_n_avail (eggmodel, "Zoom", 1); - egg_toolbars_model_set_n_avail (eggmodel, "ViewZoomOut", 1); - egg_toolbars_model_set_n_avail (eggmodel, "ViewZoomIn", 1); + egg_toolbars_model_load_names (eggmodel, ephy_file ("epiphany-toolbar.xml")); - success = egg_toolbars_model_load (eggmodel, model->priv->xml_file); + success = egg_toolbars_model_load_toolbars (eggmodel, model->priv->xml_file); LOG ("Loading the toolbars was %ssuccessful", success ? "" : "un"); /* maybe an old format, try to migrate: load the old layout, and @@ -217,7 +197,7 @@ ephy_toolbars_model_load (EphyToolbarsModel *model) old_xml = g_build_filename (ephy_dot_dir (), "epiphany-toolbars-2.xml", NULL); - success = egg_toolbars_model_load (eggmodel, old_xml); + success = egg_toolbars_model_load_toolbars (eggmodel, old_xml); g_free (old_xml); if (success == TRUE) @@ -225,7 +205,7 @@ ephy_toolbars_model_load (EphyToolbarsModel *model) old_xml = g_build_filename (ephy_dot_dir (), "epiphany-bookmarksbar.xml", NULL); - egg_toolbars_model_load (eggmodel, old_xml); + egg_toolbars_model_load_toolbars (eggmodel, old_xml); g_free (old_xml); } @@ -239,7 +219,7 @@ ephy_toolbars_model_load (EphyToolbarsModel *model) old_xml = g_build_filename (ephy_dot_dir (), "epiphany-toolbars.xml", NULL); - success = egg_toolbars_model_load (eggmodel, old_xml); + success = egg_toolbars_model_load_toolbars (eggmodel, old_xml); g_free (old_xml); LOG ("Migration was %ssuccessful", success ? "" : "un"); @@ -248,7 +228,7 @@ ephy_toolbars_model_load (EphyToolbarsModel *model) /* Still no success, load the default toolbars */ if (success == FALSE) { - success = egg_toolbars_model_load + success = egg_toolbars_model_load_toolbars (eggmodel, ephy_file ("epiphany-toolbar.xml")); LOG ("Loading the default toolbars was %ssuccessful", success ? "" : "un"); } diff --git a/src/epiphany.defs b/src/epiphany.defs index 9d0b81adb..33157fe16 100644 --- a/src/epiphany.defs +++ b/src/epiphany.defs @@ -1619,18 +1619,27 @@ ; (return-type "EggToolbarsModel*") ;) -(define-method load +(define-method load_names (of-object "EggToolbarsModel") - (c-name "egg_toolbars_model_load") + (c-name "egg_toolbars_model_load_names") (return-type "gboolean") (parameters '("const-char*" "xml_file") ) ) -(define-method save +(define-method load_toolbars + (of-object "EggToolbarsModel") + (c-name "egg_toolbars_model_load_toolbars") + (return-type "gboolean") + (parameters + '("const-char*" "xml_file") + ) +) + +(define-method save_toolbars (of-object "EggToolbarsModel") - (c-name "egg_toolbars_model_save") + (c-name "egg_toolbars_model_save_toolbars") (return-type "none") (parameters '("const-char*" "xml_file") @@ -1676,24 +1685,24 @@ ; ) ;) -(define-method get_avail +(define-method get_name_avail (of-object "EggToolbarsModel") - (c-name "egg_toolbars_model_get_avail") + (c-name "egg_toolbars_model_get_name_avail") (return-type "GPtrArray*") ) -(define-method get_n_avail +(define-method get_name_flags (of-object "EggToolbarsModel") - (c-name "egg_toolbars_model_get_n_avail") + (c-name "egg_toolbars_model_get_name_flags") (return-type "gint") (parameters '("const-char*" "name") ) ) -(define-method set_n_avail +(define-method set_name_flags (of-object "EggToolbarsModel") - (c-name "egg_toolbars_model_set_n_avail") + (c-name "egg_toolbars_model_set_name_flags") (return-type "none") (parameters '("const-char*" "name") |