]> spindle.queued.net Git - midori/commitdiff
Copy styles passed to midori_web_settings_add_style
authorChristian Dywan <christian@twotoasts.de>
Thu, 27 Oct 2011 21:17:16 +0000 (23:17 +0200)
committerChristian Dywan <christian@twotoasts.de>
Thu, 27 Oct 2011 21:20:10 +0000 (23:20 +0200)
Style strings are usually allocated, unlike rule_id's.

midori/midori-websettings.c
midori/midori-websettings.h

index 477d5d826990332e842ee2c5098263570b0e16d9..1b0ca64fbfdd2e4c04df3eaf5c72f75ae45691e1 100644 (file)
@@ -1806,7 +1806,7 @@ midori_web_settings_process_stylesheets (MidoriWebSettings* settings)
 
 /**
  * midori_web_settings_add_style:
- * @rule_id: a string identifier
+ * @rule_id: a static string identifier
  * @style: a CSS stylesheet
  *
  * Adds or replaces a custom stylesheet.
@@ -1815,16 +1815,17 @@ midori_web_settings_process_stylesheets (MidoriWebSettings* settings)
  **/
 void
 midori_web_settings_add_style (MidoriWebSettings* settings,
-                               gchar*             rule_id,
-                               gchar*             style)
+                               const gchar*       rule_id,
+                               const gchar*       style)
 {
     g_return_if_fail (MIDORI_IS_WEB_SETTINGS (settings));
     g_return_if_fail (rule_id != NULL);
     g_return_if_fail (style != NULL);
 
     if (settings->user_stylesheets == NULL)
-        settings->user_stylesheets = g_hash_table_new (g_str_hash, NULL);
-    g_hash_table_insert (settings->user_stylesheets, rule_id, style);
+        settings->user_stylesheets = g_hash_table_new_full (g_str_hash, NULL,
+        NULL, g_free);
+    g_hash_table_insert (settings->user_stylesheets, (gchar*)rule_id, g_strdup (style));
     midori_web_settings_process_stylesheets (settings);
 }
 
index 80bf00b8d3acde7a9166c5af5d998667da444779..5e3434421b882dc082c8882801e13fcaf3bb4612 100644 (file)
@@ -160,8 +160,8 @@ midori_web_settings_new                    (void);
 
 void
 midori_web_settings_add_style              (MidoriWebSettings* settings,
-                                            gchar*             rule_id,
-                                            gchar*             style);
+                                            const gchar*       rule_id,
+                                            const gchar*       style);
 
 void
 midori_web_settings_remove_style           (MidoriWebSettings* settings,