[gtk+] GtkRecentManager: Allow instantiating with gtk_init
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] GtkRecentManager: Allow instantiating with gtk_init
- Date: Mon, 22 Dec 2014 04:15:41 +0000 (UTC)
commit 4bc3f02d51051fd7deff1a658d40a3859bb68a42
Author: Matthias Clasen <mclasen redhat com>
Date: Sun Dec 21 23:14:02 2014 -0500
GtkRecentManager: Allow instantiating with gtk_init
This apparently used to work, and it doesn't do harm to allow it.
https://bugzilla.gnome.org/show_bug.cgi?id=705582
gtk/gtkrecentmanager.c | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkrecentmanager.c b/gtk/gtkrecentmanager.c
index 99aa238..b239cfc 100644
--- a/gtk/gtkrecentmanager.c
+++ b/gtk/gtkrecentmanager.c
@@ -346,8 +346,9 @@ gtk_recent_manager_init (GtkRecentManager *manager)
priv->filename = NULL;
settings = gtk_settings_get_default ();
- g_signal_connect_swapped (settings, "notify::gtk-recent-files-enabled",
- G_CALLBACK (gtk_recent_manager_enabled_changed), manager);
+ if (settings)
+ g_signal_connect_swapped (settings, "notify::gtk-recent-files-enabled",
+ G_CALLBACK (gtk_recent_manager_enabled_changed), manager);
}
static void
@@ -470,14 +471,21 @@ gtk_recent_manager_real_changed (GtkRecentManager *manager)
}
else
{
- GtkSettings *settings = gtk_settings_get_default ();
- gint age = 30;
+ GtkSettings *settings;
+ gint age;
gboolean enabled;
- g_object_get (G_OBJECT (settings),
- "gtk-recent-files-max-age", &age,
- "gtk-recent-files-enabled", &enabled,
- NULL);
+ settings = gtk_settings_get_default ();
+ if (settings)
+ g_object_get (G_OBJECT (settings),
+ "gtk-recent-files-max-age", &age,
+ "gtk-recent-files-enabled", &enabled,
+ NULL);
+ else
+ {
+ age = 30;
+ enabled = TRUE;
+ }
if (age == 0 || !enabled)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]