shell: Show the submenu icon hint for the applications panel
The panel swarms details/devices/privacy show this icon. Since the applications panel is not made from sub-panels, this doesn't show. For consistency this shows the icon so the transition isn't as jarring for the user. Add a flat into the panel .desktop file to enable this - other panels might require this in the future
This commit is contained in:
parent
acc8aff5d0
commit
5dbbc20918
6 changed files with 26 additions and 7 deletions
|
@ -13,3 +13,4 @@ Categories=GNOME;GTK;Settings;DesktopSettings;X-GNOME-Settings-Panel;X-GNOME-Acc
|
||||||
OnlyShowIn=GNOME;Unity;
|
OnlyShowIn=GNOME;Unity;
|
||||||
# Translators: Search terms to find the Privacy panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
|
# Translators: Search terms to find the Privacy panel. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
|
||||||
Keywords=application;flatpak;permission;setting;
|
Keywords=application;flatpak;permission;setting;
|
||||||
|
X-GNOME-ControlCenter-HasSidebar=true
|
||||||
|
|
|
@ -295,7 +295,8 @@ row_data_new (CcPanelCategory category,
|
||||||
const gchar *description,
|
const gchar *description,
|
||||||
const GStrv keywords,
|
const GStrv keywords,
|
||||||
const gchar *icon,
|
const gchar *icon,
|
||||||
CcPanelVisibility visibility)
|
CcPanelVisibility visibility,
|
||||||
|
gboolean has_sidebar)
|
||||||
{
|
{
|
||||||
GtkWidget *label, *grid, *image;
|
GtkWidget *label, *grid, *image;
|
||||||
RowData *data;
|
RowData *data;
|
||||||
|
@ -343,6 +344,14 @@ row_data_new (CcPanelCategory category,
|
||||||
gtk_label_set_max_width_chars (GTK_LABEL (label), 25);
|
gtk_label_set_max_width_chars (GTK_LABEL (label), 25);
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
||||||
|
|
||||||
|
if (has_sidebar)
|
||||||
|
{
|
||||||
|
image = gtk_image_new_from_icon_name ("go-next-symbolic", GTK_ICON_SIZE_BUTTON);
|
||||||
|
gtk_style_context_add_class (gtk_widget_get_style_context (image), "sidebar-icon");
|
||||||
|
gtk_grid_attach (GTK_GRID (grid), image, 2, 0, 1, 1);
|
||||||
|
gtk_widget_show (image);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
|
gtk_style_context_add_class (gtk_widget_get_style_context (label), "dim-label");
|
||||||
gtk_grid_attach (GTK_GRID (grid), label, 1, 1, 1, 1);
|
gtk_grid_attach (GTK_GRID (grid), label, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
@ -1017,7 +1026,8 @@ cc_panel_list_add_panel (CcPanelList *self,
|
||||||
const gchar *description,
|
const gchar *description,
|
||||||
const GStrv keywords,
|
const GStrv keywords,
|
||||||
const gchar *icon,
|
const gchar *icon,
|
||||||
CcPanelVisibility visibility)
|
CcPanelVisibility visibility,
|
||||||
|
gboolean has_sidebar)
|
||||||
{
|
{
|
||||||
GtkWidget *listbox;
|
GtkWidget *listbox;
|
||||||
RowData *data, *search_data;
|
RowData *data, *search_data;
|
||||||
|
@ -1025,14 +1035,14 @@ cc_panel_list_add_panel (CcPanelList *self,
|
||||||
g_return_if_fail (CC_IS_PANEL_LIST (self));
|
g_return_if_fail (CC_IS_PANEL_LIST (self));
|
||||||
|
|
||||||
/* Add the panel to the proper listbox */
|
/* Add the panel to the proper listbox */
|
||||||
data = row_data_new (category, id, title, description, keywords, icon, visibility);
|
data = row_data_new (category, id, title, description, keywords, icon, visibility, has_sidebar);
|
||||||
gtk_widget_set_visible (data->row, visibility == CC_PANEL_VISIBLE);
|
gtk_widget_set_visible (data->row, visibility == CC_PANEL_VISIBLE);
|
||||||
|
|
||||||
listbox = get_listbox_from_category (self, category);
|
listbox = get_listbox_from_category (self, category);
|
||||||
gtk_container_add (GTK_CONTAINER (listbox), data->row);
|
gtk_container_add (GTK_CONTAINER (listbox), data->row);
|
||||||
|
|
||||||
/* And add to the search listbox too */
|
/* And add to the search listbox too */
|
||||||
search_data = row_data_new (category, id, title, description, keywords, icon, visibility);
|
search_data = row_data_new (category, id, title, description, keywords, icon, visibility, has_sidebar);
|
||||||
gtk_widget_set_visible (search_data->row, visibility != CC_PANEL_HIDDEN);
|
gtk_widget_set_visible (search_data->row, visibility != CC_PANEL_HIDDEN);
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER (self->search_listbox), search_data->row);
|
gtk_container_add (GTK_CONTAINER (self->search_listbox), search_data->row);
|
||||||
|
|
|
@ -61,7 +61,8 @@ void cc_panel_list_add_panel (CcPanelList
|
||||||
const gchar *description,
|
const gchar *description,
|
||||||
const GStrv keywords,
|
const GStrv keywords,
|
||||||
const gchar *icon,
|
const gchar *icon,
|
||||||
CcPanelVisibility visibility);
|
CcPanelVisibility visibility,
|
||||||
|
gboolean has_sidebar);
|
||||||
|
|
||||||
void cc_panel_list_set_active_panel (CcPanelList *self,
|
void cc_panel_list_set_active_panel (CcPanelList *self,
|
||||||
const gchar *id);
|
const gchar *id);
|
||||||
|
|
|
@ -219,7 +219,7 @@ static void
|
||||||
cc_shell_model_init (CcShellModel *self)
|
cc_shell_model_init (CcShellModel *self)
|
||||||
{
|
{
|
||||||
GType types[] = {G_TYPE_STRING, G_TYPE_STRING, G_TYPE_APP_INFO, G_TYPE_STRING, G_TYPE_UINT,
|
GType types[] = {G_TYPE_STRING, G_TYPE_STRING, G_TYPE_APP_INFO, G_TYPE_STRING, G_TYPE_UINT,
|
||||||
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_ICON, G_TYPE_STRV, G_TYPE_UINT };
|
G_TYPE_STRING, G_TYPE_STRING, G_TYPE_ICON, G_TYPE_STRV, G_TYPE_UINT, G_TYPE_BOOLEAN };
|
||||||
|
|
||||||
gtk_list_store_set_column_types (GTK_LIST_STORE (self),
|
gtk_list_store_set_column_types (GTK_LIST_STORE (self),
|
||||||
N_COLS, types);
|
N_COLS, types);
|
||||||
|
@ -286,11 +286,13 @@ cc_shell_model_add_item (CcShellModel *model,
|
||||||
g_auto(GStrv) keywords = NULL;
|
g_auto(GStrv) keywords = NULL;
|
||||||
g_autofree gchar *casefolded_name = NULL;
|
g_autofree gchar *casefolded_name = NULL;
|
||||||
g_autofree gchar *casefolded_description = NULL;
|
g_autofree gchar *casefolded_description = NULL;
|
||||||
|
gboolean has_sidebar;
|
||||||
|
|
||||||
casefolded_name = cc_util_normalize_casefold_and_unaccent (name);
|
casefolded_name = cc_util_normalize_casefold_and_unaccent (name);
|
||||||
casefolded_description = cc_util_normalize_casefold_and_unaccent (comment);
|
casefolded_description = cc_util_normalize_casefold_and_unaccent (comment);
|
||||||
keywords = get_casefolded_keywords (appinfo);
|
keywords = get_casefolded_keywords (appinfo);
|
||||||
icon = symbolicize_g_icon (g_app_info_get_icon (appinfo));
|
icon = symbolicize_g_icon (g_app_info_get_icon (appinfo));
|
||||||
|
has_sidebar = g_desktop_app_info_get_boolean (G_DESKTOP_APP_INFO (appinfo), "X-GNOME-ControlCenter-HasSidebar");
|
||||||
|
|
||||||
gtk_list_store_insert_with_values (GTK_LIST_STORE (model), NULL, 0,
|
gtk_list_store_insert_with_values (GTK_LIST_STORE (model), NULL, 0,
|
||||||
COL_NAME, name,
|
COL_NAME, name,
|
||||||
|
@ -303,6 +305,7 @@ cc_shell_model_add_item (CcShellModel *model,
|
||||||
COL_GICON, icon,
|
COL_GICON, icon,
|
||||||
COL_KEYWORDS, keywords,
|
COL_KEYWORDS, keywords,
|
||||||
COL_VISIBILITY, CC_PANEL_VISIBLE,
|
COL_VISIBILITY, CC_PANEL_VISIBLE,
|
||||||
|
COL_HAS_SIDEBAR, has_sidebar,
|
||||||
-1);
|
-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,6 +54,7 @@ enum
|
||||||
COL_GICON,
|
COL_GICON,
|
||||||
COL_KEYWORDS,
|
COL_KEYWORDS,
|
||||||
COL_VISIBILITY,
|
COL_VISIBILITY,
|
||||||
|
COL_HAS_SIDEBAR,
|
||||||
|
|
||||||
N_COLS
|
N_COLS
|
||||||
};
|
};
|
||||||
|
|
|
@ -351,6 +351,7 @@ setup_model (CcWindow *self)
|
||||||
g_autofree gchar *id = NULL;
|
g_autofree gchar *id = NULL;
|
||||||
g_auto(GStrv) keywords = NULL;
|
g_auto(GStrv) keywords = NULL;
|
||||||
CcPanelVisibility visibility;
|
CcPanelVisibility visibility;
|
||||||
|
gboolean has_sidebar;
|
||||||
const gchar *icon_name = NULL;
|
const gchar *icon_name = NULL;
|
||||||
|
|
||||||
gtk_tree_model_get (model, &iter,
|
gtk_tree_model_get (model, &iter,
|
||||||
|
@ -361,6 +362,7 @@ setup_model (CcWindow *self)
|
||||||
COL_NAME, &name,
|
COL_NAME, &name,
|
||||||
COL_KEYWORDS, &keywords,
|
COL_KEYWORDS, &keywords,
|
||||||
COL_VISIBILITY, &visibility,
|
COL_VISIBILITY, &visibility,
|
||||||
|
COL_HAS_SIDEBAR, &has_sidebar,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
if (G_IS_THEMED_ICON (icon))
|
if (G_IS_THEMED_ICON (icon))
|
||||||
|
@ -373,7 +375,8 @@ setup_model (CcWindow *self)
|
||||||
description,
|
description,
|
||||||
keywords,
|
keywords,
|
||||||
icon_name,
|
icon_name,
|
||||||
visibility);
|
visibility,
|
||||||
|
has_sidebar);
|
||||||
|
|
||||||
valid = gtk_tree_model_iter_next (model, &iter);
|
valid = gtk_tree_model_iter_next (model, &iter);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue