applications: Port to GTK4

This commit is contained in:
Georges Basile Stavracas Neto 2021-10-21 11:21:19 -03:00
parent 6cfd6e0652
commit 696ed350bb
12 changed files with 101 additions and 178 deletions

View file

@ -1,33 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="CcActionRow" parent="GtkListBoxRow"> <template class="CcActionRow" parent="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property> <property name="activatable">False</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property> <property name="margin-top">12</property>
<property name="border-width">12</property> <property name="margin-bottom">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">4</property> <property name="spacing">4</property>
<child> <child>
<object class="GtkLabel" id="title"> <object class="GtkLabel" id="title">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
</object> </object>
<packing>
<property name="expand">1</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel" id="subtitle"> <object class="GtkLabel" id="subtitle">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
@ -40,7 +34,6 @@
</child> </child>
<child> <child>
<object class="GtkButton" id="button"> <object class="GtkButton" id="button">
<property name="visible">1</property>
<property name="valign">center</property> <property name="valign">center</property>
<signal name="clicked" handler="clicked_cb" swapped="yes"/> <signal name="clicked" handler="clicked_cb" swapped="yes"/>
</object> </object>

View file

@ -43,7 +43,6 @@
#include "cc-snap-row.h" #include "cc-snap-row.h"
#endif #endif
#include "globs.h" #include "globs.h"
#include "list-box-helper.h"
#include "search.h" #include "search.h"
#include "utils.h" #include "utils.h"
@ -782,7 +781,7 @@ add_static_permission_row (CcApplicationsPanel *self,
"title", title, "title", title,
"info", subtitle, "info", subtitle,
NULL); NULL);
gtk_container_add (GTK_CONTAINER (self->builtin_list), row); gtk_list_box_append (self->builtin_list, row);
return 1; return 1;
} }
@ -793,8 +792,10 @@ permission_row_activated_cb (CcApplicationsPanel *self,
{ {
if (list_row == GTK_LIST_BOX_ROW (self->builtin)) if (list_row == GTK_LIST_BOX_ROW (self->builtin))
{ {
CcShell *shell = cc_panel_get_shell (CC_PANEL (self));
gtk_window_set_transient_for (GTK_WINDOW (self->builtin_dialog), gtk_window_set_transient_for (GTK_WINDOW (self->builtin_dialog),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)))); GTK_WINDOW (cc_shell_get_toplevel (shell)));
gtk_window_present (GTK_WINDOW (self->builtin_dialog)); gtk_window_present (GTK_WINDOW (self->builtin_dialog));
} }
} }
@ -857,7 +858,7 @@ add_static_permissions (CcApplicationsPanel *self,
static void static void
remove_static_permissions (CcApplicationsPanel *self) remove_static_permissions (CcApplicationsPanel *self)
{ {
container_remove_all (GTK_CONTAINER (self->builtin_list)); listbox_remove_all (self->builtin_list);
} }
static void static void
@ -1431,7 +1432,7 @@ update_handler_sections (CcApplicationsPanel *self,
const gchar **types; const gchar **types;
gint i; gint i;
container_remove_all (GTK_CONTAINER (self->handler_list)); listbox_remove_all (self->handler_list);
self->hypertext = NULL; self->hypertext = NULL;
self->text = NULL; self->text = NULL;
@ -1479,8 +1480,10 @@ storage_row_activated_cb (CcApplicationsPanel *self,
{ {
if (list_row == GTK_LIST_BOX_ROW (self->storage)) if (list_row == GTK_LIST_BOX_ROW (self->storage))
{ {
CcShell *shell = cc_panel_get_shell (CC_PANEL (self));
gtk_window_set_transient_for (GTK_WINDOW (self->storage_dialog), gtk_window_set_transient_for (GTK_WINDOW (self->storage_dialog),
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self)))); GTK_WINDOW (cc_shell_get_toplevel (shell)));
gtk_window_present (GTK_WINDOW (self->storage_dialog)); gtk_window_present (GTK_WINDOW (self->storage_dialog));
} }
} }
@ -1687,7 +1690,7 @@ populate_applications (CcApplicationsPanel *self)
g_autolist(GObject) infos = NULL; g_autolist(GObject) infos = NULL;
GList *l; GList *l;
container_remove_all (GTK_CONTAINER (self->sidebar_listbox)); listbox_remove_all (self->sidebar_listbox);
#ifdef HAVE_MALCONTENT #ifdef HAVE_MALCONTENT
g_signal_handler_block (self->manager, self->app_filter_id); g_signal_handler_block (self->manager, self->app_filter_id);
#endif #endif
@ -1738,15 +1741,18 @@ filter_sidebar_rows (GtkListBoxRow *row,
CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (data); CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (data);
g_autofree gchar *app_name = NULL; g_autofree gchar *app_name = NULL;
g_autofree gchar *search_text = NULL; g_autofree gchar *search_text = NULL;
const gchar *text;
GAppInfo *info; GAppInfo *info;
text = gtk_editable_get_text (GTK_EDITABLE (self->sidebar_search_entry));
/* Only filter after the second character */ /* Only filter after the second character */
if (gtk_entry_get_text_length (self->sidebar_search_entry) < 2) if (g_utf8_strlen (text, -1) < 2)
return TRUE; return TRUE;
info = cc_applications_row_get_info (CC_APPLICATIONS_ROW (row)); info = cc_applications_row_get_info (CC_APPLICATIONS_ROW (row));
app_name = cc_util_normalize_casefold_and_unaccent (g_app_info_get_name (info)); app_name = cc_util_normalize_casefold_and_unaccent (g_app_info_get_name (info));
search_text = cc_util_normalize_casefold_and_unaccent (gtk_entry_get_text (self->sidebar_search_entry)); search_text = cc_util_normalize_casefold_and_unaccent (text);
return g_strstr_len (app_name, -1, search_text) != NULL; return g_strstr_len (app_name, -1, search_text) != NULL;
} }
@ -1802,13 +1808,13 @@ static void
select_app (CcApplicationsPanel *self, select_app (CcApplicationsPanel *self,
const gchar *app_id) const gchar *app_id)
{ {
g_autoptr(GList) children = NULL; GtkWidget *child;
GList *l;
children = gtk_container_get_children (GTK_CONTAINER (self->sidebar_listbox)); for (child = gtk_widget_get_first_child (GTK_WIDGET (self->sidebar_listbox));
for (l = children; l; l = l->next) child;
child = gtk_widget_get_next_sibling (child))
{ {
CcApplicationsRow *row = CC_APPLICATIONS_ROW (l->data); CcApplicationsRow *row = CC_APPLICATIONS_ROW (child);
GAppInfo *info = cc_applications_row_get_info (row); GAppInfo *info = cc_applications_row_get_info (row);
if (g_str_has_prefix (g_app_info_get_id (info), app_id)) if (g_str_has_prefix (g_app_info_get_id (info), app_id))
{ {
@ -1834,7 +1840,7 @@ on_sidebar_search_entry_activated_cb (CcApplicationsPanel *self)
g_signal_emit_by_name (row, "activate"); g_signal_emit_by_name (row, "activate");
/* Cleanup the entry */ /* Cleanup the entry */
gtk_entry_set_text (self->sidebar_search_entry, ""); gtk_editable_set_text (GTK_EDITABLE (self->sidebar_search_entry), "");
gtk_widget_grab_focus (GTK_WIDGET (self->sidebar_search_entry)); gtk_widget_grab_focus (GTK_WIDGET (self->sidebar_search_entry));
} }
@ -1847,7 +1853,7 @@ on_sidebar_search_entry_search_changed_cb (CcApplicationsPanel *self)
static void static void
on_sidebar_search_entry_search_stopped_cb (CcApplicationsPanel *self) on_sidebar_search_entry_search_stopped_cb (CcApplicationsPanel *self)
{ {
gtk_entry_set_text (self->sidebar_search_entry, ""); gtk_editable_set_text (GTK_EDITABLE (self->sidebar_search_entry), "");
} }
static void static void
@ -1929,12 +1935,17 @@ static void
cc_applications_panel_constructed (GObject *object) cc_applications_panel_constructed (GObject *object)
{ {
CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (object); CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (object);
GtkListBoxRow *row;
CcShell *shell; CcShell *shell;
G_OBJECT_CLASS (cc_applications_panel_parent_class)->constructed (object); G_OBJECT_CLASS (cc_applications_panel_parent_class)->constructed (object);
shell = cc_panel_get_shell (CC_PANEL (self)); shell = cc_panel_get_shell (CC_PANEL (self));
cc_shell_embed_widget_in_header (shell, GTK_WIDGET (self->header_button), GTK_POS_RIGHT); cc_shell_embed_widget_in_header (shell, GTK_WIDGET (self->header_button), GTK_POS_RIGHT);
/* Select the first row */
row = gtk_list_box_get_row_at_index (self->sidebar_listbox, 0);
gtk_list_box_select_row (self->sidebar_listbox, row);
} }
static GtkWidget* static GtkWidget*
@ -2040,7 +2051,6 @@ static void
cc_applications_panel_init (CcApplicationsPanel *self) cc_applications_panel_init (CcApplicationsPanel *self)
{ {
g_autoptr(GtkStyleProvider) provider = NULL; g_autoptr(GtkStyleProvider) provider = NULL;
GtkListBoxRow *row;
#ifdef HAVE_MALCONTENT #ifdef HAVE_MALCONTENT
g_autoptr(GDBusConnection) system_bus = NULL; g_autoptr(GDBusConnection) system_bus = NULL;
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
@ -2059,7 +2069,7 @@ cc_applications_panel_init (CcApplicationsPanel *self)
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider),
"/org/gnome/control-center/applications/cc-applications-panel.css"); "/org/gnome/control-center/applications/cc-applications-panel.css");
gtk_style_context_add_provider_for_screen (gdk_screen_get_default (), gtk_style_context_add_provider_for_display (gdk_display_get_default (),
provider, provider,
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
@ -2068,30 +2078,6 @@ cc_applications_panel_init (CcApplicationsPanel *self)
g_signal_connect_object (self->header_button, "clicked", G_CALLBACK (open_software_cb), self, G_CONNECT_SWAPPED); g_signal_connect_object (self->header_button, "clicked", G_CALLBACK (open_software_cb), self, G_CONNECT_SWAPPED);
gtk_list_box_set_header_func (self->permission_list,
cc_list_box_update_header_func,
NULL, NULL);
gtk_list_box_set_header_func (self->integration_list,
cc_list_box_update_header_func,
NULL, NULL);
gtk_list_box_set_header_func (self->handler_list,
cc_list_box_update_header_func,
NULL, NULL);
gtk_list_box_set_header_func (self->usage_list,
cc_list_box_update_header_func,
NULL, NULL);
gtk_list_box_set_header_func (self->builtin_list,
cc_list_box_update_header_func,
NULL, NULL);
gtk_list_box_set_header_func (self->storage_list,
cc_list_box_update_header_func,
NULL, NULL);
gtk_list_box_set_sort_func (self->sidebar_listbox, gtk_list_box_set_sort_func (self->sidebar_listbox,
compare_rows, compare_rows,
NULL, NULL); NULL, NULL);
@ -2145,9 +2131,4 @@ cc_applications_panel_init (CcApplicationsPanel *self)
self->globs = parse_globs (); self->globs = parse_globs ();
self->search_providers = parse_search_providers (); self->search_providers = parse_search_providers ();
/* Select the first row */
row = gtk_list_box_get_row_at_index (self->sidebar_listbox, 0);
gtk_list_box_select_row (self->sidebar_listbox, row);
g_signal_emit_by_name (row, "activate");
} }

View file

@ -1,30 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="CcApplicationsPanel" parent="CcPanel"> <template class="CcApplicationsPanel" parent="CcPanel">
<property name="visible">True</property>
<property name="can-focus">False</property>
<child> <child>
<object class="GtkScrolledWindow" id="main_scroll"> <object class="GtkScrolledWindow" id="main_scroll">
<property name="visible">1</property>
<property name="hscrollbar-policy">never</property> <property name="hscrollbar-policy">never</property>
<child> <child>
<object class="HdyClamp"> <object class="AdwClamp">
<property name="visible">True</property>
<property name="margin_top">32</property> <property name="margin_top">32</property>
<property name="margin_bottom">32</property> <property name="margin_bottom">32</property>
<property name="margin_start">12</property> <property name="margin_start">12</property>
<property name="margin_end">12</property> <property name="margin_end">12</property>
<child> <child>
<object class="GtkStack" id="stack"> <object class="GtkStack" id="stack">
<property name="visible">1</property>
<child> <child>
<object class="GtkBox" id="empty_box"> <object class="GtkBox" id="empty_box">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="valign">center</property> <property name="valign">center</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="visible">1</property>
<property name="valign">start</property> <property name="valign">start</property>
<property name="pixel-size">80</property> <property name="pixel-size">80</property>
<property name="icon-name">org.gnome.Software-symbolic</property> <property name="icon-name">org.gnome.Software-symbolic</property>
@ -32,13 +26,9 @@
<class name="dim-label"/> <class name="dim-label"/>
</style> </style>
</object> </object>
<packing>
<property name="fill">0</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property>
<property name="margin-bottom">15</property> <property name="margin-bottom">15</property>
<property name="label" translatable="yes">No applications</property> <property name="label" translatable="yes">No applications</property>
<style> <style>
@ -48,35 +38,24 @@
<attribute name="scale" value="1.2"/> <attribute name="scale" value="1.2"/>
</attributes> </attributes>
</object> </object>
<packing>
<property name="position">1</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="install_button"> <object class="GtkButton" id="install_button">
<property name="label" translatable="yes">Install some…</property> <property name="label" translatable="yes">Install some…</property>
<property name="visible">1</property>
<property name="can-focus">1</property>
<property name="receives-default">1</property> <property name="receives-default">1</property>
<property name="halign">center</property> <property name="halign">center</property>
<signal name="clicked" handler="open_software_cb" object="CcApplicationsPanel" swapped="yes"/> <signal name="clicked" handler="open_software_cb" object="CcApplicationsPanel" swapped="yes"/>
</object> </object>
<packing>
<property name="fill">0</property>
<property name="position">2</property>
</packing>
</child> </child>
</object> </object>
</child> </child>
<child> <child>
<object class="GtkBox" id="settings_box"> <object class="GtkBox" id="settings_box">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">24</property> <property name="spacing">24</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
<child> <child>
<object class="GtkBox" id="permission_section"> <object class="GtkBox" id="permission_section">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<style> <style>
@ -84,12 +63,10 @@
</style> </style>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">6</property> <property name="spacing">6</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Permissions &amp; Access</property> <property name="label" translatable="yes">Permissions &amp; Access</property>
<style> <style>
@ -99,7 +76,6 @@
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="wrap">1</property> <property name="wrap">1</property>
<property name="max-width-chars">50</property> <property name="max-width-chars">50</property>
@ -113,9 +89,11 @@
</child> </child>
<child> <child>
<object class="GtkListBox" id="permission_list"> <object class="GtkListBox" id="permission_list">
<property name="visible">1</property>
<property name="selection-mode">none</property> <property name="selection-mode">none</property>
<signal name="row-activated" handler="permission_row_activated_cb" object="CcApplicationsPanel" swapped="yes"/> <signal name="row-activated" handler="permission_row_activated_cb" object="CcApplicationsPanel" swapped="yes"/>
<style>
<class name="content"/>
</style>
<child> <child>
<object class="CcToggleRow" id="camera"> <object class="CcToggleRow" id="camera">
<property name="title" translatable="yes">Camera</property> <property name="title" translatable="yes">Camera</property>
@ -168,7 +146,6 @@
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="wrap">1</property> <property name="wrap">1</property>
<property name="max-width-chars">50</property> <property name="max-width-chars">50</property>
@ -181,7 +158,6 @@
</child> </child>
<child> <child>
<object class="GtkBox" id="integration_section"> <object class="GtkBox" id="integration_section">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<style> <style>
@ -189,12 +165,10 @@
</style> </style>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">6</property> <property name="spacing">6</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Integration</property> <property name="label" translatable="yes">Integration</property>
<style> <style>
@ -204,7 +178,6 @@
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="wrap">1</property> <property name="wrap">1</property>
<property name="max-width-chars">50</property> <property name="max-width-chars">50</property>
@ -218,8 +191,10 @@
</child> </child>
<child> <child>
<object class="GtkListBox" id="integration_list"> <object class="GtkListBox" id="integration_list">
<property name="visible">1</property>
<property name="selection-mode">none</property> <property name="selection-mode">none</property>
<style>
<class name="content"/>
</style>
<child> <child>
<object class="CcToggleRow" id="search"> <object class="CcToggleRow" id="search">
<property name="title" translatable="yes">Search</property> <property name="title" translatable="yes">Search</property>
@ -278,7 +253,6 @@
</child> </child>
<child> <child>
<object class="GtkBox" id="handler_section"> <object class="GtkBox" id="handler_section">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<style> <style>
@ -286,16 +260,13 @@
</style> </style>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property>
<property name="spacing">6</property> <property name="spacing">6</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">6</property> <property name="spacing">6</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Default Handlers</property> <property name="label" translatable="yes">Default Handlers</property>
<style> <style>
@ -305,7 +276,7 @@
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property> <property name="hexpand">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="wrap">1</property> <property name="wrap">1</property>
<property name="max-width-chars">50</property> <property name="max-width-chars">50</property>
@ -316,13 +287,9 @@
</object> </object>
</child> </child>
</object> </object>
<packing>
<property name="expand">1</property>
</packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="handler_reset"> <object class="GtkButton" id="handler_reset">
<property name="visible">1</property>
<property name="halign">end</property> <property name="halign">end</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="label" translatable="yes">Reset</property> <property name="label" translatable="yes">Reset</property>
@ -333,12 +300,10 @@
</child> </child>
<child> <child>
<object class="GtkListBox" id="handler_list"> <object class="GtkListBox" id="handler_list">
<property name="visible">1</property>
<property name="selection-mode">none</property> <property name="selection-mode">none</property>
<signal name="row-activated" handler="handler_row_activated_cb" object="CcApplicationsPanel" swapped="yes"/> <signal name="row-activated" handler="handler_row_activated_cb" object="CcApplicationsPanel" swapped="yes"/>
<style> <style>
<class name="view"/> <class name="content"/>
<class name="frame"/>
</style> </style>
</object> </object>
</child> </child>
@ -346,7 +311,6 @@
</child> </child>
<child> <child>
<object class="GtkBox" id="usage_section"> <object class="GtkBox" id="usage_section">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<style> <style>
@ -354,12 +318,10 @@
</style> </style>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">6</property> <property name="spacing">6</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Usage</property> <property name="label" translatable="yes">Usage</property>
<style> <style>
@ -369,7 +331,6 @@
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="wrap">1</property> <property name="wrap">1</property>
<property name="max-width-chars">50</property> <property name="max-width-chars">50</property>
@ -383,9 +344,11 @@
</child> </child>
<child> <child>
<object class="GtkListBox" id="usage_list"> <object class="GtkListBox" id="usage_list">
<property name="visible">1</property>
<property name="selection-mode">none</property> <property name="selection-mode">none</property>
<signal name="row-activated" handler="storage_row_activated_cb" object="CcApplicationsPanel" swapped="yes"/> <signal name="row-activated" handler="storage_row_activated_cb" object="CcApplicationsPanel" swapped="yes"/>
<style>
<class name="content"/>
</style>
<child> <child>
<object class="CcInfoRow" id="storage"> <object class="CcInfoRow" id="storage">
<property name="title" translatable="yes">Storage</property> <property name="title" translatable="yes">Storage</property>
@ -412,7 +375,6 @@
</child> </child>
</template> </template>
<object class="GtkLabel" id="title_label"> <object class="GtkLabel" id="title_label">
<property name="visible">1</property>
<property name="label" translatable="yes">Applications</property> <property name="label" translatable="yes">Applications</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
<style> <style>
@ -420,21 +382,18 @@
</style> </style>
</object> </object>
<object class="GtkButton" id="header_button"> <object class="GtkButton" id="header_button">
<property name="visible">1</property>
<property name="label" translatable="yes">Open in Software</property> <property name="label" translatable="yes">Open in Software</property>
</object> </object>
<!-- Sidebar --> <!-- Sidebar -->
<object class="GtkBox" id="sidebar_box"> <object class="GtkBox" id="sidebar_box">
<property name="visible">True</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<child> <child>
<object class="GtkSearchEntry" id="sidebar_search_entry"> <object class="GtkSearchEntry" id="sidebar_search_entry">
<property name="visible">True</property> <property name="margin-top">12</property>
<property name="can-focus">True</property>
<property name="has-focus">True</property>
<property name="margin">12</property>
<property name="margin-bottom">6</property> <property name="margin-bottom">6</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<signal name="activate" handler="on_sidebar_search_entry_activated_cb" object="CcApplicationsPanel" swapped="yes" /> <signal name="activate" handler="on_sidebar_search_entry_activated_cb" object="CcApplicationsPanel" swapped="yes" />
<signal name="search-changed" handler="on_sidebar_search_entry_search_changed_cb" object="CcApplicationsPanel" swapped="yes" /> <signal name="search-changed" handler="on_sidebar_search_entry_search_changed_cb" object="CcApplicationsPanel" swapped="yes" />
<signal name="stop-search" handler="on_sidebar_search_entry_search_stopped_cb" object="CcApplicationsPanel" swapped="yes" /> <signal name="stop-search" handler="on_sidebar_search_entry_search_stopped_cb" object="CcApplicationsPanel" swapped="yes" />
@ -442,23 +401,27 @@
</child> </child>
<child> <child>
<object class="GtkListBox" id="sidebar_listbox"> <object class="GtkListBox" id="sidebar_listbox">
<property name="visible">True</property>
<property name="vexpand">True</property> <property name="vexpand">True</property>
<property name="selection-mode">browse</property> <property name="selection-mode">browse</property>
<style>
<class name="navigation-sidebar" />
</style>
<child type="placeholder"> <child type="placeholder">
<object class="GtkBox" id="empty_search_placeholder"> <object class="GtkBox" id="empty_search_placeholder">
<property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="halign">center</property> <property name="halign">center</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="expand">True</property> <property name="hexpand">True</property>
<property name="border_width">18</property> <property name="vexpand">True</property>
<property name="margin-top">18</property>
<property name="margin-bottom">18</property>
<property name="margin-start">18</property>
<property name="margin-end">18</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">6</property> <property name="spacing">6</property>
<child> <child>
<object class="GtkImage"> <object class="GtkImage">
<property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="pixel_size">64</property> <property name="pixel_size">64</property>
<property name="icon_name">edit-find-symbolic</property> <property name="icon_name">edit-find-symbolic</property>
@ -469,7 +432,6 @@
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">No results found</property> <property name="label" translatable="yes">No results found</property>
<attributes> <attributes>
@ -480,7 +442,6 @@
</child> </child>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">Try a different search</property> <property name="label" translatable="yes">Try a different search</property>
<style> <style>
@ -499,19 +460,19 @@
<object class="GtkDialog" id="builtin_dialog"> <object class="GtkDialog" id="builtin_dialog">
<property name="title" translatable="yes">Built-in Permissions</property> <property name="title" translatable="yes">Built-in Permissions</property>
<property name="modal">1</property> <property name="modal">1</property>
<property name="type-hint">dialog</property>
<property name="use-header-bar">1</property> <property name="use-header-bar">1</property>
<property name="resizable">0</property> <property name="resizable">0</property>
<property name="border-width">24</property> <property name="hide-on-close">True</property>
<signal name="delete-event" handler="gtk_widget_hide_on_delete"/> <child>
<child internal-child="vbox">
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property> <property name="margin-top">24</property>
<property name="margin-bottom">24</property>
<property name="margin-start">24</property>
<property name="margin-end">24</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child>
<object class="GtkLabel" id="builtin_label"> <object class="GtkLabel" id="builtin_label">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="wrap">1</property> <property name="wrap">1</property>
<property name="max-width-chars">50</property> <property name="max-width-chars">50</property>
@ -520,11 +481,9 @@
</child> </child>
<child> <child>
<object class="GtkListBox" id="builtin_list"> <object class="GtkListBox" id="builtin_list">
<property name="visible">1</property>
<property name="selection-mode">none</property> <property name="selection-mode">none</property>
<style> <style>
<class name="view"/> <class name="content"/>
<class name="frame"/>
</style> </style>
</object> </object>
</child> </child>
@ -536,19 +495,19 @@
<object class="GtkDialog" id="storage_dialog"> <object class="GtkDialog" id="storage_dialog">
<property name="title" translatable="yes">Storage</property> <property name="title" translatable="yes">Storage</property>
<property name="modal">1</property> <property name="modal">1</property>
<property name="type-hint">dialog</property>
<property name="use-header-bar">1</property> <property name="use-header-bar">1</property>
<property name="resizable">0</property> <property name="resizable">0</property>
<property name="border-width">24</property> <property name="hide-on-close">True</property>
<signal name="delete-event" handler="gtk_widget_hide_on_delete"/> <child>
<child internal-child="vbox">
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property> <property name="margin-top">24</property>
<property name="margin-bottom">24</property>
<property name="margin-start">24</property>
<property name="margin-end">24</property>
<property name="orientation">vertical</property> <property name="orientation">vertical</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child>
<object class="GtkLabel"> <object class="GtkLabel">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="wrap">1</property> <property name="wrap">1</property>
<property name="max-width-chars">50</property> <property name="max-width-chars">50</property>
@ -557,8 +516,10 @@
</child> </child>
<child> <child>
<object class="GtkListBox" id="storage_list"> <object class="GtkListBox" id="storage_list">
<property name="visible">1</property>
<property name="selection-mode">none</property> <property name="selection-mode">none</property>
<style>
<class name="content"/>
</style>
<child> <child>
<object class="CcInfoRow" id="app"> <object class="CcInfoRow" id="app">
<property name="title" translatable="yes">Application</property> <property name="title" translatable="yes">Application</property>
@ -592,16 +553,11 @@
</child> </child>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property>
<child> <child>
<object class="GtkButton" id="clear_cache_button"> <object class="GtkButton" id="clear_cache_button">
<property name="visible">1</property>
<property name="label" translatable="yes">Clear Cache…</property> <property name="label" translatable="yes">Clear Cache…</property>
<signal name="clicked" handler="clear_cache_cb" object="CcApplicationsPanel" swapped="yes"/> <signal name="clicked" handler="clear_cache_cb" object="CcApplicationsPanel" swapped="yes"/>
</object> </object>
<packing>
<property name="pack-type">end</property>
</packing>
</child> </child>
</object> </object>
</child> </child>

View file

@ -86,9 +86,9 @@ cc_applications_row_new (GAppInfo *info)
icon = g_app_info_get_icon (info); icon = g_app_info_get_icon (info);
if (icon != NULL) if (icon != NULL)
gtk_image_set_from_gicon (GTK_IMAGE (self->image), g_app_info_get_icon (info), GTK_ICON_SIZE_BUTTON); gtk_image_set_from_gicon (GTK_IMAGE (self->image), g_app_info_get_icon (info));
else else
gtk_image_set_from_icon_name (GTK_IMAGE (self->image), "application-x-executable", GTK_ICON_SIZE_BUTTON); gtk_image_set_from_icon_name (GTK_IMAGE (self->image), "application-x-executable");
gtk_label_set_label (GTK_LABEL (self->label), g_app_info_get_display_name (info)); gtk_label_set_label (GTK_LABEL (self->label), g_app_info_get_display_name (info));

View file

@ -1,16 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="CcApplicationsRow" parent="GtkListBoxRow"> <template class="CcApplicationsRow" parent="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<child> <child>
<object class="GtkBox" id="box"> <object class="GtkBox" id="box">
<property name="visible">1</property> <property name="margin-top">6</property>
<property name="border-width">6</property> <property name="margin-bottom">6</property>
<property name="margin-start">6</property>
<property name="margin-end">6</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child>
<object class="GtkImage" id="image"> <object class="GtkImage" id="image">
<property name="visible">1</property>
<property name="pixel-size">32</property> <property name="pixel-size">32</property>
<style> <style>
<class name="sidebar-icon"/> <class name="sidebar-icon"/>
@ -21,7 +20,6 @@
</child> </child>
<child> <child>
<object class="GtkLabel" id="label"> <object class="GtkLabel" id="label">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
</object> </object>

View file

@ -87,11 +87,11 @@ static void
update_expander (CcInfoRow *row) update_expander (CcInfoRow *row)
{ {
if (row->link) if (row->link)
gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "go-next-symbolic", GTK_ICON_SIZE_BUTTON); gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "go-next-symbolic");
else if (row->expanded) else if (row->expanded)
gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "pan-down-symbolic", GTK_ICON_SIZE_BUTTON); gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "pan-down-symbolic");
else else
gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "pan-end-symbolic", GTK_ICON_SIZE_BUTTON); gtk_image_set_from_icon_name (GTK_IMAGE (row->expander), "pan-end-symbolic");
} }
static void static void

