[gnome-control-center/wip/applications: 10/17] Introduce Applications panel



commit aa81e174dabae835cc3861fb6ffb90d7fdb2ea02
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Nov 16 15:42:54 2018 -0200

    Introduce Applications panel
    
    WIP

 panels/applications/applications.gresource.xml     |  6 ++
 panels/applications/cc-applications-panel.c        | 70 ++++++++++++++++++++++
 panels/applications/cc-applications-panel.h        | 30 ++++++++++
 panels/applications/cc-applications-panel.ui       | 13 ++++
 .../gnome-applications-panel.desktop.in.in         | 15 +++++
 panels/applications/meson.build                    | 42 +++++++++++++
 panels/meson.build                                 |  1 +
 shell/cc-panel-list.c                              |  1 +
 shell/cc-panel-loader.c                            |  2 +
 9 files changed, 180 insertions(+)
---
diff --git a/panels/applications/applications.gresource.xml b/panels/applications/applications.gresource.xml
new file mode 100644
index 000000000..e8eaa733f
--- /dev/null
+++ b/panels/applications/applications.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/control-center/applications">
+    <file preprocess="xml-stripblanks">cc-applications-panel.ui</file>
+  </gresource>
+</gresources>
diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c
new file mode 100644
index 000000000..f69ca61c8
--- /dev/null
+++ b/panels/applications/cc-applications-panel.c
@@ -0,0 +1,70 @@
+/* cc-applications-panel.c
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#include "cc-applications-panel.h"
+#include "cc-applications-resources.h"
+
+struct _CcApplicationsPanel
+{
+  CcPanel     parent;
+
+  GtkListBox *sidebar_listbox;
+};
+
+G_DEFINE_TYPE (CcApplicationsPanel, cc_applications_panel, CC_TYPE_PANEL)
+
+static void
+cc_applications_panel_finalize (GObject *object)
+{
+  CcApplicationsPanel *self = (CcApplicationsPanel *)object;
+
+  G_OBJECT_CLASS (cc_applications_panel_parent_class)->finalize (object);
+}
+
+static GtkWidget*
+cc_applications_panel_get_sidebar_widget (CcPanel *panel)
+{
+  CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (panel);
+  return GTK_WIDGET (self->sidebar_listbox);
+}
+
+static void
+cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
+{
+  CcPanelClass *panel_class = CC_PANEL_CLASS (klass);
+  GObjectClass *object_class = G_OBJECT_CLASS (klass);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+  object_class->finalize = cc_applications_panel_finalize;
+
+  panel_class->get_sidebar_widget = cc_applications_panel_get_sidebar_widget;
+
+  gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/applications/cc-applications-panel.ui");
+
+  gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, sidebar_listbox);
+}
+
+static void
+cc_applications_panel_init (CcApplicationsPanel *self)
+{
+  g_resources_register (cc_applications_get_resource ());
+
+  gtk_widget_init_template (GTK_WIDGET (self));
+}
diff --git a/panels/applications/cc-applications-panel.h b/panels/applications/cc-applications-panel.h
new file mode 100644
index 000000000..c6c88825b
--- /dev/null
+++ b/panels/applications/cc-applications-panel.h
@@ -0,0 +1,30 @@
+/* cc-applications-panel.h
+ *
+ * Copyright 2018 Georges Basile Stavracas Neto <georges stavracas gmail com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include <shell/cc-panel.h>
+
+G_BEGIN_DECLS
+
+#define CC_TYPE_APPLICATIONS_PANEL (cc_applications_panel_get_type())
+G_DECLARE_FINAL_TYPE (CcApplicationsPanel, cc_applications_panel, CC, APPLICATIONS_PANEL, CcPanel)
+
+G_END_DECLS
diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui
new file mode 100644
index 000000000..188f61f3e
--- /dev/null
+++ b/panels/applications/cc-applications-panel.ui
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="CcApplicationsPanel" parent="CcPanel">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+  </template>
+
+  <!-- Sidebar listbox -->
+  <object class="GtkListBox" id="sidebar_listbox">
+    <property name="visible">True</property>
+    <property name="selection-mode">browse</property>
+  </object>
+</interface>
diff --git a/panels/applications/gnome-applications-panel.desktop.in.in 
b/panels/applications/gnome-applications-panel.desktop.in.in
new file mode 100644
index 000000000..76ccda921
--- /dev/null
+++ b/panels/applications/gnome-applications-panel.desktop.in.in
@@ -0,0 +1,15 @@
+[Desktop Entry]
+Name=Applications
+Comment=Control various application permissions and settings
+Exec=gnome-control-center applications
+# FIXME
+# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
+Icon=application-x-executable-symbolic
+Terminal=false
+Type=Application
+NoDisplay=true
+StartupNotify=true
+Categories=GNOME;GTK;Settings;DesktopSettings;X-GNOME-Settings-Panel;X-GNOME-AccountSettings;
+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!
+Keywords=application;flatpak;permission;setting;
diff --git a/panels/applications/meson.build b/panels/applications/meson.build
new file mode 100644
index 000000000..49e9e6088
--- /dev/null
+++ b/panels/applications/meson.build
@@ -0,0 +1,42 @@
+panels_list += cappletname
+desktop = 'gnome-@0@-panel.desktop'.format(cappletname)
+
+desktop_in = configure_file(
+          input : desktop + '.in.in',
+         output : desktop + '.in',
+  configuration : desktop_conf
+)
+
+i18n.merge_file(
+       desktop,
+         type : 'desktop',
+        input : desktop_in,
+       output : desktop,
+       po_dir : po_dir,
+      install : true,
+  install_dir : control_center_desktopdir
+)
+
+sources = files('cc-applications-panel.c')
+
+resource_data = files('cc-applications-panel.ui')
+
+sources += gnome.compile_resources(
+  'cc-' + cappletname + '-resources',
+  cappletname + '.gresource.xml',
+        c_name : 'cc_' + cappletname,
+  dependencies : resource_data,
+        export : true
+)
+
+deps = common_deps
+
+cflags += '-DGNOMELOCALEDIR="@0@"'.format(control_center_localedir)
+
+panels_libs += static_library(
+           cappletname,
+              sources : sources,
+  include_directories : top_inc,
+         dependencies : deps,
+               c_args : cflags
+)
diff --git a/panels/meson.build b/panels/meson.build
index 37a343642..95a44bb9d 100644
--- a/panels/meson.build
+++ b/panels/meson.build
@@ -1,6 +1,7 @@
 subdir('common')
 
 panels = [
+  'applications',
   'background',
   'color',
   'datetime',
diff --git a/shell/cc-panel-list.c b/shell/cc-panel-list.c
index 17899d44e..5bdc4c899 100644
--- a/shell/cc-panel-list.c
+++ b/shell/cc-panel-list.c
@@ -386,6 +386,7 @@ static const gchar * const panel_order[] = {
   "universal-access",
   "online-accounts",
   "privacy",
+  "applications",
   "sharing",
   "sound",
   "power",
diff --git a/shell/cc-panel-loader.c b/shell/cc-panel-loader.c
index 2798735c4..5eeb44e60 100644
--- a/shell/cc-panel-loader.c
+++ b/shell/cc-panel-loader.c
@@ -31,6 +31,7 @@
 #ifndef CC_PANEL_LOADER_NO_GTYPES
 
 /* Extension points */
+extern GType cc_applications_panel_get_type (void);
 extern GType cc_background_panel_get_type (void);
 #ifdef BUILD_BLUETOOTH
 extern GType cc_bluetooth_panel_get_type (void);
@@ -83,6 +84,7 @@ extern void cc_wacom_panel_static_init_func (void);
 
 static CcPanelLoaderVtable default_panels[] =
 {
+  PANEL_TYPE("applications",     cc_applications_panel_get_type,         NULL),
   PANEL_TYPE("background",       cc_background_panel_get_type,           NULL),
 #ifdef BUILD_BLUETOOTH
   PANEL_TYPE("bluetooth",        cc_bluetooth_panel_get_type,            NULL),


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]