diff options
author | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2018-03-28 10:44:46 -0300 |
---|---|---|
committer | Georges Basile Stavracas Neto <georges.stavracas@gmail.com> | 2018-03-28 16:55:39 -0300 |
commit | e09a6b8bcd156b2b6114faf7fdf872c5c78d3fdc (patch) | |
tree | af8c9cf042210c853f454ac4489204811f4aa5d5 | |
parent | 44dec4e6b4550e7e67e80ffa0e94cfe9533f3530 (diff) | |
download | gnome-control-center-gbsneto/object-storage.tar.gz |
trivial: Code style improvementsgbsneto/object-storage
-rw-r--r-- | shell/cc-window.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/shell/cc-window.c b/shell/cc-window.c index 2e97abbdb..c27eccb4d 100644 --- a/shell/cc-window.c +++ b/shell/cc-window.c @@ -302,12 +302,15 @@ set_active_panel_from_id (CcShell *shell, GVariant *parameters, GError **error) { + g_autoptr(GIcon) gicon = NULL; + g_autofree gchar *name = NULL; GtkTreeIter iter; - gboolean iter_valid; - gchar *name = NULL; - GIcon *gicon = NULL; - CcWindow *self = CC_WINDOW (shell); GtkWidget *old_panel; + CcWindow *self; + gboolean iter_valid; + gboolean activated; + + self = CC_WINDOW (shell); /* When loading the same panel again, just set its parameters */ if (g_strcmp0 (self->current_panel_id, start_id) == 0) @@ -346,26 +349,25 @@ set_active_panel_from_id (CcShell *shell, if (!name) { g_warning ("Could not find settings panel \"%s\"", start_id); + return TRUE; } - else if (!activate_panel (CC_WINDOW (shell), start_id, parameters, name, gicon)) - { - /* Failed to activate the panel for some reason, - * let's keep the old panel around instead */ - } - else - { - /* Successful activation */ - g_free (self->current_panel_id); - self->current_panel_id = g_strdup (start_id); - if (old_panel) - gtk_container_remove (GTK_CONTAINER (self->stack), old_panel); + /* Activate the panel */ + activated = activate_panel (CC_WINDOW (shell), start_id, parameters, name, gicon); - cc_panel_list_set_active_panel (CC_PANEL_LIST (self->panel_list), start_id); - } + /* Failed to activate the panel for some reason, let's keep the old + * panel around instead */ + if (!activated) + return TRUE; + + /* Successful activation */ + g_free (self->current_panel_id); + self->current_panel_id = g_strdup (start_id); - g_clear_pointer (&name, g_free); - g_clear_object (&gicon); + if (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); return TRUE; } @@ -384,13 +386,10 @@ set_active_panel (CcWindow *shell, /* set the new panel */ if (panel) - { - shell->active_panel = g_object_ref (panel); - } + shell->active_panel = g_object_ref (panel); else - { - shell_show_overview_page (shell); - } + shell_show_overview_page (shell); + g_object_notify (G_OBJECT (shell), "active-panel"); } } |