View file

@ -1,17 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="CcInfoRow" parent="GtkListBoxRow"> <template class="CcInfoRow" parent="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property> <property name="activatable">False</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property> <property name="margin-top">12</property>
<property name="border-width">12</property> <property name="margin-bottom">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child>
<object class="GtkLabel" id="title"> <object class="GtkLabel" id="title">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
@ -19,7 +18,6 @@
</child> </child>
<child> <child>
<object class="GtkLabel" id="info"> <object class="GtkLabel" id="info">
<property name="visible">1</property>
<property name="valign">center</property> <property name="valign">center</property>
<style> <style>
<class name="dim-label"/> <class name="dim-label"/>
@ -28,6 +26,7 @@
</child> </child>
<child> <child>
<object class="GtkImage" id="expander"> <object class="GtkImage" id="expander">
<property name="visible">False</property>
<property name="valign">center</property> <property name="valign">center</property>
<property name="icon-name">pan-end-symbolic</property> <property name="icon-name">pan-end-symbolic</property>
<style> <style>

View file

@ -1,17 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<interface> <interface>
<template class="CcToggleRow" parent="GtkListBoxRow"> <template class="CcToggleRow" parent="GtkListBoxRow">
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="activatable">False</property> <property name="activatable">False</property>
<child> <child>
<object class="GtkBox"> <object class="GtkBox">
<property name="visible">1</property> <property name="margin-top">12</property>
<property name="border-width">12</property> <property name="margin-bottom">12</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="spacing">12</property> <property name="spacing">12</property>
<child> <child>
<object class="GtkLabel" id="title"> <object class="GtkLabel" id="title">
<property name="visible">1</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="hexpand">1</property> <property name="hexpand">1</property>
<property name="ellipsize">end</property> <property name="ellipsize">end</property>
@ -19,7 +18,6 @@
</child> </child>
<child> <child>
<object class="GtkSwitch" id="toggle"> <object class="GtkSwitch" id="toggle">
<property name="visible">1</property>
<property name="valign">center</property> <property name="valign">center</property>
<signal name="notify::active" handler="changed_cb" swapped="yes"/> <signal name="notify::active" handler="changed_cb" swapped="yes"/>
</object> </object>

