aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-01-17 22:24:06 +0800
committerChristian Persch <chpe@src.gnome.org>2006-01-17 22:24:06 +0800
commit3df4179bdf257cd15f69083158f591a3f64798d0 (patch)
tree7af9bcce19e1a25190c72b5d3a9419663512558e
parentf220f9282e63ca352def47b86ec5f9c5c5c57696 (diff)
downloadgsoc2013-epiphany-3df4179bdf257cd15f69083158f591a3f64798d0.tar
gsoc2013-epiphany-3df4179bdf257cd15f69083158f591a3f64798d0.tar.gz
gsoc2013-epiphany-3df4179bdf257cd15f69083158f591a3f64798d0.tar.bz2
gsoc2013-epiphany-3df4179bdf257cd15f69083158f591a3f64798d0.tar.lz
gsoc2013-epiphany-3df4179bdf257cd15f69083158f591a3f64798d0.tar.xz
gsoc2013-epiphany-3df4179bdf257cd15f69083158f591a3f64798d0.tar.zst
gsoc2013-epiphany-3df4179bdf257cd15f69083158f591a3f64798d0.zip
Fix leaks, minor cleanups.
2006-01-17 Christian Persch <chpe@cvs.gnome.org> * data/glade/prefs-dialog.glade: * embed/mozilla/mozilla-notifiers.cpp: Fix leaks, minor cleanups.
-rw-r--r--ChangeLog7
-rw-r--r--data/glade/prefs-dialog.glade32
-rw-r--r--embed/mozilla/mozilla-notifiers.cpp54
3 files changed, 46 insertions, 47 deletions
diff --git a/ChangeLog b/ChangeLog
index 1e8177eb0..d4f6d1fba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
2006-01-17 Christian Persch <chpe@cvs.gnome.org>
+ * data/glade/prefs-dialog.glade:
+ * embed/mozilla/mozilla-notifiers.cpp:
+
+ Fix leaks, minor cleanups.
+
+2006-01-17 Christian Persch <chpe@cvs.gnome.org>
+
* lib/ephy-file-helpers.c: (ephy_file_monitor_timeout_cb),
(ephy_file_monitor_cb):
* lib/ephy-file-helpers.h:
diff --git a/data/glade/prefs-dialog.glade b/data/glade/prefs-dialog.glade
index 16e5d21c2..ecd7049ef 100644
--- a/data/glade/prefs-dialog.glade
+++ b/data/glade/prefs-dialog.glade
@@ -1788,21 +1788,6 @@
</child>
<child>
- <widget class="GtkComboBox" id="fonts_language_combo">
- <property name="visible">True</property>
- <property name="add_tearoffs">False</property>
- <property name="focus_on_click">True</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkComboBox" id="variable_combo">
<property name="visible">True</property>
<property name="add_tearoffs">False</property>
@@ -1911,10 +1896,25 @@
<property name="y_options"></property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkComboBox" id="fonts_language_combo">
+ <property name="visible">True</property>
+ <property name="add_tearoffs">False</property>
+ <property name="focus_on_click">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="y_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
- <property name="expand">False</property>
+ <property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
diff --git a/embed/mozilla/mozilla-notifiers.cpp b/embed/mozilla/mozilla-notifiers.cpp
index 0166bd980..12484bc3e 100644
--- a/embed/mozilla/mozilla-notifiers.cpp
+++ b/embed/mozilla/mozilla-notifiers.cpp
@@ -50,6 +50,8 @@
/* define to migrate epiphany 1.0 font preferences */
#define MIGRATE_PIXEL_SIZE
+#define MAX_FONT_SIZE 128
+
/* Keeps the list of the notifiers we installed for mozilla prefs */
/* to be able to remove them when exiting */
static GList *notifiers = NULL;
@@ -497,7 +499,7 @@ mozilla_pref_set (const char *pref,
rv = gPrefBranch->GetIntPref (pref, &old_value);
if (NS_FAILED (rv) || old_value != new_value)
{
- rv = gPrefBranch->SetIntPref (pref, g_value_get_int (value));
+ rv = gPrefBranch->SetIntPref (pref, new_value);
}
break;
}
@@ -565,13 +567,11 @@ notify_cb (GConfClient *client,
}
}
-static guint
-mozilla_notifier_add_internal (const char *gconf_key,
- GConfClientNotifyFunc notify_func,
- const char *mozilla_pref,
- PrefValueTransformFunc func,
- gpointer user_data,
- GFreeFunc free_data_func)
+extern "C" guint
+mozilla_notifier_add (const char *gconf_key,
+ const char *mozilla_pref,
+ PrefValueTransformFunc func,
+ gpointer user_data)
{
GConfClient *client;
PrefData *data;
@@ -593,8 +593,8 @@ mozilla_notifier_add_internal (const char *gconf_key,
data->user_data = user_data;
cnxn_id = gconf_client_notify_add (client, gconf_key,
- notify_func,
- data, free_data_func,
+ (GConfClientNotifyFunc) notify_cb,
+ data, (GFreeFunc) free_pref_data,
&error);
if (eel_gconf_handle_error (&error))
{
@@ -614,20 +614,6 @@ mozilla_notifier_add_internal (const char *gconf_key,
return cnxn_id;
}
-extern "C" guint
-mozilla_notifier_add (const char *gconf_key,
- const char *mozilla_pref,
- PrefValueTransformFunc func,
- gpointer user_data)
-{
- return mozilla_notifier_add_internal (gconf_key,
- (GConfClientNotifyFunc) notify_cb,
- mozilla_pref,
- func,
- user_data,
- (GFreeFunc) free_pref_data);
-}
-
static int
find_data (const PrefData *a,
gconstpointer idptr)
@@ -715,15 +701,22 @@ parse_pango_font (const char *font,
PangoFontMask mask = (PangoFontMask) (PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_SIZE);
PangoFontDescription *desc = pango_font_description_from_string (font);
- if (desc == NULL ||
- (pango_font_description_get_set_fields (desc) & mask) != mask)
+ if (desc == NULL) return FALSE;
+
+ if ((pango_font_description_get_set_fields (desc) & mask) != mask)
{
+ pango_font_description_free (desc);
return FALSE;
}
-
+
*size = PANGO_PIXELS (pango_font_description_get_size (desc));
*name = g_strdup (pango_font_description_get_family (desc));
+ pango_font_description_free (desc);
+
+ LOG ("Parsed pango font description '%s' -> name:%s, size:%d",
+ font, *name ? *name : "-", *size);
+
return *name != NULL && *size > 0;
}
@@ -734,7 +727,6 @@ typedef struct
char **font_size_prefs;
char *font_name;
int font_size;
- guint is_set : 1;
} DesktopFontData;
static gboolean
@@ -798,7 +790,7 @@ transform_font_size (GConfEntry *gcentry,
size = gconf_value_get_int (gcvalue);
}
- if (size <= 0) return FALSE;
+ if (size <= 0 || size > MAX_FONT_SIZE) return FALSE;
g_value_init (value, G_TYPE_INT);
g_value_set_int (value, size);
@@ -824,17 +816,17 @@ notify_desktop_font_cb (GConfClient *client,
LOG ("Desktop font %s -> name=%s, size=%d",
gconf_entry_get_key (gcentry), name, size);
+ g_free (data->font_name);
data->font_name = name;
data->font_size = size;
- data->is_set = TRUE;
}
else
{
g_free (name);
+
g_free (data->font_name);
data->font_name = NULL;
data->font_size = 0;
- data->is_set = FALSE;
}
for (i = 0; data->font_name_prefs[i] != NULL; ++i)