info: make sure to always print an experience value

This commit is contained in:
William Jon McCann 2011-02-15 13:59:27 -05:00
parent 0be178ba6b
commit 17008fe565

View file

@ -371,14 +371,15 @@ get_is_graphics_accelerated (void)
} }
static char * static gboolean
get_graphics_experience (CcInfoPanel *self) get_current_is_fallback (CcInfoPanel *self)
{ {
GError *error = NULL; GError *error;
GVariant *reply, *reply_bool; GVariant *reply;
GVariant *reply_bool;
gboolean is_fallback; gboolean is_fallback;
gchar *experience_str;
error = NULL;
if (!(reply = g_dbus_connection_call_sync (self->priv->session_bus, if (!(reply = g_dbus_connection_call_sync (self->priv->session_bus,
"org.gnome.SessionManager", "org.gnome.SessionManager",
"/org/gnome/SessionManager", "/org/gnome/SessionManager",
@ -392,15 +393,27 @@ get_graphics_experience (CcInfoPanel *self)
{ {
g_warning ("Failed to get fallback mode: %s", error->message); g_warning ("Failed to get fallback mode: %s", error->message);
g_clear_error (&error); g_clear_error (&error);
return NULL; return FALSE;
} }
g_variant_get (reply, "(v)", &reply_bool); g_variant_get (reply, "(v)", &reply_bool);
is_fallback = g_variant_get_boolean (reply_bool); is_fallback = g_variant_get_boolean (reply_bool);
experience_str = g_strdup (is_fallback ? _("Fallback") : _("Default"));
g_variant_unref (reply_bool); g_variant_unref (reply_bool);
g_variant_unref (reply); g_variant_unref (reply);
return is_fallback;
}
static char *
get_graphics_experience (CcInfoPanel *self)
{
char *experience_str;
if (get_current_is_fallback (self))
experience_str = g_strdup (_("Fallback"));
else
experience_str = g_strdup (_("Standard"));
return experience_str; return experience_str;
} }