+static EggToolbarsModel *
+get_toolbars_model (void)
+{
+ EggToolbarsModel *toolbars_model;
+ gchar *toolbars_file;
+ gchar *toolbars_path;
+ gint i;
+
+ toolbars_model = egg_toolbars_model_new ();
+
+ toolbars_file = g_build_filename (ev_application_get_dot_dir (EV_APP, FALSE),
+ "evince_toolbar.xml", NULL);
+ toolbars_path = g_build_filename (ev_application_get_data_dir (EV_APP),
+ "evince-toolbar.xml", NULL);
+ egg_toolbars_model_load_names (toolbars_model, toolbars_path);
+
+ if (!egg_toolbars_model_load_toolbars (toolbars_model, toolbars_file)) {
+ egg_toolbars_model_load_toolbars (toolbars_model, toolbars_path);
+ goto skip_conversion;
+ }
+
+ /* Open item doesn't exist anymore,
+ * convert it to OpenRecent for compatibility
+ */
+ for (i = 0; i < egg_toolbars_model_n_items (toolbars_model, 0); i++) {
+ const gchar *item;
+
+ item = egg_toolbars_model_item_nth (toolbars_model, 0, i);
+ if (g_ascii_strcasecmp (item, "FileOpen") == 0) {
+ egg_toolbars_model_remove_item (toolbars_model, 0, i);
+ egg_toolbars_model_add_item (toolbars_model, 0, i,
+ "FileOpenRecent");
+ egg_toolbars_model_save_toolbars (toolbars_model, toolbars_file, "1.0");
+ break;
+ }
+ }
+
+ skip_conversion:
+ g_free (toolbars_file);
+ g_free (toolbars_path);
+
+ egg_toolbars_model_set_flags (toolbars_model, 0, EGG_TB_MODEL_NOT_REMOVABLE);
+
+ return toolbars_model;
+}
+