trivial: Code style improvements

This commit is contained in:
Georges Basile Stavracas Neto 2018-03-28 10:44:46 -03:00
parent 10dfbb526e
commit 85296f1eba

View file

@ -305,12 +305,15 @@ set_active_panel_from_id (CcShell *shell,
GVariant *parameters, GVariant *parameters,
GError **error) GError **error)
{ {
g_autoptr(GIcon) gicon = NULL;
g_autofree gchar *name = NULL;
GtkTreeIter iter; GtkTreeIter iter;
gboolean iter_valid;
gchar *name = NULL;
GIcon *gicon = NULL;
CcWindow *self = CC_WINDOW (shell);
GtkWidget *old_panel; GtkWidget *old_panel;
CcWindow *self;
gboolean iter_valid;
gboolean activated;
self = CC_WINDOW (shell);
/* When loading the same panel again, just set its parameters */ /* When loading the same panel again, just set its parameters */
if (g_strcmp0 (self->current_panel_id, start_id) == 0) if (g_strcmp0 (self->current_panel_id, start_id) == 0)
@ -349,14 +352,17 @@ set_active_panel_from_id (CcShell *shell,
if (!name) if (!name)
{ {
g_warning ("Could not find settings panel \"%s\"", start_id); g_warning ("Could not find settings panel \"%s\"", start_id);
return TRUE;
} }
else if (!activate_panel (CC_WINDOW (shell), start_id, parameters, name, gicon))
{ /* Activate the panel */
/* Failed to activate the panel for some reason, activated = activate_panel (CC_WINDOW (shell), start_id, parameters, name, gicon);
* let's keep the old panel around instead */
} /* Failed to activate the panel for some reason, let's keep the old
else * panel around instead */
{ if (!activated)
return TRUE;
/* Successful activation */ /* Successful activation */
g_free (self->current_panel_id); g_free (self->current_panel_id);
self->current_panel_id = g_strdup (start_id); self->current_panel_id = g_strdup (start_id);
@ -365,10 +371,6 @@ set_active_panel_from_id (CcShell *shell,
gtk_container_remove (GTK_CONTAINER (self->stack), old_panel); gtk_container_remove (GTK_CONTAINER (self->stack), old_panel);
cc_panel_list_set_active_panel (CC_PANEL_LIST (self->panel_list), start_id); cc_panel_list_set_active_panel (CC_PANEL_LIST (self->panel_list), start_id);
}
g_clear_pointer (&name, g_free);
g_clear_object (&gicon);
return TRUE; return TRUE;
} }
@ -387,13 +389,10 @@ set_active_panel (CcWindow *shell,
/* set the new panel */ /* set the new panel */
if (panel) if (panel)
{
shell->active_panel = g_object_ref (panel); shell->active_panel = g_object_ref (panel);
}
else else
{
shell_show_overview_page (shell); shell_show_overview_page (shell);
}
g_object_notify (G_OBJECT (shell), "active-panel"); g_object_notify (G_OBJECT (shell), "active-panel");
} }
} }