From: Nick Schermer Date: Fri, 16 Jan 2009 04:19:43 +0000 (+0100) Subject: Make property strings static to save some memory X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f02f9fd118280b46db377b11e7ba8ce7c69d950c;p=midori Make property strings static to save some memory --- diff --git a/midori/compat.h b/midori/compat.h index 68cda360..42789bf6 100644 --- a/midori/compat.h +++ b/midori/compat.h @@ -17,6 +17,12 @@ #endif #include + +#if !GLIB_CHECK_VERSION (2, 14, 0) + #define G_PARAM_STATIC_STRINGS \ + (G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB) +#endif + #if GLIB_CHECK_VERSION (2, 16, 0) #include #endif diff --git a/midori/midori-app.c b/midori/midori-app.c index 8ce5d205..4d3eb4d7 100644 --- a/midori/midori-app.c +++ b/midori/midori-app.c @@ -211,7 +211,7 @@ midori_app_class_init (MidoriAppClass* class) "Settings", "The associated settings", MIDORI_TYPE_WEB_SETTINGS, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_BOOKMARKS, @@ -220,7 +220,7 @@ midori_app_class_init (MidoriAppClass* class) "Bookmarks", "The bookmarks folder, containing all bookmarks", KATZE_TYPE_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_TRASH, @@ -229,7 +229,7 @@ midori_app_class_init (MidoriAppClass* class) "Trash", "The trash, collecting recently closed tabs and windows", KATZE_TYPE_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SEARCH_ENGINES, @@ -238,7 +238,7 @@ midori_app_class_init (MidoriAppClass* class) "Search Engines", "The list of search engines", KATZE_TYPE_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_HISTORY, @@ -247,7 +247,7 @@ midori_app_class_init (MidoriAppClass* class) "History", "The list of history items", KATZE_TYPE_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_EXTENSIONS, @@ -256,7 +256,7 @@ midori_app_class_init (MidoriAppClass* class) "Extensions", "The list of extensions", KATZE_TYPE_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_BROWSER, @@ -265,7 +265,7 @@ midori_app_class_init (MidoriAppClass* class) "Browser", "The current browser", MIDORI_TYPE_BROWSER, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_BROWSER_COUNT, @@ -274,7 +274,7 @@ midori_app_class_init (MidoriAppClass* class) "Browser Count", "The current number of browsers", 0, G_MAXUINT, 0, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); } #if HAVE_UNIQUE diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 37f7413b..0f74fc17 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -1078,7 +1078,7 @@ midori_browser_class_init (MidoriBrowserClass* class) gobject_class->set_property = midori_browser_set_property; gobject_class->get_property = midori_browser_get_property; - flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT; + flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS; g_object_class_install_property (gobject_class, PROP_MENUBAR, @@ -1087,7 +1087,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "Menubar", "The menubar", GTK_TYPE_MENU_BAR, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_NAVIGATIONBAR, @@ -1096,7 +1096,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "Navigationbar", "The navigationbar", GTK_TYPE_TOOLBAR, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_NOTEBOOK, @@ -1105,7 +1105,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "Notebook", "The notebook containing the views", GTK_TYPE_NOTEBOOK, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_PANEL, @@ -1114,7 +1114,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "Panel", "The side panel embedded in the browser", MIDORI_TYPE_PANEL, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_URI, @@ -1123,7 +1123,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "URI", "The current URI", "about:blank", - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_TAB, @@ -1132,7 +1132,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "Tab", "The current tab", GTK_TYPE_WIDGET, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_LOAD_STATUS, @@ -1142,7 +1142,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "The current load status", MIDORI_TYPE_LOAD_STATUS, MIDORI_LOAD_FINISHED, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_STATUSBAR, @@ -1151,7 +1151,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "Statusbar", "The statusbar", GTK_TYPE_STATUSBAR, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); /** * MidoriBrowser:statusbar-text: @@ -1190,7 +1190,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "Settings", "The associated settings", MIDORI_TYPE_WEB_SETTINGS, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * MidoriBrowser:bookmarks: @@ -1207,7 +1207,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "Bookmarks", "The bookmarks folder, containing all bookmarks", KATZE_TYPE_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * MidoriBrowser:trash: @@ -1226,7 +1226,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "Trash", "The trash, collecting recently closed tabs and windows", KATZE_TYPE_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * MidoriBrowser:search-engines: @@ -1243,7 +1243,7 @@ midori_browser_class_init (MidoriBrowserClass* class) "Search Engines", "The list of search engines to be used for web search", KATZE_TYPE_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * MidoriBrowser:history: diff --git a/midori/midori-extension.c b/midori/midori-extension.c index dc540754..22eee820 100644 --- a/midori/midori-extension.c +++ b/midori/midori-extension.c @@ -99,7 +99,7 @@ midori_extension_class_init (MidoriExtensionClass* class) gobject_class->set_property = midori_extension_set_property; gobject_class->get_property = midori_extension_get_property; - flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT; + flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS; g_object_class_install_property (gobject_class, PROP_NAME, diff --git a/midori/midori-locationaction.c b/midori/midori-locationaction.c index 631cfc74..6c966b48 100644 --- a/midori/midori-locationaction.c +++ b/midori/midori-locationaction.c @@ -168,7 +168,7 @@ midori_location_action_class_init (MidoriLocationActionClass* class) "Progress", "The current progress of the action", 0.0, 1.0, 0.0, - G_PARAM_WRITABLE)); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SECONDARY_ICON, @@ -177,7 +177,7 @@ midori_location_action_class_init (MidoriLocationActionClass* class) "Secondary", "The stock ID of the secondary icon", NULL, - G_PARAM_WRITABLE)); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); } static void diff --git a/midori/midori-panel.c b/midori/midori-panel.c index 160266b9..de821617 100644 --- a/midori/midori-panel.c +++ b/midori/midori-panel.c @@ -118,7 +118,7 @@ midori_panel_class_init (MidoriPanelClass* class) class->close = midori_panel_close; - flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT; + flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS; g_object_class_install_property (gobject_class, PROP_SHADOW_TYPE, @@ -137,7 +137,7 @@ midori_panel_class_init (MidoriPanelClass* class) "Menu", "Menu to hold panel items", GTK_TYPE_MENU, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_PAGE, diff --git a/midori/midori-preferences.c b/midori/midori-preferences.c index ca944130..8d85ca96 100644 --- a/midori/midori-preferences.c +++ b/midori/midori-preferences.c @@ -70,7 +70,7 @@ midori_preferences_class_init (MidoriPreferencesClass* class) "Settings", "Settings instance to provide properties", MIDORI_TYPE_WEB_SETTINGS, - G_PARAM_WRITABLE)); + G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); } static void diff --git a/midori/midori-searchaction.c b/midori/midori-searchaction.c index 3d8d8ded..a9b1e814 100644 --- a/midori/midori-searchaction.c +++ b/midori/midori-searchaction.c @@ -136,7 +136,7 @@ midori_search_action_class_init (MidoriSearchActionClass* class) "Search Engines", "The list of search engines", KATZE_TYPE_ARRAY, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_CURRENT_ITEM, @@ -145,7 +145,7 @@ midori_search_action_class_init (MidoriSearchActionClass* class) "Current Item", "The currently selected item", KATZE_TYPE_ITEM, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_TEXT, @@ -154,7 +154,7 @@ midori_search_action_class_init (MidoriSearchActionClass* class) "Text", "The current text typed in the entry", NULL, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_DIALOG, @@ -163,7 +163,7 @@ midori_search_action_class_init (MidoriSearchActionClass* class) "Dialog", "A dialog to manage search engines", GTK_TYPE_DIALOG, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); } static void diff --git a/midori/midori-view.c b/midori/midori-view.c index dede4dab..74733e8a 100644 --- a/midori/midori-view.c +++ b/midori/midori-view.c @@ -305,7 +305,7 @@ midori_view_class_init (MidoriViewClass* class) gobject_class->set_property = midori_view_set_property; gobject_class->get_property = midori_view_get_property; - flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT; + flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS; g_object_class_install_property (gobject_class, PROP_URI, @@ -314,7 +314,7 @@ midori_view_class_init (MidoriViewClass* class) "Uri", "The URI of the currently loaded page", "about:blank", - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_TITLE, @@ -323,7 +323,7 @@ midori_view_class_init (MidoriViewClass* class) "Title", "The title of the currently loaded page", NULL, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * MidoriView:mime-type: @@ -339,7 +339,7 @@ midori_view_class_init (MidoriViewClass* class) "MIME Type", "The MIME type of the currently loaded page", "text/html", - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ICON, @@ -348,7 +348,7 @@ midori_view_class_init (MidoriViewClass* class) "Icon", "The icon of the view", GDK_TYPE_PIXBUF, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_LOAD_STATUS, @@ -358,7 +358,7 @@ midori_view_class_init (MidoriViewClass* class) "The current loading status", MIDORI_TYPE_LOAD_STATUS, MIDORI_LOAD_FINISHED, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_PROGRESS, @@ -367,7 +367,7 @@ midori_view_class_init (MidoriViewClass* class) "Progress", "The current loading progress", 0.0, 1.0, 0.0, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ZOOM_LEVEL, @@ -378,7 +378,7 @@ midori_view_class_init (MidoriViewClass* class) G_MINFLOAT, G_MAXFLOAT, 1.0f, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /* g_object_class_install_property (gobject_class, PROP_NEWS_FEEDS, @@ -387,7 +387,7 @@ midori_view_class_init (MidoriViewClass* class) "News Feeds", "The list of available news feeds", KATZE_TYPE_ARRAY, - G_PARAM_READWRITE)); */ + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); */ g_object_class_install_property (gobject_class, PROP_STATUSBAR_TEXT, @@ -396,7 +396,7 @@ midori_view_class_init (MidoriViewClass* class) "Statusbar Text", "The text displayed in the statusbar", "", - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_SETTINGS, diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index b803cae4..1ddf110a 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -274,7 +274,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) gobject_class->set_property = midori_web_settings_set_property; gobject_class->get_property = midori_web_settings_get_property; - flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT; + flags = G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS; g_object_class_install_property (gobject_class, PROP_REMEMBER_LAST_WINDOW_SIZE, @@ -516,8 +516,8 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("Where to open new pages"), MIDORI_TYPE_NEW_PAGE, MIDORI_NEW_PAGE_TAB, - g_signal_lookup ("create-web-view", WEBKIT_TYPE_WEB_VIEW) - ? G_PARAM_READWRITE : G_PARAM_READABLE)); + (g_signal_lookup ("create-web-view", WEBKIT_TYPE_WEB_VIEW) + ? G_PARAM_READWRITE : G_PARAM_READABLE) | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_OPEN_EXTERNAL_PAGES_IN, @@ -528,9 +528,9 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) MIDORI_TYPE_NEW_PAGE, MIDORI_NEW_PAGE_TAB, #if HAVE_UNIQUE - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); #else - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); #endif g_object_class_install_property (gobject_class, @@ -567,7 +567,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("Open popups in tabs"), _("Whether to open popup windows in tabs"), TRUE, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); if (!g_object_class_find_property (gobject_class, "enforce-96-dpi")) @@ -585,7 +585,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) "Enforce 96 DPI", "Whether to enforce a resolution of 96 DPI", FALSE, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); if (!g_object_class_find_property (gobject_class, "enable-developer-extras")) /** @@ -602,7 +602,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) "Enable Developer Extras", "Whether to enable extra developer tools", FALSE, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); if (!g_object_class_find_property (gobject_class, "zoom-text-and-images")) /** @@ -619,8 +619,9 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("Zoom Text and Images"), _("Whether to zoom text and images"), FALSE, - g_object_class_find_property (g_type_class_ref (WEBKIT_TYPE_WEB_VIEW), - "full-content-zoom") ? G_PARAM_READWRITE : G_PARAM_READABLE)); + (g_object_class_find_property (g_type_class_ref (WEBKIT_TYPE_WEB_VIEW), + "full-content-zoom") ? G_PARAM_READWRITE : G_PARAM_READABLE) + | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_ACCEPT_COOKIES, @@ -631,9 +632,9 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) MIDORI_TYPE_ACCEPT_COOKIES, MIDORI_ACCEPT_COOKIES_ALL, #if HAVE_LIBSOUP - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); #else - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); #endif g_object_class_install_property (gobject_class, @@ -643,7 +644,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("Original cookies only"), _("Accept cookies from the original website only"), FALSE, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_MAXIMUM_COOKIE_AGE, @@ -652,7 +653,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("Maximum cookie age"), _("The maximum number of days to save cookies for"), 0, G_MAXINT, 30, - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); @@ -681,7 +682,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("Remember last form inputs"), _("Whether the last form inputs are saved"), TRUE, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); g_object_class_install_property (gobject_class, PROP_REMEMBER_LAST_DOWNLOADED_FILES, @@ -690,7 +691,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("Remember last downloaded files"), _("Whether the last downloaded files are saved"), TRUE, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); @@ -702,9 +703,9 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("The proxy server used for HTTP connections"), NULL, #if HAVE_LIBSOUP - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); #else - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); #endif /** @@ -724,9 +725,9 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) MIDORI_TYPE_IDENTITY, MIDORI_IDENT_MIDORI, #if HAVE_LIBSOUP - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); #else - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); #endif /** @@ -744,9 +745,9 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("The application identification string"), NULL, #if HAVE_LIBSOUP - G_PARAM_READWRITE)); + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); #else - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); #endif g_object_class_install_property (gobject_class, @@ -756,7 +757,7 @@ midori_web_settings_class_init (MidoriWebSettingsClass* class) _("Cache size"), _("The allowed size of the cache"), 0, G_MAXINT, 100, - G_PARAM_READABLE)); + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); } static void