View file

@ -143,14 +143,12 @@ file_size_finish (GFile *file,
} }
void void
container_remove_all (GtkContainer *container) listbox_remove_all (GtkListBox *listbox)
{ {
g_autoptr(GList) children = NULL; GtkWidget *child;
GList *l;
children = gtk_container_get_children (container); while ((child = gtk_widget_get_first_child (GTK_WIDGET (listbox))))
for (l = children; l; l = l->next) gtk_list_box_remove (listbox, child);
gtk_widget_destroy (GTK_WIDGET (l->data));
} }
static gchar * static gchar *

View file

@ -44,7 +44,7 @@ gboolean file_size_finish (GFile *file,
guint64 *size, guint64 *size,
GError **error); GError **error);
void container_remove_all (GtkContainer *container); void listbox_remove_all (GtkListBox *listbox);
GKeyFile* get_flatpak_metadata (const gchar *app_id); GKeyFile* get_flatpak_metadata (const gchar *app_id);

View file

@ -1,7 +1,7 @@
subdir('common') subdir('common')
panels = [ panels = [
# 'applications', 'applications',
# 'background', # 'background',
'camera', 'camera',
# 'color', # 'color',

View file

@ -31,7 +31,7 @@
#ifndef CC_PANEL_LOADER_NO_GTYPES #ifndef CC_PANEL_LOADER_NO_GTYPES
/* Extension points */ /* Extension points */
//extern GType cc_applications_panel_get_type (void); extern GType cc_applications_panel_get_type (void);
//extern GType cc_background_panel_get_type (void); //extern GType cc_background_panel_get_type (void);
#ifdef BUILD_BLUETOOTH #ifdef BUILD_BLUETOOTH
//extern GType cc_bluetooth_panel_get_type (void); //extern GType cc_bluetooth_panel_get_type (void);
@ -97,7 +97,7 @@ extern GType cc_lock_panel_get_type (void);
static CcPanelLoaderVtable default_panels[] = static CcPanelLoaderVtable default_panels[] =
{ {
//PANEL_TYPE("applications", cc_applications_panel_get_type, NULL), PANEL_TYPE("applications", cc_applications_panel_get_type, NULL),
//PANEL_TYPE("background", cc_background_panel_get_type, NULL), //PANEL_TYPE("background", cc_background_panel_get_type, NULL),
#ifdef BUILD_BLUETOOTH #ifdef BUILD_BLUETOOTH
//PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type, NULL), //PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type, NULL),