panel: Add "title" property
Will be used by the panel titlebar to have the proper title.
This commit is contained in:
parent
7476bef815
commit
48a9141bed
4 changed files with 19 additions and 1 deletions
|
@ -218,6 +218,7 @@ ensure_panel_types (void)
|
|||
CcPanel *
|
||||
cc_panel_loader_load_by_name (CcShell *shell,
|
||||
const gchar *name,
|
||||
const gchar *title,
|
||||
GVariant *parameters)
|
||||
{
|
||||
GType (*get_type) (void);
|
||||
|
@ -230,6 +231,7 @@ cc_panel_loader_load_by_name (CcShell *shell,
|
|||
return g_object_new (get_type (),
|
||||
"shell", shell,
|
||||
"parameters", parameters,
|
||||
"title", title,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ void cc_panel_loader_fill_model (CcShellModel *model);
|
|||
void cc_panel_loader_list_panels (void);
|
||||
CcPanel *cc_panel_loader_load_by_name (CcShell *shell,
|
||||
const char *name,
|
||||
const gchar *title,
|
||||
GVariant *parameters);
|
||||
|
||||
void cc_panel_loader_override_vtable (CcPanelLoaderVtable *override_vtable,
|
||||
|
|
|
@ -45,6 +45,7 @@ typedef struct
|
|||
CcShell *shell;
|
||||
GCancellable *cancellable;
|
||||
gboolean folded;
|
||||
gchar *title;
|
||||
} CcPanelPrivate;
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (CcPanel, cc_panel, ADW_TYPE_BIN)
|
||||
|
@ -61,6 +62,7 @@ enum
|
|||
PROP_SHELL,
|
||||
PROP_PARAMETERS,
|
||||
PROP_FOLDED,
|
||||
PROP_TITLE,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
|
@ -112,6 +114,10 @@ cc_panel_set_property (GObject *object,
|
|||
break;
|
||||
}
|
||||
|
||||
case PROP_TITLE:
|
||||
priv->title = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_FOLDED:
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
|
@ -137,6 +143,10 @@ cc_panel_get_property (GObject *object,
|
|||
g_value_set_boolean (value, priv->folded);
|
||||
break;
|
||||
|
||||
case PROP_TITLE:
|
||||
g_value_set_string (value, priv->title);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
|
@ -151,6 +161,8 @@ cc_panel_finalize (GObject *object)
|
|||
g_cancellable_cancel (priv->cancellable);
|
||||
g_clear_object (&priv->cancellable);
|
||||
|
||||
g_clear_pointer (&priv->title, g_free);
|
||||
|
||||
G_OBJECT_CLASS (cc_panel_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -187,6 +199,9 @@ cc_panel_class_init (CcPanelClass *klass)
|
|||
NULL,
|
||||
G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
properties[PROP_TITLE] = g_param_spec_string ("title", NULL, NULL, NULL,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ activate_panel (CcWindow *self,
|
|||
|
||||
if (self->current_panel)
|
||||
g_signal_handlers_disconnect_by_data (self->current_panel, self);
|
||||
self->current_panel = GTK_WIDGET (cc_panel_loader_load_by_name (CC_SHELL (self), id, parameters));
|
||||
self->current_panel = GTK_WIDGET (cc_panel_loader_load_by_name (CC_SHELL (self), id, name, parameters));
|
||||
cc_panel_set_folded (CC_PANEL (self->current_panel), adw_leaflet_get_folded (self->main_leaflet));
|
||||
cc_shell_set_active_panel (CC_SHELL (self), CC_PANEL (self->current_panel));
|
||||
gtk_widget_show (self->current_panel);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue