}
#endif
-#if 0
-static void
-midori_speeddial_import_from_json (const gchar* json_file,
- const gchar* speeddial_file)
+static GKeyFile*
+speeddial_new_from_file (const gchar* config,
+ GError** error)
{
+
+ GKeyFile* key_file = g_key_file_new ();
+ gchar* config_file = g_build_filename (config, "speeddial", NULL);
guint i = 0;
guint columns = 3;
guint slot_count = 0;
gchar* json_content;
gchar** parts;
- GKeyFile* key_file = g_key_file_new ();
- g_file_get_contents (json_file, &json_content, NULL, NULL);
+ if (g_key_file_load_from_file (key_file, config_file, G_KEY_FILE_NONE, error))
+ {
+ g_free (config_file);
+ return key_file;
+ }
+
+ katze_assign (config_file, g_build_filename (config, "speeddial.json", NULL));
+ g_file_get_contents (config_file, &json_content, NULL, NULL);
+ g_free (config_file);
parts = g_strsplit (json_content ? json_content : "", ",", -1);
while (parts && parts[i] != NULL)
{
g_key_file_set_integer (key_file, "settings", "columns", columns);
g_key_file_set_integer (key_file, "settings", "rows", slot_count / columns);
- sokoke_key_file_save_to_file (key_file, speeddial_file, NULL);
-
g_strfreev (parts);
g_free (json_content);
- g_key_file_free (key_file);
+ return key_file;
}
-#endif
static void
midori_soup_session_block_uris_cb (SoupSession* session,
MidoriWebSettings* settings;
gchar* config_file;
gchar* bookmarks_file;
-#if 0
- gchar* speeddial_file;
-#endif
+ GKeyFile* speeddial;
gboolean bookmarks_exist;
MidoriStartup load_on_startup;
KatzeArray* search_engines;
g_free (bookmarks_file);
midori_startup_timer ("History read: \t%f");
- #if 0
- speeddial_file = g_build_filename (config, "speeddial", NULL);
- if (g_access (speeddial_file, F_OK) != 0)
- {
- gchar* json_file = g_build_filename (config, "speeddial.json", NULL);
- midori_speeddial_import_from_json (json_file, speeddial_file);
- g_free (json_file);
- }
- g_free (speeddial_file);
- #endif
+ speeddial = speeddial_new_from_file (config, &error);
/* In case of errors */
if (error_messages->len)
"trash", trash,
"search-engines", search_engines,
"history", history,
+ "speed-dial", speeddial,
NULL);
g_object_unref (history);
g_object_unref (search_engines);
}
g_object_unref (settings);
+ g_key_file_free (speeddial);
g_object_unref (app);
g_free (config_file);
return 0;
KatzeArray* trash;
KatzeArray* search_engines;
KatzeArray* history;
+ GKeyFile* speeddial;
KatzeArray* extensions;
KatzeArray* browsers;
PROP_TRASH,
PROP_SEARCH_ENGINES,
PROP_HISTORY,
+ PROP_SPEED_DIAL,
PROP_EXTENSIONS,
PROP_BROWSERS,
PROP_BROWSER
"trash", app->trash,
"search-engines", app->search_engines,
"history", app->history,
+ "speed-dial", app->speeddial,
NULL);
else
new_browser = midori_app_create_browser (app);
KATZE_TYPE_ARRAY,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+
+ /**
+ * MidoriApp:speed-dial:
+ *
+ * The speed dial configuration file.
+ *
+ * Since: 0.3.4
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_SPEED_DIAL,
+ g_param_spec_pointer (
+ "speed-dial",
+ "Speeddial",
+ "Pointer to key-value object with speed dial items",
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
/**
* MidoriApp:browsers:
*
app->trash = NULL;
app->search_engines = NULL;
app->history = NULL;
+ app->speeddial = NULL;
app->extensions = NULL;
app->browsers = katze_array_new (MIDORI_TYPE_BROWSER);
katze_object_assign (app->trash, NULL);
katze_object_assign (app->search_engines, NULL);
katze_object_assign (app->history, NULL);
+ app->speeddial = NULL;
katze_object_assign (app->extensions, NULL);
katze_object_assign (app->browsers, NULL);
case PROP_HISTORY:
katze_object_assign (app->history, g_value_dup_object (value));
break;
+ case PROP_SPEED_DIAL:
+ app->speeddial = g_value_get_pointer (value);
+ break;
case PROP_EXTENSIONS:
katze_object_assign (app->extensions, g_value_dup_object (value));
break;
case PROP_HISTORY:
g_value_set_object (value, app->history);
break;
+ case PROP_SPEED_DIAL:
+ g_value_set_pointer (value, app->speeddial);
+ break;
case PROP_EXTENSIONS:
g_value_set_object (value, app->extensions);
break;
"trash", app->trash,
"search-engines", app->search_engines,
"history", app->history,
+ "speed-dial", app->speeddial,
NULL);
}
KatzeArray* trash;
KatzeArray* search_engines;
KatzeArray* history;
+ GKeyFile* speeddial;
gboolean show_tabs;
gboolean show_navigationbar;
PROP_TRASH,
PROP_SEARCH_ENGINES,
PROP_HISTORY,
+ PROP_SPEED_DIAL,
PROP_SHOW_TABS,
};
KATZE_TYPE_ARRAY,
flags));
+ /**
+ * MidoriBrowser:speed-dial:
+ *
+ * The speed dial configuration file.
+ *
+ * Since: 0.3.4
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_SPEED_DIAL,
+ g_param_spec_pointer (
+ "speed-dial",
+ "Speeddial",
+ "Pointer to key-value object with speed dial items",
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+
/**
* MidoriBrowser:show-tabs:
*
browser->bookmarks = NULL;
browser->trash = NULL;
browser->search_engines = NULL;
+ browser->speeddial = NULL;
/* Setup the window metrics */
g_signal_connect (browser, "realize",
katze_object_assign (browser->trash, NULL);
katze_object_assign (browser->search_engines, NULL);
katze_object_assign (browser->history, NULL);
+ browser->speeddial = NULL;
katze_assign (browser->news_aggregator, NULL);
case PROP_HISTORY:
midori_browser_set_history (browser, g_value_get_object (value));
break;
+ case PROP_SPEED_DIAL:
+ browser->speeddial = g_value_get_pointer (value);
+ break;
case PROP_SHOW_TABS:
browser->show_tabs = g_value_get_boolean (value);
if (browser->show_tabs)
case PROP_HISTORY:
g_value_set_object (value, browser->history);
break;
+ case PROP_SPEED_DIAL:
+ g_value_set_pointer (value, browser->speeddial);
+ break;
case PROP_SHOW_TABS:
g_value_set_boolean (value, browser->show_tabs);
break;