--- gnome-control-center-3.28.1/panels/printers/gnome-printers-panel.desktop.in.in +++ gnome-control-center-3.28.1/panels/printers/gnome-printers-panel.desktop.in.in @@ -10,6 +10,5 @@ NoDisplay=true StartupNotify=true # The X-GNOME-Settings-Panel is necessary to show in the main shell UI Categories=GNOME;GTK;Settings;HardwareSettings;X-GNOME-Settings-Panel;X-GNOME-DevicesSettings; -OnlyShowIn=GNOME;Unity; # Translators: Search terms to find the Printers panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon! Keywords=Printer;Queue;Print;Paper;Ink;Toner; --- gnome-control-center-3.28.1/shell/cc-window.c +++ gnome-control-center-3.28.1/shell/cc-window.c @@ -709,6 +709,31 @@ cc_window_class_init (CcWindowClass *kla g_type_ensure (CC_TYPE_PANEL_LIST); } +/* Taken from 3.38.4 for usage in cc_window_init() */ +static gboolean +_cc_shell_model_has_panel (CcShellModel *model, + const char *id) +{ + GtkTreeIter iter; + gboolean valid; + + g_assert (id); + + valid = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter); + while (valid) + { + g_autofree gchar *panel_id = NULL; + + gtk_tree_model_get (GTK_TREE_MODEL (model), &iter, COL_ID, &panel_id, -1); + if (g_str_equal (id, panel_id)) + return TRUE; + + valid = gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter); + } + + return FALSE; +} + static void cc_window_init (CcWindow *self) { @@ -739,7 +763,7 @@ cc_window_init (CcWindow *self) /* After everything is loaded, select the last used panel, if any, * or the first visible panel */ id = g_settings_get_string (self->settings, "last-panel"); - if (id != NULL && *id != '\0') + if (id != NULL && *id != '\0' && _cc_shell_model_has_panel (CC_SHELL_MODEL (self->store), id)) cc_panel_list_set_active_panel (CC_PANEL_LIST (self->panel_list), id); else cc_panel_list_activate (CC_PANEL_LIST (self->panel_list));