[gnome-control-center/gbsneto/panel-headerbar-cleanup: 6/19] panel: Add "title" property
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gbsneto/panel-headerbar-cleanup: 6/19] panel: Add "title" property
- Date: Thu, 20 Jan 2022 02:23:43 +0000 (UTC)
commit 48a9141bed4b2b381053d9f577e546dffe3ba06e
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Wed Jan 19 13:09:14 2022 -0300
panel: Add "title" property
Will be used by the panel titlebar to have the proper title.
shell/cc-panel-loader.c | 2 ++
shell/cc-panel-loader.h | 1 +
shell/cc-panel.c | 15 +++++++++++++++
shell/cc-window.c | 2 +-
4 files changed, 19 insertions(+), 1 deletion(-)
---
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index ee1c1fd72..f9b834c45 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -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);
}
diff --git a/shell/cc-panel-loader.h b/shell/cc-panel-loader.h
index 1b91832e8..72b3345ed 100644
--- a/shell/cc-panel-loader.h
+++ b/shell/cc-panel-loader.h
@@ -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,
diff --git a/shell/cc-panel.c b/shell/cc-panel.c
index 655bd6fd4..a72c2a377 100644
--- a/shell/cc-panel.c
+++ b/shell/cc-panel.c
@@ -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);
}
diff --git a/shell/cc-window.c b/shell/cc-window.c
index 6185d2403..515c6e81f 100644
--- a/shell/cc-window.c
+++ b/shell/cc-window.c
@@ -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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]