gnome-panel r11019 - trunk/applets/clock
- From: vuntz svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-panel r11019 - trunk/applets/clock
- Date: Tue, 8 Apr 2008 23:07:13 +0100 (BST)
Author: vuntz
Date: Tue Apr 8 23:07:13 2008
New Revision: 11019
URL: http://svn.gnome.org/viewvc/gnome-panel?rev=11019&view=rev
Log:
2008-04-08 Vincent Untz <vuntz gnome org>
Make some memory savings by not remembering useless data. The code to
keep the data is still available by compiling with
-DMEMORY_DOESNT_MATTER
* clock-country.[ch]: remove all the non-localized name stuff in
"#ifdef MEMORY_DOESNT_MATTER". This implies having a new field to keep
the localized name in memory (but it's not strdupped, so it's still
better)
* clock-zoneinfo.[ch]: remove all the non-localized city and comment
stuff in "#ifdef MEMORY_DOESNT_MATTER"
Modified:
trunk/applets/clock/ChangeLog
trunk/applets/clock/clock-country.c
trunk/applets/clock/clock-country.h
trunk/applets/clock/clock-zoneinfo.c
trunk/applets/clock/clock-zoneinfo.h
Modified: trunk/applets/clock/clock-country.c
==============================================================================
--- trunk/applets/clock/clock-country.c (original)
+++ trunk/applets/clock/clock-country.c Tue Apr 8 23:07:13 2008
@@ -13,7 +13,10 @@
typedef struct {
gchar *code;
+#ifdef MEMORY_DOESNT_MATTER
gchar *name;
+#endif
+ const gchar *l10n_name;
} ClockCountryPrivate;
static void clock_country_finalize (GObject *);
@@ -30,7 +33,11 @@
priv = PRIVATE (this);
priv->code = g_strdup (code);
+#ifdef MEMORY_DOESNT_MATTER
priv->name = g_strdup (name);
+#endif
+ /* FIXME: It is broken to read from Evolution's text domain */
+ priv->l10n_name = dgettext (EVOLUTION_TEXTDOMAIN, name);
return this;
}
@@ -51,7 +58,10 @@
ClockCountryPrivate *priv = PRIVATE (this);
priv->code = NULL;
+#ifdef MEMORY_DOESNT_MATTER
priv->name = NULL;
+#endif
+ priv->l10n_name = NULL;
}
static void
@@ -64,10 +74,12 @@
priv->code = NULL;
}
+#ifdef MEMORY_DOESNT_MATTER
if (priv->name) {
g_free (priv->name);
priv->name = NULL;
}
+#endif
G_OBJECT_CLASS (clock_country_parent_class)->finalize (g_obj);
}
@@ -80,6 +92,7 @@
return priv->code;
}
+#ifdef MEMORY_DOESNT_MATTER
const gchar *
clock_country_get_name (ClockCountry *this)
{
@@ -87,12 +100,12 @@
return priv->name;
}
+#endif
const gchar *
clock_country_get_l10n_name (ClockCountry *this)
{
ClockCountryPrivate *priv = PRIVATE (this);
- /* FMQ: It is broken to read from Evolution's text domain */
- return dgettext (EVOLUTION_TEXTDOMAIN, priv->name);
+ return priv->l10n_name;
}
Modified: trunk/applets/clock/clock-country.h
==============================================================================
--- trunk/applets/clock/clock-country.h (original)
+++ trunk/applets/clock/clock-country.h Tue Apr 8 23:07:13 2008
@@ -28,7 +28,9 @@
ClockCountry *clock_country_new (const gchar *code, const gchar *name);
const gchar *clock_country_get_code (ClockCountry *this);
+#ifdef MEMORY_DOESNT_MATTER
const gchar *clock_country_get_name (ClockCountry *this);
+#endif
const gchar *clock_country_get_l10n_name (ClockCountry *this);
G_END_DECLS
Modified: trunk/applets/clock/clock-zoneinfo.c
==============================================================================
--- trunk/applets/clock/clock-zoneinfo.c (original)
+++ trunk/applets/clock/clock-zoneinfo.c Tue Apr 8 23:07:13 2008
@@ -15,9 +15,13 @@
gchar *name;
gchar *l10n_name;
gchar *country;
+#ifdef MEMORY_DOESNT_MATTER
gchar *city;
+#endif
gchar *l10n_city;
+#ifdef MEMORY_DOESNT_MATTER
gchar *comment;
+#endif
gfloat latitude;
gfloat longitude;
@@ -36,7 +40,9 @@
ClockZoneInfo *this;
ClockZoneInfoPrivate *priv;
int i;
+#ifdef MEMORY_DOESNT_MATTER
const gchar *city;
+#endif
gchar *l10n_city;
this = g_object_new (CLOCK_ZONEINFO_TYPE, NULL);
@@ -45,6 +51,7 @@
priv->name = g_strdup (zone);
priv->country = g_strdup (country);
+#ifdef MEMORY_DOESNT_MATTER
city = g_strrstr (zone, "/");
if (city == NULL)
priv->city = g_strdup (zone);
@@ -57,6 +64,7 @@
priv->city[i] = ' ';
}
}
+#endif
priv->l10n_name = g_strdup (dgettext (EVOLUTION_TEXTDOMAIN,
priv->name));
@@ -74,7 +82,9 @@
else
priv->l10n_city = g_strdup (l10n_city + 1);
+#ifdef MEMORY_DOESNT_MATTER
priv->comment = g_strdup (comment);
+#endif
priv->latitude = latitude;
priv->longitude = longitude;
@@ -100,9 +110,13 @@
priv->name = NULL;
priv->l10n_name = NULL;
priv->country = NULL;
+#ifdef MEMORY_DOESNT_MATTER
priv->city = NULL;
+#endif
priv->l10n_city = NULL;
+#ifdef MEMORY_DOESNT_MATTER
priv->comment = NULL;
+#endif
priv->latitude = 0.0;
priv->longitude = 0.0;
@@ -128,20 +142,24 @@
priv->country = NULL;
}
+#ifdef MEMORY_DOESNT_MATTER
if (priv->city) {
g_free (priv->city);
priv->city = NULL;
}
+#endif
if (priv->l10n_city) {
g_free (priv->l10n_city);
priv->l10n_city = NULL;
}
+#ifdef MEMORY_DOESNT_MATTER
if (priv->comment) {
g_free (priv->comment);
priv->comment = NULL;
}
+#endif
G_OBJECT_CLASS (clock_zoneinfo_parent_class)->finalize (g_obj);
}
@@ -170,6 +188,7 @@
return priv->country;
}
+#ifdef MEMORY_DOESNT_MATTER
const gchar *
clock_zoneinfo_get_city (ClockZoneInfo *this)
{
@@ -177,6 +196,7 @@
return priv->city;
}
+#endif
const gchar *
clock_zoneinfo_get_l10n_city (ClockZoneInfo *this)
Modified: trunk/applets/clock/clock-zoneinfo.h
==============================================================================
--- trunk/applets/clock/clock-zoneinfo.h (original)
+++ trunk/applets/clock/clock-zoneinfo.h Tue Apr 8 23:07:13 2008
@@ -31,7 +31,9 @@
gfloat latitude, gfloat longitude);
+#ifdef MEMORY_DOESNT_MATTER
const gchar *clock_zoneinfo_get_city (ClockZoneInfo *this);
+#endif
const gchar *clock_zoneinfo_get_l10n_city (ClockZoneInfo *this);
const gchar *clock_zoneinfo_get_country (ClockZoneInfo *this);
const gchar *clock_zoneinfo_get_name (ClockZoneInfo *this);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]