window: Delegate model creation to CcApplication
In order be able to modify panel information statically, we need to have access to the CcShellModel from static functions. CcApplication, thus, is a better place for the model to live, since we can access it outside any scope using g_application_get_default(). It also makes sense from the modeling point of view, since the model is not tied to the shell anymore.
This commit is contained in:
parent
b261bcaf99
commit
489a7ae5dd
4 changed files with 81 additions and 30 deletions
|
@ -39,6 +39,8 @@ struct _CcApplication
|
|||
{
|
||||
GtkApplication parent;
|
||||
|
||||
CcShellModel *model;
|
||||
|
||||
CcWindow *window;
|
||||
};
|
||||
|
||||
|
@ -259,7 +261,8 @@ cc_application_startup (GApplication *application)
|
|||
gtk_application_set_accels_for_action (GTK_APPLICATION (application),
|
||||
"app.help", help_accels);
|
||||
|
||||
self->window = cc_window_new (GTK_APPLICATION (application));
|
||||
self->model = cc_shell_model_new ();
|
||||
self->window = cc_window_new (GTK_APPLICATION (application), self->model);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -320,3 +323,11 @@ cc_application_new (void)
|
|||
"flags", G_APPLICATION_HANDLES_COMMAND_LINE,
|
||||
NULL);
|
||||
}
|
||||
|
||||
CcShellModel *
|
||||
cc_application_get_model (CcApplication *self)
|
||||
{
|
||||
g_return_val_if_fail (CC_IS_APPLICATION (self), NULL);
|
||||
|
||||
return self->model;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue