shell: Only try to select an existing panel on startup
When selecting the panel on startup based on the "last-panel" settings, we need to make sure that the panel exists. Note that this is a special case which does not use the internal set_active_panel_from_id API. Using it is currently not possible because the API does not report back the error and we would end up not selecting any panel.
This commit is contained in:
parent
256b4a45c0
commit
f547d9129d
3 changed files with 28 additions and 1 deletions
|
@ -327,6 +327,30 @@ cc_shell_model_add_item (CcShellModel *model,
|
|||
g_strfreev (keywords);
|
||||
}
|
||||
|
||||
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 (model, &iter);
|
||||
while (valid)
|
||||
{
|
||||
g_autofree gchar *panel_id = NULL;
|
||||
|
||||
gtk_tree_model_get (model, &iter, COL_ID, &panel_id, -1);
|
||||
if (g_str_equal (id, panel_id))
|
||||
return TRUE;
|
||||
|
||||
valid = gtk_tree_model_iter_next (model, &iter);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
cc_shell_model_iter_matches_search (CcShellModel *model,
|
||||
GtkTreeIter *iter,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue