diff options
author | Michael Meeks <michael.meeks@novell.com> | 2010-04-22 00:06:38 +0800 |
---|---|---|
committer | Michael Meeks <michael.meeks@novell.com> | 2010-04-22 00:06:38 +0800 |
commit | a84b1a325147e6321b90f491a1dc686e588869dc (patch) | |
tree | 409a66488e99ed288c9ff2b4eb90f1993ae537ab /e-util | |
parent | e9c4388490925de25b029fa0d6437a34a6386c05 (diff) | |
parent | ece7dcdcea82d0e1fbc104cf48b2928a449b8748 (diff) | |
download | gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar.gz gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar.bz2 gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar.lz gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar.xz gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.tar.zst gsoc2013-evolution-a84b1a325147e6321b90f491a1dc686e588869dc.zip |
Merge commit 'origin/gnome-2-30' into express2
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-activity.c | 2 | ||||
-rw-r--r-- | e-util/e-print.c | 33 | ||||
-rw-r--r-- | e-util/gconf-bridge.c | 36 |
3 files changed, 49 insertions, 22 deletions
diff --git a/e-util/e-activity.c b/e-util/e-activity.c index 9f8faf75cb..f8a3510049 100644 --- a/e-util/e-activity.c +++ b/e-util/e-activity.c @@ -234,7 +234,7 @@ activity_describe (EActivity *activity) * complete is known. */ g_string_printf ( string, _("%s (%d%% complete)"), text, - (gint) (percent * 100.0 + 0.5)); + (gint) (percent)); } return g_string_free (string, FALSE); diff --git a/e-util/e-print.c b/e-util/e-print.c index 8faeafc0f5..bb5ce9067a 100644 --- a/e-util/e-print.c +++ b/e-util/e-print.c @@ -92,17 +92,12 @@ load_settings (GKeyFile *key_file) GtkPrintSettings *settings; GError *error = NULL; - /* XXX Use gtk_print_settings_load_key_file() here once - * GTK+ 2.14 becomes available. */ + settings = gtk_print_settings_new (); - if (!g_key_file_has_group (key_file, PRINT_SETTINGS_GROUP_NAME)) - return gtk_print_settings_new (); - - settings = gtk_print_settings_new_from_key_file ( - key_file, NULL, &error); + gtk_print_settings_load_key_file ( + settings, key_file, PRINT_SETTINGS_GROUP_NAME, &error); if (error != NULL) { - settings = gtk_print_settings_new (); g_warning ("%s", error->message); g_error_free (error); } @@ -114,6 +109,17 @@ static void save_settings (GtkPrintSettings *settings, GKeyFile *key_file) { + /* XXX GtkPrintSettings does not distinguish between settings + * that should persist and one-time-only settings, such as + * page range or number of copies. All print settings are + * persistent by default and we opt out particular keys by + * popular demand. */ + + gtk_print_settings_unset (settings, GTK_PRINT_SETTINGS_N_COPIES); + gtk_print_settings_unset (settings, GTK_PRINT_SETTINGS_PAGE_RANGES); + gtk_print_settings_unset (settings, GTK_PRINT_SETTINGS_PAGE_SET); + gtk_print_settings_unset (settings, GTK_PRINT_SETTINGS_PRINT_PAGES); + gtk_print_settings_to_key_file (settings, key_file, NULL); } @@ -123,17 +129,12 @@ load_page_setup (GKeyFile *key_file) GtkPageSetup *page_setup; GError *error = NULL; - /* XXX Use gtk_page_setup_load_key_file() here once - * GTK+ 2.14 becomes available. */ - - if (!g_key_file_has_group (key_file, PAGE_SETUP_GROUP_NAME)) - return gtk_page_setup_new (); + page_setup = gtk_page_setup_new (); - page_setup = gtk_page_setup_new_from_key_file ( - key_file, NULL, &error); + gtk_page_setup_load_key_file ( + page_setup, key_file, PAGE_SETUP_GROUP_NAME, &error); if (error != NULL) { - page_setup = gtk_page_setup_new (); g_warning ("%s", error->message); g_error_free (error); } diff --git a/e-util/gconf-bridge.c b/e-util/gconf-bridge.c index d0f884d8fa..d67a238080 100644 --- a/e-util/gconf-bridge.c +++ b/e-util/gconf-bridge.c @@ -53,6 +53,8 @@ typedef struct { that have not received change notification yet. */ + GConfValue *use_first_value; /* Not NULL when the object is a Widget and wasn't realized */ + GObject *object; GParamSpec *prop; gulong prop_notify_id; @@ -263,6 +265,9 @@ prop_binding_sync_prop_to_pref (PropBinding *binding) binding->prop->name, &value); + if (binding->use_first_value) { + gconf_value = binding->use_first_value; + } else switch (value.g_type) { case G_TYPE_STRING: gconf_value = gconf_value_new (GCONF_VALUE_STRING); @@ -356,10 +361,17 @@ prop_binding_sync_prop_to_pref (PropBinding *binding) /* Set to GConf */ gconf_client_set (bridge->client, binding->key, gconf_value, NULL); - /* Store until change notification comes in, so that we are able - * to ignore it */ - binding->val_changes = g_slist_append (binding->val_changes, - gconf_value); + if (binding->use_first_value) { + gconf_value_free (binding->use_first_value); + binding->use_first_value = NULL; + + gconf_client_notify (bridge->client, binding->key); + } else { + /* Store until change notification comes in, so that we are able + * to ignore it */ + binding->val_changes = g_slist_append (binding->val_changes, + gconf_value); + } done: g_value_unset (&value); @@ -513,6 +525,7 @@ gconf_bridge_bind_property_full (GConfBridge *bridge, binding->id = new_id (); binding->delayed_mode = delayed_sync; binding->val_changes = NULL; + binding->use_first_value = NULL; binding->key = g_strdup (key); binding->object = object; binding->prop = pspec; @@ -536,7 +549,15 @@ gconf_bridge_bind_property_full (GConfBridge *bridge, val = gconf_client_get (bridge->client, key, NULL); if (val) { prop_binding_sync_pref_to_prop (binding, val); - gconf_value_free (val); + #if GTK_CHECK_VERSION(2,19,7) + if (GTK_IS_WIDGET (object) && !gtk_widget_get_realized (GTK_WIDGET (object))) { + #else + if (GTK_IS_WIDGET (object) && !GTK_WIDGET_REALIZED (object)) { + #endif + binding->use_first_value = val; + } else { + gconf_value_free (val); + } } /* Handle case where watched object gets destroyed */ @@ -627,6 +648,11 @@ prop_binding_unbind (PropBinding *binding) (binding->val_changes, binding->val_changes); } + if (binding->use_first_value) { + gconf_value_free (binding->use_first_value); + binding->use_first_value = NULL; + } + /* The object might have been destroyed .. */ if (binding->object) { g_signal_handler_disconnect (binding->object, |