[gnome-control-center/wip/applications: 1/4] applications: Code style cleanup
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/wip/applications: 1/4] applications: Code style cleanup
- Date: Fri, 4 Jan 2019 23:43:57 +0000 (UTC)
commit e121f46498dc2afd5088af6a6f111b7721a02fcb
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Dec 13 16:28:30 2018 -0200
applications: Code style cleanup
panels/applications/applications.gresource.xml | 4 +-
panels/applications/cc-action-row.c | 45 +-
panels/applications/cc-action-row.h | 17 +-
panels/applications/cc-applications-panel.c | 726 +++++++++++++------------
panels/applications/cc-applications-row.c | 15 +-
panels/applications/cc-applications-row.h | 8 +-
panels/applications/cc-applications-row.ui | 2 +
panels/applications/cc-info-row.c | 30 +-
panels/applications/cc-info-row.h | 4 +-
panels/applications/cc-toggle-row.c | 20 +-
panels/applications/cc-toggle-row.h | 4 +-
panels/applications/globs.c | 8 +-
panels/applications/globs.h | 2 +-
panels/applications/meson.build | 17 +-
panels/applications/search.c | 19 +-
panels/applications/search.h | 2 +-
panels/applications/utils.c | 50 +-
panels/applications/utils.h | 21 +-
18 files changed, 506 insertions(+), 488 deletions(-)
---
diff --git a/panels/applications/applications.gresource.xml b/panels/applications/applications.gresource.xml
index 2a8fd59b4..d23f1b2e0 100644
--- a/panels/applications/applications.gresource.xml
+++ b/panels/applications/applications.gresource.xml
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gnome/control-center/applications">
+ <file preprocess="xml-stripblanks">cc-action-row.ui</file>
<file preprocess="xml-stripblanks">cc-applications-panel.ui</file>
<file preprocess="xml-stripblanks">cc-applications-row.ui</file>
- <file preprocess="xml-stripblanks">cc-toggle-row.ui</file>
<file preprocess="xml-stripblanks">cc-info-row.ui</file>
- <file preprocess="xml-stripblanks">cc-action-row.ui</file>
+ <file preprocess="xml-stripblanks">cc-toggle-row.ui</file>
<file>cc-applications-panel.css</file>
</gresource>
</gresources>
diff --git a/panels/applications/cc-action-row.c b/panels/applications/cc-action-row.c
index ccb197e14..e47017faa 100644
--- a/panels/applications/cc-action-row.c
+++ b/panels/applications/cc-action-row.c
@@ -47,11 +47,10 @@ struct _CcActionRow
G_DEFINE_TYPE (CcActionRow, cc_action_row, GTK_TYPE_LIST_BOX_ROW)
static void
-cc_action_row_finalize (GObject *object)
+clicked_cb (GtkButton *button,
+ CcActionRow *row)
{
- //CcActionRow *row = CC_ACTION_ROW (object);
-
- G_OBJECT_CLASS (cc_action_row_parent_class)->finalize (object);
+ g_signal_emit (row, activated_signal, 0);
}
static void
@@ -67,19 +66,24 @@ cc_action_row_get_property (GObject *object,
case PROP_TITLE:
g_value_set_string (value, gtk_label_get_label (GTK_LABEL (row->title)));
break;
+
case PROP_SUBTITLE:
g_value_set_string (value, gtk_label_get_label (GTK_LABEL (row->subtitle)));
break;
+
case PROP_ACTION:
g_value_set_string (value, gtk_button_get_label (GTK_BUTTON (row->button)));
break;
+
case PROP_ENABLED:
g_value_set_boolean (value, gtk_widget_get_sensitive (row->button));
break;
+
case PROP_DESTRUCTIVE:
g_value_set_boolean (value,
gtk_style_context_has_class (gtk_widget_get_style_context (row->button),
"destructive-action"));
break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -99,22 +103,27 @@ cc_action_row_set_property (GObject *object,
case PROP_TITLE:
gtk_label_set_label (GTK_LABEL (row->title), g_value_get_string (value));
break;
+
case PROP_SUBTITLE:
gtk_label_set_label (GTK_LABEL (row->subtitle), g_value_get_string (value));
gtk_widget_set_visible (row->subtitle, strlen (g_value_get_string (value)) > 0);
break;
+
case PROP_ACTION:
gtk_button_set_label (GTK_BUTTON (row->button), g_value_get_string (value));
break;
+
case PROP_ENABLED:
gtk_widget_set_sensitive (row->button, g_value_get_boolean (value));
break;
+
case PROP_DESTRUCTIVE:
if (g_value_get_boolean (value))
gtk_style_context_add_class (gtk_widget_get_style_context (row->button), "destructive-action");
else
gtk_style_context_remove_class (gtk_widget_get_style_context (row->button), "destructive-action");
break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -127,7 +136,6 @@ cc_action_row_class_init (CcActionRowClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->finalize = cc_action_row_finalize;
object_class->get_property = cc_action_row_get_property;
object_class->set_property = cc_action_row_set_property;
@@ -160,25 +168,18 @@ cc_action_row_class_init (CcActionRowClass *klass)
activated_signal = g_signal_new ("activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- 0,
- NULL, NULL,
- NULL,
- G_TYPE_NONE, 0);
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_FIRST,
+ 0,
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 0);
gtk_widget_class_bind_template_child (widget_class, CcActionRow, title);
gtk_widget_class_bind_template_child (widget_class, CcActionRow, subtitle);
gtk_widget_class_bind_template_child (widget_class, CcActionRow, button);
}
-static void
-clicked_cb (GtkButton *button,
- CcActionRow *row)
-{
- g_signal_emit (row, activated_signal, 0);
-}
-
static void
cc_action_row_init (CcActionRow *self)
{
@@ -196,14 +197,14 @@ cc_action_row_new (void)
void
cc_action_row_set_title (CcActionRow *row,
- const char *name)
+ const gchar *name)
{
gtk_label_set_label (GTK_LABEL (row->title), name);
}
void
cc_action_row_set_subtitle (CcActionRow *row,
- const char *name)
+ const gchar *name)
{
gtk_label_set_label (GTK_LABEL (row->subtitle), name);
gtk_widget_set_visible (row->subtitle, strlen (name) > 0);
@@ -211,8 +212,8 @@ cc_action_row_set_subtitle (CcActionRow *row,
void
cc_action_row_set_action (CcActionRow *row,
- const char *action,
- gboolean sensitive)
+ const gchar *action,
+ gboolean sensitive)
{
gtk_button_set_label (GTK_BUTTON (row->button), action);
gtk_widget_set_sensitive (row->button, sensitive);
diff --git a/panels/applications/cc-action-row.h b/panels/applications/cc-action-row.h
index 7268da1e5..2912adbf9 100644
--- a/panels/applications/cc-action-row.h
+++ b/panels/applications/cc-action-row.h
@@ -27,13 +27,16 @@ G_BEGIN_DECLS
#define CC_TYPE_ACTION_ROW (cc_action_row_get_type())
G_DECLARE_FINAL_TYPE (CcActionRow, cc_action_row, CC, ACTION_ROW, GtkListBoxRow)
-CcActionRow *cc_action_row_new (void);
-void cc_action_row_set_title (CcActionRow *row,
- const char *label);
+CcActionRow* cc_action_row_new (void);
+
+void cc_action_row_set_title (CcActionRow *row,
+ const gchar *label);
+
void cc_action_row_set_subtitle (CcActionRow *row,
- const char *label);
-void cc_action_row_set_action (CcActionRow *row,
- const char *action,
- gboolean sensitive);
+ const gchar *label);
+
+void cc_action_row_set_action (CcActionRow *row,
+ const gchar *action,
+ gboolean sensitive);
G_END_DECLS
diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c
index 85e1ba590..896a6bc2b 100644
--- a/panels/applications/cc-applications-panel.c
+++ b/panels/applications/cc-applications-panel.c
@@ -18,6 +18,8 @@
* SPDX-License-Identifier: GPL-3.0-or-later
*/
+#define G_LOG_DOMAIN "cc-applications-panel"
+
#include <config.h>
#include <glib/gi18n.h>
@@ -29,7 +31,9 @@
#include "cc-info-row.h"
#include "cc-action-row.h"
#include "cc-applications-resources.h"
+#include "globs.h"
#include "list-box-helper.h"
+#include "search.h"
#include "utils.h"
#include <flatpak/flatpak.h>
@@ -41,179 +45,86 @@ enum {
struct _CcApplicationsPanel
{
- CcPanel parent;
+ CcPanel parent;
- GtkListBox *sidebar_listbox;
- GtkWidget *header_button;
- GtkWidget *title_label;
+ GtkListBox *sidebar_listbox;
+ GtkWidget *header_button;
+ GtkWidget *title_label;
GAppInfoMonitor *monitor;
- gulong monitor_id;
-
- GCancellable *cancellable;
-
- char *current_app_id;
-
- GHashTable *globs;
- GHashTable *search_providers;
-
- GDBusProxy *perm_store;
- GSettings *notification_settings;
- GSettings *location_settings;
- GSettings *privacy_settings;
- GSettings *search_settings;
-
- GtkListBox *stack;
-
- GtkWidget *permission_section;
- GtkWidget *permission_list;
- GtkWidget *camera;
- GtkWidget *no_camera;
- GtkWidget *location;
- GtkWidget *no_location;
- GtkWidget *microphone;
- GtkWidget *no_microphone;
- GtkWidget *builtin;
- GtkWidget *builtin_dialog;
- GtkWidget *builtin_label;
- GtkWidget *builtin_list;
-
- GtkWidget *integration_section;
- GtkWidget *integration_list;
- GtkWidget *notification;
- GtkWidget *sound;
- GtkWidget *no_sound;
- GtkWidget *search;
- GtkWidget *no_search;
-
- GtkWidget *handler_section;
- GtkWidget *handler_reset;
- GtkWidget *handler_list;
- GtkWidget *hypertext;
- GtkWidget *text;
- GtkWidget *images;
- GtkWidget *fonts;
- GtkWidget *archives;
- GtkWidget *packages;
- GtkWidget *audio;
- GtkWidget *video;
- GtkWidget *other;
- GtkWidget *link;
-
- GtkWidget *usage_section;
- GtkWidget *usage_list;
- GtkWidget *storage;
- GtkWidget *storage_dialog;
- GtkWidget *storage_list;
- GtkWidget *app;
- GtkWidget *data;
- GtkWidget *cache;
- GtkWidget *total;
- GtkWidget *clear_cache_button;
-
- guint64 app_size;
- guint64 cache_size;
- guint64 data_size;
+ gulong monitor_id;
+
+ GCancellable *cancellable;
+
+ gchar *current_app_id;
+
+ GHashTable *globs;
+ GHashTable *search_providers;
+
+ GDBusProxy *perm_store;
+ GSettings *notification_settings;
+ GSettings *location_settings;
+ GSettings *privacy_settings;
+ GSettings *search_settings;
+
+ GtkListBox *stack;
+
+ GtkWidget *permission_section;
+ GtkWidget *permission_list;
+ GtkWidget *camera;
+ GtkWidget *no_camera;
+ GtkWidget *location;
+ GtkWidget *no_location;
+ GtkWidget *microphone;
+ GtkWidget *no_microphone;
+ GtkWidget *builtin;
+ GtkWidget *builtin_dialog;
+ GtkWidget *builtin_label;
+ GtkWidget *builtin_list;
+
+ GtkWidget *integration_section;
+ GtkWidget *integration_list;
+ GtkWidget *notification;
+ GtkWidget *sound;
+ GtkWidget *no_sound;
+ GtkWidget *search;
+ GtkWidget *no_search;
+
+ GtkWidget *handler_section;
+ GtkWidget *handler_reset;
+ GtkWidget *handler_list;
+ GtkWidget *hypertext;
+ GtkWidget *text;
+ GtkWidget *images;
+ GtkWidget *fonts;
+ GtkWidget *archives;
+ GtkWidget *packages;
+ GtkWidget *audio;
+ GtkWidget *video;
+ GtkWidget *other;
+ GtkWidget *link;
+
+ GtkWidget *usage_section;
+ GtkWidget *usage_list;
+ GtkWidget *storage;
+ GtkWidget *storage_dialog;
+ GtkWidget *storage_list;
+ GtkWidget *app;
+ GtkWidget *data;
+ GtkWidget *cache;
+ GtkWidget *total;
+ GtkWidget *clear_cache_button;
+
+ guint64 app_size;
+ guint64 cache_size;
+ guint64 data_size;
};
-G_DEFINE_TYPE (CcApplicationsPanel, cc_applications_panel, CC_TYPE_PANEL)
-
-static void
-cc_applications_panel_dispose (GObject *object)
-{
- CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (object);
-
- g_clear_object (&self->monitor);
- g_clear_object (&self->perm_store);
-
- g_cancellable_cancel (self->cancellable);
-
- G_OBJECT_CLASS (cc_applications_panel_parent_class)->dispose (object);
-}
-
-static void
-cc_applications_panel_finalize (GObject *object)
-{
- CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (object);
-
- g_clear_object (&self->notification_settings);
- g_clear_object (&self->location_settings);
- g_clear_object (&self->privacy_settings);
- g_clear_object (&self->search_settings);
- g_clear_object (&self->cancellable);
-
- g_free (self->current_app_id);
- g_hash_table_unref (self->globs);
- g_hash_table_unref (self->search_providers);
-
- G_OBJECT_CLASS (cc_applications_panel_parent_class)->finalize (object);
-}
-
-static void select_app (CcApplicationsPanel *self, const char *app_id);
-
-static void
-cc_applications_panel_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- switch (property_id)
- {
- case PROP_PARAMETERS:
- {
- GVariant *parameters, *v;
- const gchar *first_arg = NULL;
-
- parameters = g_value_get_variant (value);
- if (parameters == NULL)
- return;
-
- if (g_variant_n_children (parameters) > 0)
- {
- g_variant_get_child (parameters, 0, "v", &v);
- if (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING))
- first_arg = g_variant_get_string (v, NULL);
- else
- g_warning ("Wrong type for the second argument GVariant, expected 's' but got '%s'",
- (gchar *)g_variant_get_type (v));
- g_variant_unref (v);
-
- select_app (CC_APPLICATIONS_PANEL (object), first_arg);
- }
+static void select_app (CcApplicationsPanel *self,
+ const gchar *app_id);
- return;
- }
- }
-
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-}
-
-static void
-cc_applications_panel_constructed (GObject *object)
-{
- CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (object);
- CcShell *shell;
-
- G_OBJECT_CLASS (cc_applications_panel_parent_class)->constructed (object);
-
- shell = cc_panel_get_shell (CC_PANEL (self));
- cc_shell_embed_widget_in_header (shell, self->header_button);
-}
-
-static GtkWidget*
-cc_applications_panel_get_sidebar_widget (CcPanel *panel)
-{
- CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (panel);
- return GTK_WIDGET (self->sidebar_listbox);
-}
-
-static GtkWidget *
-cc_applications_panel_get_title_widget (CcPanel *panel)
-{
- CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (panel);
- return self->title_label;
-}
+G_DEFINE_TYPE (CcApplicationsPanel, cc_applications_panel, CC_TYPE_PANEL)
-/* --- misc callbacks --- */
+/* Callbacks */
static void
privacy_link_cb (CcApplicationsPanel *self)
@@ -226,10 +137,10 @@ privacy_link_cb (CcApplicationsPanel *self)
}
static void
-open_software_cb (GtkButton *button,
+open_software_cb (GtkButton *button,
CcApplicationsPanel *self)
{
- const char *argv[] = { "gnome-software", "--details", "appid", NULL };
+ const gchar *argv[] = { "gnome-software", "--details", "appid", NULL };
if (self->current_app_id == NULL)
argv[1] = NULL;
@@ -241,17 +152,17 @@ open_software_cb (GtkButton *button,
/* --- flatpak permissions and utilities --- */
-static char **
+static gchar **
get_flatpak_permissions (CcApplicationsPanel *self,
- const char *table,
- const char *id,
- const char *app_id)
+ const gchar *table,
+ const gchar *id,
+ const gchar *app_id)
{
g_autoptr(GVariant) ret = NULL;
g_autoptr(GVariantIter) iter = NULL;
- char *key;
+ g_auto(GStrv) permissions = NULL;
GVariant *val;
- char **permissions = NULL;
+ gchar *key;
ret = g_dbus_proxy_call_sync (self->perm_store,
"Lookup",
@@ -271,15 +182,15 @@ get_flatpak_permissions (CcApplicationsPanel *self,
}
}
- return permissions;
+ return g_steal_pointer (&permissions);
}
static void
set_flatpak_permissions (CcApplicationsPanel *self,
- const char *table,
- const char *id,
- const char *app_id,
- const char * const *permissions)
+ const gchar *table,
+ const gchar *id,
+ const gchar *app_id,
+ const gchar * const *permissions)
{
g_dbus_proxy_call_sync (self->perm_store,
"SetPermission",
@@ -292,8 +203,7 @@ app_info_is_flatpak (GAppInfo *info)
{
if (G_IS_DESKTOP_APP_INFO (info))
{
- g_autofree char *marker = NULL;
- marker = g_desktop_app_info_get_string (G_DESKTOP_APP_INFO (info), "X-Flatpak");
+ g_autofree gchar *marker = g_desktop_app_info_get_string (G_DESKTOP_APP_INFO (info), "X-Flatpak");
return marker != NULL;
}
@@ -301,11 +211,12 @@ app_info_is_flatpak (GAppInfo *info)
}
static GFile *
-get_flatpak_app_dir (const char *app_id,
- const char *subdir)
+get_flatpak_app_dir (const gchar *app_id,
+ const gchar *subdir)
{
- g_autofree char *path = g_build_filename (g_get_home_dir (), ".var", "app", app_id, NULL);
+ g_autofree gchar *path = g_build_filename (g_get_home_dir (), ".var", "app", app_id, NULL);
g_autoptr(GFile) appdir = g_file_new_for_path (path);
+
return g_file_get_child (appdir, subdir);
}
@@ -313,15 +224,15 @@ get_flatpak_app_dir (const char *app_id,
static void
set_search_enabled (CcApplicationsPanel *self,
- const char *app_id,
- gboolean enabled)
+ const gchar *app_id,
+ gboolean enabled)
{
+ g_autoptr(GPtrArray) new_apps = NULL;
+ g_autofree gchar *desktop_id = g_strconcat (app_id, ".desktop", NULL);
+ g_auto(GStrv) apps = NULL;
gpointer key, value;
gboolean default_disabled;
- g_auto(GStrv) apps = NULL;
- g_autoptr(GPtrArray) new_apps = NULL;
- int i;
- g_autofree char *desktop_id = g_strconcat (app_id, ".desktop", NULL);
+ gint i;
if (!g_hash_table_lookup_extended (self->search_providers, app_id, &key, &value))
{
@@ -343,7 +254,7 @@ set_search_enabled (CcApplicationsPanel *self,
if (enabled)
g_ptr_array_add (new_apps, g_strdup (desktop_id));
g_ptr_array_add (new_apps, NULL);
- g_settings_set_strv (self->search_settings, "enabled", (const char * const *)new_apps->pdata);
+ g_settings_set_strv (self->search_settings, "enabled", (const gchar * const *)new_apps->pdata);
}
else
{
@@ -356,33 +267,33 @@ set_search_enabled (CcApplicationsPanel *self,
if (!enabled)
g_ptr_array_add (new_apps, g_strdup (desktop_id));
g_ptr_array_add (new_apps, NULL);
- g_settings_set_strv (self->search_settings, "disabled", (const char * const *)new_apps->pdata);
+ g_settings_set_strv (self->search_settings, "disabled", (const gchar * const *)new_apps->pdata);
}
}
static gboolean
search_enabled_for_app (CcApplicationsPanel *self,
- const char *app_id)
+ const gchar *app_id)
{
- g_autofree char *desktop_id = g_strconcat (app_id, ".desktop", NULL);
+ g_autofree gchar *desktop_id = g_strconcat (app_id, ".desktop", NULL);
g_auto(GStrv) apps = g_settings_get_strv (self->search_settings, "enabled");
- return g_strv_contains ((const char * const *)apps, desktop_id);
+ return g_strv_contains ((const gchar * const *)apps, desktop_id);
}
static gboolean
search_disabled_for_app (CcApplicationsPanel *self,
- const char *app_id)
+ const gchar *app_id)
{
- g_autofree char *desktop_id = g_strconcat (app_id, ".desktop", NULL);
+ g_autofree gchar *desktop_id = g_strconcat (app_id, ".desktop", NULL);
g_auto(GStrv) apps = g_settings_get_strv (self->search_settings, "disabled");
- return g_strv_contains ((const char * const *)apps, desktop_id);
+ return g_strv_contains ((const gchar * const *)apps, desktop_id);
}
static void
get_search_enabled (CcApplicationsPanel *self,
- const char *app_id,
- gboolean *set,
- gboolean *enabled)
+ const gchar *app_id,
+ gboolean *set,
+ gboolean *enabled)
{
gpointer key, value;
@@ -412,9 +323,9 @@ search_cb (CcApplicationsPanel *self)
static void
get_notification_allowed (CcApplicationsPanel *self,
- const char *app_id,
- gboolean *set,
- gboolean *allowed)
+ const gchar *app_id,
+ gboolean *set,
+ gboolean *allowed)
{
if (self->notification_settings)
{
@@ -432,7 +343,7 @@ get_notification_allowed (CcApplicationsPanel *self,
static void
set_notification_allowed (CcApplicationsPanel *self,
- gboolean allowed)
+ gboolean allowed)
{
if (self->notification_settings)
{
@@ -440,7 +351,7 @@ set_notification_allowed (CcApplicationsPanel *self,
}
else
{
- const char *perms[2] = { NULL, NULL };
+ const gchar *perms[2] = { NULL, NULL };
perms[0] = allowed ? "yes" : "no";
set_flatpak_permissions (self, "notifications", "notification", self->current_app_id, perms);
@@ -454,11 +365,11 @@ notification_cb (CcApplicationsPanel *self)
set_notification_allowed (self, cc_toggle_row_get_allowed (CC_TOGGLE_ROW (self->notification)));
}
-static char *
-munge_app_id (const char *app_id)
+static gchar *
+munge_app_id (const gchar *app_id)
{
- int i;
- char *id = g_strdup (app_id);
+ gchar *id = g_strdup (app_id);
+ gint i;
g_strcanon (id,
"0123456789"
@@ -477,10 +388,10 @@ munge_app_id (const char *app_id)
#define APP_PREFIX "/org/gnome/desktop/notifications/application/"
static GSettings *
-get_notification_settings (const char *app_id)
+get_notification_settings (const gchar *app_id)
{
- g_autofree char *munged_app_id = munge_app_id (app_id);
- g_autofree char *path = g_strconcat (APP_PREFIX, munged_app_id, "/", NULL);
+ g_autofree gchar *munged_app_id = munge_app_id (app_id);
+ g_autofree gchar *path = g_strconcat (APP_PREFIX, munged_app_id, "/", NULL);
return g_settings_new_with_path (APP_SCHEMA, path);
}
@@ -488,10 +399,10 @@ get_notification_settings (const char *app_id)
static void
get_device_allowed (CcApplicationsPanel *self,
- const char *device,
- const char *app_id,
- gboolean *set,
- gboolean *allowed)
+ const gchar *device,
+ const gchar *app_id,
+ gboolean *set,
+ gboolean *allowed)
{
g_auto(GStrv) perms = NULL;
@@ -503,10 +414,10 @@ get_device_allowed (CcApplicationsPanel *self,
static void
set_device_allowed (CcApplicationsPanel *self,
- const char *device,
- gboolean allowed)
+ const gchar *device,
+ gboolean allowed)
{
- const char *perms[2];
+ const gchar *perms[2];
perms[0] = allowed ? "yes" : "no";
perms[1] = NULL;
@@ -539,9 +450,9 @@ camera_cb (CcApplicationsPanel *self)
static void
get_location_allowed (CcApplicationsPanel *self,
- const char *app_id,
- gboolean *set,
- gboolean *allowed)
+ const gchar *app_id,
+ gboolean *set,
+ gboolean *allowed)
{
g_auto(GStrv) perms = NULL;
@@ -553,10 +464,9 @@ get_location_allowed (CcApplicationsPanel *self,
static void
set_location_allowed (CcApplicationsPanel *self,
- gboolean allowed)
+ gboolean allowed)
{
- const char *perms[3];
- g_autofree char *time = NULL;
+ const gchar *perms[3];
// FIXME allow setting accuracy
perms[0] = allowed ? "EXACT" : "NONE";
@@ -575,10 +485,10 @@ location_cb (CcApplicationsPanel *self)
/* --- permissions section --- */
-static int
+static gint
add_static_permission_row (CcApplicationsPanel *self,
- const char *title,
- const char *subtitle)
+ const gchar *title,
+ const gchar *subtitle)
{
GtkWidget *row;
@@ -592,12 +502,11 @@ add_static_permission_row (CcApplicationsPanel *self,
}
static void
-permission_row_activated_cb (GtkListBox *list,
- GtkListBoxRow *list_row,
+permission_row_activated_cb (GtkListBox *list,
+ GtkListBoxRow *list_row,
CcApplicationsPanel *self)
{
GtkWidget *row = GTK_WIDGET (list_row);
- g_autoptr(GError) error = NULL;
if (row == self->builtin)
{
@@ -609,17 +518,17 @@ permission_row_activated_cb (GtkListBox *list,
static gboolean
add_static_permissions (CcApplicationsPanel *self,
- GAppInfo *info,
- const char *app_id)
+ GAppInfo *info,
+ const gchar *app_id)
{
g_autoptr(FlatpakInstalledRef) ref = NULL;
g_autoptr(GBytes) bytes = NULL;
g_autoptr(GError) error = NULL;
g_autoptr(GKeyFile) keyfile = NULL;
- char **strv;
- char *str;
- int added = 0;
- g_autofree char *text = NULL;
+ gchar **strv;
+ gchar *str;
+ gint added = 0;
+ g_autofree gchar *text = NULL;
ref = find_flatpak_ref (app_id);
bytes = flatpak_installed_ref_load_metadata (ref, NULL, NULL);
@@ -634,32 +543,32 @@ add_static_permissions (CcApplicationsPanel *self,
}
strv = g_key_file_get_string_list (keyfile, "Context", "sockets", NULL, NULL);
- if (strv && g_strv_contains ((const char * const*)strv, "system-bus"))
+ if (strv && g_strv_contains ((const gchar * const*)strv, "system-bus"))
added += add_static_permission_row (self, _("System Bus"), _("Full access"));
- if (strv && g_strv_contains ((const char * const*)strv, "session-bus"))
+ if (strv && g_strv_contains ((const gchar * const*)strv, "session-bus"))
added += add_static_permission_row (self, _("Session Bus"), _("Full access"));
g_strfreev (strv);
strv = g_key_file_get_string_list (keyfile, "Context", "devices", NULL, NULL);
- if (strv && g_strv_contains ((const char * const*)strv, "all"))
+ if (strv && g_strv_contains ((const gchar * const*)strv, "all"))
added += add_static_permission_row (self, _("Devices"), _("Full access to /dev"));
g_strfreev (strv);
strv = g_key_file_get_string_list (keyfile, "Context", "shared", NULL, NULL);
- if (strv && g_strv_contains ((const char * const*)strv, "network"))
+ if (strv && g_strv_contains ((const gchar * const*)strv, "network"))
added += add_static_permission_row (self, _("Network"), _("Has network access"));
g_strfreev (strv);
strv = g_key_file_get_string_list (keyfile, "Context", "filesystems", NULL, NULL);
- if (strv && (g_strv_contains ((const char * const *)strv, "home") ||
- g_strv_contains ((const char * const *)strv, "home:rw")))
+ if (strv && (g_strv_contains ((const gchar * const *)strv, "home") ||
+ g_strv_contains ((const gchar * const *)strv, "home:rw")))
added += add_static_permission_row (self, _("Home"), _("Full access"));
- else if (strv && g_strv_contains ((const char * const *)strv, "home:ro"))
+ else if (strv && g_strv_contains ((const gchar * const *)strv, "home:ro"))
added += add_static_permission_row (self, _("Home"), _("Read-only"));
- if (strv && (g_strv_contains ((const char * const *)strv, "host") ||
- g_strv_contains ((const char * const *)strv, "host:rw")))
+ if (strv && (g_strv_contains ((const gchar * const *)strv, "host") ||
+ g_strv_contains ((const gchar * const *)strv, "host:rw")))
added += add_static_permission_row (self, _("File System"), _("Full access"));
- else if (strv && g_strv_contains ((const char * const *)strv, "host:ro"))
+ else if (strv && g_strv_contains ((const gchar * const *)strv, "host:ro"))
added += add_static_permission_row (self, _("File System"), _("Read-only"));
g_strfreev (strv);
@@ -684,9 +593,9 @@ remove_static_permissions (CcApplicationsPanel *self)
static void
update_permission_section (CcApplicationsPanel *self,
- GAppInfo *info)
+ GAppInfo *info)
{
- g_autofree char *app_id = get_app_id (info);
+ g_autofree gchar *app_id = get_app_id (info);
gboolean disabled, allowed, set;
gboolean has_any = FALSE;
@@ -723,13 +632,13 @@ update_permission_section (CcApplicationsPanel *self,
gtk_widget_set_visible (self->permission_section, has_any);
}
-/* --- integration section --- */
+/* --- gintegration section --- */
static void
update_integration_section (CcApplicationsPanel *self,
- GAppInfo *info)
+ GAppInfo *info)
{
- g_autofree char *app_id = get_app_id (info);
+ g_autofree gchar *app_id = get_app_id (info);
gboolean set, allowed, disabled;
gboolean has_any = FALSE;
@@ -771,27 +680,27 @@ update_integration_section (CcApplicationsPanel *self,
/* --- handler section --- */
static void
-unset_cb (CcActionRow *row,
+unset_cb (CcActionRow *row,
CcApplicationsPanel *self)
{
- const char *type;
+ const gchar *type;
GtkListBoxRow *selected;
GAppInfo *info;
selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->sidebar_listbox));
info = cc_applications_row_get_info (CC_APPLICATIONS_ROW (selected));
- type = (const char *)g_object_get_data (G_OBJECT (row), "type");
+ type = (const gchar *)g_object_get_data (G_OBJECT (row), "type");
g_app_info_remove_supports_type (info, type, NULL);
}
static void
update_group_row_count (GtkWidget *row,
- int delta)
+ gint delta)
{
- int count;
- g_autofree char *text = NULL;
+ gint count;
+ g_autofree gchar *text = NULL;
count = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (row), "count"));
count += delta;
@@ -802,11 +711,11 @@ update_group_row_count (GtkWidget *row,
static void
add_scheme (CcApplicationsPanel *self,
- GtkWidget *after,
- const char *type)
+ GtkWidget *after,
+ const gchar *type)
{
CcActionRow *row = NULL;
- int pos;
+ gint pos;
if (g_str_has_suffix (type, "http"))
{
@@ -826,9 +735,9 @@ add_scheme (CcApplicationsPanel *self,
}
else
{
- char *scheme = strrchr (type, '/') + 1;
- g_autofree char *title = g_strdup_printf (_("%s Links"), scheme);
- g_autofree char *subtitle = g_strdup_printf ("%s://", scheme);
+ gchar *scheme = strrchr (type, '/') + 1;
+ g_autofree gchar *title = g_strdup_printf (_("%s Links"), scheme);
+ g_autofree gchar *subtitle = g_strdup_printf ("%s://", scheme);
row = cc_action_row_new ();
cc_action_row_set_title (row, title);
@@ -854,13 +763,13 @@ add_scheme (CcApplicationsPanel *self,
static void
add_file_type (CcApplicationsPanel *self,
- GtkWidget *after,
- const char *type)
+ GtkWidget *after,
+ const gchar *type)
{
CcActionRow *row;
- const char *desc;
- int pos;
- const char *glob;
+ const gchar *desc;
+ gint pos;
+ const gchar *glob;
glob = g_hash_table_lookup (self->globs, type);
@@ -886,9 +795,9 @@ add_file_type (CcApplicationsPanel *self,
}
static gboolean
-is_hypertext_type (const char *type)
+is_hypertext_type (const gchar *type)
{
- const char *types[] = {
+ const gchar *types[] = {
"text/html",
"text/htmlh",
"text/xml",
@@ -903,7 +812,7 @@ is_hypertext_type (const char *type)
static void
ensure_group_row (CcApplicationsPanel *self,
GtkWidget **row,
- const char *title)
+ const gchar *title)
{
if (*row == NULL)
{
@@ -918,7 +827,7 @@ ensure_group_row (CcApplicationsPanel *self,
static void
add_link_type (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
ensure_group_row (self, &self->link, _("Links"));
add_scheme (self, self->link, type);
@@ -926,42 +835,42 @@ add_link_type (CcApplicationsPanel *self,
static void
add_hypertext_type (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
ensure_group_row (self, &self->hypertext, _("Hypertext Files"));
add_file_type (self, self->hypertext, type);
}
static gboolean
-is_text_type (const char *type)
+is_text_type (const gchar *type)
{
return g_content_type_is_a (type, "text/*");
}
static void
add_text_type (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
ensure_group_row (self, &self->text, _("Text Files"));
add_file_type (self, self->text, type);
}
static gboolean
-is_image_type (const char *type)
+is_image_type (const gchar *type)
{
return g_content_type_is_a (type, "image/*");
}
static void
add_image_type (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
ensure_group_row (self, &self->images, _("Image Files"));
add_file_type (self, self->images, type);
}
static gboolean
-is_font_type (const char *type)
+is_font_type (const gchar *type)
{
return g_content_type_is_a (type, "font/*") ||
g_str_equal (type, "application/x-font-pcf") ||
@@ -970,16 +879,16 @@ is_font_type (const char *type)
static void
add_font_type (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
ensure_group_row (self, &self->fonts, _("Font Files"));
add_file_type (self, self->fonts, type);
}
static gboolean
-is_archive_type (const char *type)
+is_archive_type (const gchar *type)
{
- const char *types[] = {
+ const gchar *types[] = {
"application/bzip2",
"application/zip",
"application/x-xz-compressed-tar",
@@ -1031,16 +940,16 @@ is_archive_type (const char *type)
static void
add_archive_type (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
ensure_group_row (self, &self->archives, _("Archive Files"));
add_file_type (self, self->archives, type);
}
static gboolean
-is_package_type (const char *type)
+is_package_type (const gchar *type)
{
- const char *types[] = {
+ const gchar *types[] = {
"application/x-source-rpm",
"application/x-rpm",
"application/vnd.debian.binary-package",
@@ -1051,14 +960,14 @@ is_package_type (const char *type)
static void
add_package_type (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
ensure_group_row (self, &self->packages, _("Package Files"));
add_file_type (self, self->packages, type);
}
static gboolean
-is_audio_type (const char *type)
+is_audio_type (const gchar *type)
{
return g_content_type_is_a (type, "audio/*") ||
g_str_equal (type, "application/ogg") ||
@@ -1074,14 +983,14 @@ is_audio_type (const char *type)
static void
add_audio_type (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
ensure_group_row (self, &self->audio, _("Audio Files"));
add_file_type (self, self->audio, type);
}
static gboolean
-is_video_type (const char *type)
+is_video_type (const gchar *type)
{
return g_content_type_is_a (type, "video/*") ||
g_str_equal (type, "application/x-smil") ||
@@ -1091,7 +1000,7 @@ is_video_type (const char *type)
static void
add_video_type (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
ensure_group_row (self, &self->video, _("Video Files"));
add_file_type (self, self->video, type);
@@ -1099,7 +1008,7 @@ add_video_type (CcApplicationsPanel *self,
static void
add_other_type (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
ensure_group_row (self, &self->other, _("Other Files"));
add_file_type (self, self->other, type);
@@ -1107,7 +1016,7 @@ add_other_type (CcApplicationsPanel *self,
static void
add_handler_row (CcApplicationsPanel *self,
- const char *type)
+ const gchar *type)
{
gtk_widget_show (self->handler_section);
@@ -1134,8 +1043,8 @@ add_handler_row (CcApplicationsPanel *self,
}
static void
-handler_row_activated_cb (GtkListBox *list,
- GtkListBoxRow *list_row,
+handler_row_activated_cb (GtkListBox *list,
+ GtkListBoxRow *list_row,
CcApplicationsPanel *self)
{
GtkWidget *row = GTK_WIDGET (list_row);
@@ -1155,8 +1064,8 @@ handler_row_activated_cb (GtkListBox *list,
}
static gboolean
-app_info_recommended_for (GAppInfo *info,
- const char *type)
+app_info_recommended_for (GAppInfo *info,
+ const gchar *type)
{
/* this is horribly inefficient. I blame the mime system */
GList *list, *l;
@@ -1180,12 +1089,13 @@ app_info_recommended_for (GAppInfo *info,
}
static void
-handler_reset_cb (GtkButton *button, CcApplicationsPanel *self)
+handler_reset_cb (GtkButton *button,
+ CcApplicationsPanel *self)
{
GtkListBoxRow *selected;
GAppInfo *info;
- const char **types;
- int i;
+ const gchar **types;
+ gint i;
selected = gtk_list_box_get_selected_row (GTK_LIST_BOX (self->sidebar_listbox));
info = cc_applications_row_get_info (CC_APPLICATIONS_ROW (selected));
@@ -1197,7 +1107,7 @@ handler_reset_cb (GtkButton *button, CcApplicationsPanel *self)
g_signal_handler_block (self->monitor, self->monitor_id);
for (i = 0; types[i]; i++)
{
- char *ctype = g_content_type_from_mime_type (types[i]);
+ gchar *ctype = g_content_type_from_mime_type (types[i]);
g_app_info_add_supports_type (info, ctype, NULL);
}
g_signal_handler_unblock (self->monitor, self->monitor_id);
@@ -1206,10 +1116,10 @@ handler_reset_cb (GtkButton *button, CcApplicationsPanel *self)
static void
update_handler_sections (CcApplicationsPanel *self,
- GAppInfo *info)
+ GAppInfo *info)
{
- const char **types;
- int i;
+ const gchar **types;
+ gint i;
g_autoptr(GHashTable) hash = NULL;
container_remove_all (GTK_CONTAINER (self->handler_list));
@@ -1236,7 +1146,7 @@ update_handler_sections (CcApplicationsPanel *self,
gtk_widget_set_sensitive (self->handler_reset, FALSE);
for (i = 0; types[i]; i++)
{
- char *ctype = g_content_type_from_mime_type (types[i]);
+ gchar *ctype = g_content_type_from_mime_type (types[i]);
if (g_hash_table_contains (hash, ctype))
{
g_free (ctype);
@@ -1256,12 +1166,11 @@ update_handler_sections (CcApplicationsPanel *self,
/* --- usage section --- */
static void
-storage_row_activated_cb (GtkListBox *list,
- GtkListBoxRow *list_row,
+storage_row_activated_cb (GtkListBox *list,
+ GtkListBoxRow *list_row,
CcApplicationsPanel *self)
{
GtkWidget *row = GTK_WIDGET (list_row);
- g_autoptr(GError) error = NULL;
if (row == self->storage)
{
@@ -1275,7 +1184,7 @@ static void
update_total_size (CcApplicationsPanel *self)
{
guint64 total;
- g_autofree char *formatted_size = NULL;
+ g_autofree gchar *formatted_size = NULL;
total = self->app_size + self->data_size + self->cache_size;
formatted_size = g_format_size (total);
@@ -1284,13 +1193,13 @@ update_total_size (CcApplicationsPanel *self)
}
static void
-set_cache_size (GObject *source,
+set_cache_size (GObject *source,
GAsyncResult *res,
- gpointer data)
+ gpointer data)
{
CcApplicationsPanel *self = data;
guint64 *size;
- g_autofree char *formatted_size = NULL;
+ g_autofree gchar *formatted_size = NULL;
size = g_object_get_data (G_OBJECT (res), "size");
self->cache_size = *size;
@@ -1305,7 +1214,7 @@ set_cache_size (GObject *source,
static void
update_cache_row (CcApplicationsPanel *self,
- const char *app_id)
+ const gchar *app_id)
{
g_autoptr(GFile) dir = get_flatpak_app_dir (app_id, "cache");
g_object_set (self->cache, "info", "...", NULL);
@@ -1313,13 +1222,13 @@ update_cache_row (CcApplicationsPanel *self,
}
static void
-set_data_size (GObject *source,
+set_data_size (GObject *source,
GAsyncResult *res,
- gpointer data)
+ gpointer data)
{
CcApplicationsPanel *self = data;
guint64 *size;
- g_autofree char *formatted_size = NULL;
+ g_autofree gchar *formatted_size = NULL;
size = g_object_get_data (G_OBJECT (res), "size");
self->data_size = *size;
@@ -1332,7 +1241,7 @@ set_data_size (GObject *source,
static void
update_data_row (CcApplicationsPanel *self,
- const char *app_id)
+ const gchar *app_id)
{
g_autoptr(GFile) dir = get_flatpak_app_dir (app_id, "data");
g_object_set (self->data, "info", "...", NULL);
@@ -1340,9 +1249,9 @@ update_data_row (CcApplicationsPanel *self,
}
static void
-cache_cleared (GObject *source,
+cache_cleared (GObject *source,
GAsyncResult *res,
- gpointer data)
+ gpointer data)
{
CcApplicationsPanel *self = data;
update_cache_row (self, self->current_app_id);
@@ -1361,9 +1270,9 @@ clear_cache_cb (CcApplicationsPanel *self)
}
static void
update_app_row (CcApplicationsPanel *self,
- const char *app_id)
+ const gchar *app_id)
{
- g_autofree char *formatted_size = NULL;
+ g_autofree gchar *formatted_size = NULL;
self->app_size = get_flatpak_app_size (app_id);
formatted_size = g_format_size (self->app_size);
@@ -1373,7 +1282,7 @@ update_app_row (CcApplicationsPanel *self,
static void
update_flatpak_sizes (CcApplicationsPanel *self,
- const char *app_id)
+ const gchar *app_id)
{
gtk_widget_set_sensitive (self->clear_cache_button, FALSE);
@@ -1386,11 +1295,11 @@ update_flatpak_sizes (CcApplicationsPanel *self,
static void
update_usage_section (CcApplicationsPanel *self,
- GAppInfo *info)
+ GAppInfo *info)
{
if (app_info_is_flatpak (info))
{
- g_autofree char *app_id = get_app_id (info);
+ g_autofree gchar *app_id = get_app_id (info);
gtk_widget_show (self->usage_section);
update_flatpak_sizes (self, app_id);
}
@@ -1404,13 +1313,13 @@ update_usage_section (CcApplicationsPanel *self,
static void
update_panel (CcApplicationsPanel *self,
- GtkListBoxRow *row)
+ GtkListBoxRow *row)
{
GAppInfo *info;
if (self->perm_store == NULL)
{
- g_print ("no perm store proxy yet, come back later\n");
+ g_message ("No permissions store proxy yet, come back later");
return;
}
@@ -1451,7 +1360,7 @@ populate_applications (CcApplicationsPanel *self)
{
GAppInfo *info = l->data;
GtkWidget *row;
- g_autofree char *id = NULL;
+ g_autofree gchar *id = NULL;
if (!g_app_info_should_show (info))
continue;
@@ -1467,36 +1376,36 @@ populate_applications (CcApplicationsPanel *self)
g_list_free_full (infos, g_object_unref);
}
-static int
+static gint
compare_rows (GtkListBoxRow *row1,
GtkListBoxRow *row2,
gpointer data)
{
- const char *key1 = cc_applications_row_get_sort_key (CC_APPLICATIONS_ROW (row1));
- const char *key2 = cc_applications_row_get_sort_key (CC_APPLICATIONS_ROW (row2));
+ const gchar *key1 = cc_applications_row_get_sort_key (CC_APPLICATIONS_ROW (row1));
+ const gchar *key2 = cc_applications_row_get_sort_key (CC_APPLICATIONS_ROW (row2));
return strcmp (key1, key2);
}
static void
-apps_changed (GAppInfoMonitor *monitor,
+apps_changed (GAppInfoMonitor *monitor,
CcApplicationsPanel *self)
{
populate_applications (self);
}
static void
-row_selected_cb (GtkListBox *list,
- GtkListBoxRow *row,
+row_selected_cb (GtkListBox *list,
+ GtkListBoxRow *row,
CcApplicationsPanel *self)
{
update_panel (self, row);
}
static void
-on_perm_store_ready (GObject *source_object,
+on_perm_store_ready (GObject *source_object,
GAsyncResult *res,
- gpointer data)
+ gpointer data)
{
CcApplicationsPanel *self = data;
GDBusProxy *proxy;
@@ -1518,7 +1427,7 @@ on_perm_store_ready (GObject *source_object,
static void
select_app (CcApplicationsPanel *self,
- const char *app_id)
+ const gchar *app_id)
{
GList *children, *l;
@@ -1536,6 +1445,99 @@ select_app (CcApplicationsPanel *self,
g_list_free (children);
}
+static void
+cc_applications_panel_dispose (GObject *object)
+{
+ CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (object);
+
+ g_clear_object (&self->monitor);
+ g_clear_object (&self->perm_store);
+
+ g_cancellable_cancel (self->cancellable);
+
+ G_OBJECT_CLASS (cc_applications_panel_parent_class)->dispose (object);
+}
+
+static void
+cc_applications_panel_finalize (GObject *object)
+{
+ CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (object);
+
+ g_clear_object (&self->notification_settings);
+ g_clear_object (&self->location_settings);
+ g_clear_object (&self->privacy_settings);
+ g_clear_object (&self->search_settings);
+ g_clear_object (&self->cancellable);
+
+ g_free (self->current_app_id);
+ g_hash_table_unref (self->globs);
+ g_hash_table_unref (self->search_providers);
+
+ G_OBJECT_CLASS (cc_applications_panel_parent_class)->finalize (object);
+}
+
+static void
+cc_applications_panel_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id)
+ {
+ case PROP_PARAMETERS:
+ {
+ GVariant *parameters, *v;
+ const gchar *first_arg = NULL;
+
+ parameters = g_value_get_variant (value);
+ if (parameters == NULL)
+ return;
+
+ if (g_variant_n_children (parameters) > 0)
+ {
+ g_variant_get_child (parameters, 0, "v", &v);
+ if (g_variant_is_of_type (v, G_VARIANT_TYPE_STRING))
+ first_arg = g_variant_get_string (v, NULL);
+ else
+ g_warning ("Wrong type for the second argument GVariant, expected 's' but got '%s'",
+ (gchar *)g_variant_get_type (v));
+ g_variant_unref (v);
+
+ select_app (CC_APPLICATIONS_PANEL (object), first_arg);
+ }
+
+ return;
+ }
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+cc_applications_panel_constructed (GObject *object)
+{
+ CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (object);
+ CcShell *shell;
+
+ G_OBJECT_CLASS (cc_applications_panel_parent_class)->constructed (object);
+
+ shell = cc_panel_get_shell (CC_PANEL (self));
+ cc_shell_embed_widget_in_header (shell, self->header_button);
+}
+
+static GtkWidget*
+cc_applications_panel_get_sidebar_widget (CcPanel *panel)
+{
+ CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (panel);
+ return GTK_WIDGET (self->sidebar_listbox);
+}
+
+static GtkWidget *
+cc_applications_panel_get_title_widget (CcPanel *panel)
+{
+ CcApplicationsPanel *self = CC_APPLICATIONS_PANEL (panel);
+ return self->title_label;
+}
static void
cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
@@ -1556,42 +1558,42 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
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);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, title_label);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, header_button);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, stack);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, permission_section);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, permission_list);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, camera);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, no_camera);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, location);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, no_location);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, microphone);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, no_microphone);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, app);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, builtin);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, builtin_dialog);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, builtin_label);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, builtin_list);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, integration_section);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, integration_list);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, notification);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, sound);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, no_sound);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, search);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, no_search);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, cache);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, camera);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, clear_cache_button);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, data);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, header_button);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_section);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_reset);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_list);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, usage_section);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, usage_list);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, integration_list);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, integration_section);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, location);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, microphone);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, no_camera);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, no_location);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, no_microphone);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, no_search);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, no_sound);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, notification);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, permission_section);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, permission_list);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, sidebar_listbox);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, search);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, sound);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, stack);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_dialog);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_list);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, app);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, data);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, cache);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, title_label);
gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, total);
- gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, clear_cache_button);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, usage_list);
+ gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, usage_section);
gtk_widget_class_bind_template_callback (widget_class, camera_cb);
gtk_widget_class_bind_template_callback (widget_class, location_cb);
diff --git a/panels/applications/cc-applications-row.c b/panels/applications/cc-applications-row.c
index a62f5dafc..655e267a5 100644
--- a/panels/applications/cc-applications-row.c
+++ b/panels/applications/cc-applications-row.c
@@ -28,12 +28,12 @@ struct _CcApplicationsRow
{
GtkListBoxRow parent;
- GAppInfo *info;
- char *sortkey;
+ GAppInfo *info;
+ gchar *sortkey;
- GtkWidget *box;
- GtkWidget *image;
- GtkWidget *label;
+ GtkWidget *box;
+ GtkWidget *image;
+ GtkWidget *label;
};
G_DEFINE_TYPE (CcApplicationsRow, cc_applications_row, GTK_TYPE_LIST_BOX_ROW)
@@ -74,7 +74,7 @@ CcApplicationsRow *
cc_applications_row_new (GAppInfo *info)
{
CcApplicationsRow *row;
- char *key;
+ g_autofree gchar *key = NULL;
row = g_object_new (CC_TYPE_APPLICATIONS_ROW, NULL);
@@ -82,7 +82,6 @@ cc_applications_row_new (GAppInfo *info)
key = g_utf8_casefold (g_app_info_get_display_name (info), -1);
row->sortkey = g_utf8_collate_key (key, -1);
- g_free (key);
gtk_image_set_from_gicon (GTK_IMAGE (row->image), g_app_info_get_icon (info), GTK_ICON_SIZE_BUTTON);
gtk_label_set_label (GTK_LABEL (row->label), g_app_info_get_display_name (info));
@@ -96,7 +95,7 @@ cc_applications_row_get_info (CcApplicationsRow *row)
return row->info;
}
-const char *
+const gchar *
cc_applications_row_get_sort_key (CcApplicationsRow *row)
{
return row->sortkey;
diff --git a/panels/applications/cc-applications-row.h b/panels/applications/cc-applications-row.h
index d3d85ec37..3080751d1 100644
--- a/panels/applications/cc-applications-row.h
+++ b/panels/applications/cc-applications-row.h
@@ -27,8 +27,10 @@ G_BEGIN_DECLS
#define CC_TYPE_APPLICATIONS_ROW (cc_applications_row_get_type())
G_DECLARE_FINAL_TYPE (CcApplicationsRow, cc_applications_row, CC, APPLICATIONS_ROW, GtkListBoxRow)
-CcApplicationsRow *cc_applications_row_new (GAppInfo *info);
-GAppInfo *cc_applications_row_get_info (CcApplicationsRow *row);
-const char *cc_applications_row_get_sort_key (CcApplicationsRow *row);
+CcApplicationsRow *cc_applications_row_new (GAppInfo *info);
+
+GAppInfo *cc_applications_row_get_info (CcApplicationsRow *row);
+
+const gchar *cc_applications_row_get_sort_key (CcApplicationsRow *row);
G_END_DECLS
diff --git a/panels/applications/cc-applications-row.ui b/panels/applications/cc-applications-row.ui
index be66714c7..fb483a1b9 100644
--- a/panels/applications/cc-applications-row.ui
+++ b/panels/applications/cc-applications-row.ui
@@ -11,6 +11,7 @@
<child>
<object class="GtkImage" id="image">
<property name="visible">1</property>
+ <property name="pixel-size">16</property>
<style>
<class name="sidebar-icon"/>
</style>
@@ -20,6 +21,7 @@
<object class="GtkLabel" id="label">
<property name="visible">1</property>
<property name="xalign">0</property>
+ <property name="ellipsize">end</property>
</object>
</child>
</object>
diff --git a/panels/applications/cc-info-row.c b/panels/applications/cc-info-row.c
index 75dd601a9..98602a82c 100644
--- a/panels/applications/cc-info-row.c
+++ b/panels/applications/cc-info-row.c
@@ -24,7 +24,8 @@
#include "cc-info-row.h"
#include "cc-applications-resources.h"
-enum {
+enum
+{
PROP_ZERO,
PROP_TITLE,
PROP_USE_MARKUP,
@@ -38,24 +39,16 @@ struct _CcInfoRow
{
GtkListBoxRow parent;
- GtkWidget *title;
- GtkWidget *info;
- GtkWidget *expander;
+ GtkWidget *title;
+ GtkWidget *info;
+ GtkWidget *expander;
- gboolean expanded;
- gboolean link;
+ gboolean expanded;
+ gboolean link;
};
G_DEFINE_TYPE (CcInfoRow, cc_info_row, GTK_TYPE_LIST_BOX_ROW)
-static void
-cc_info_row_finalize (GObject *object)
-{
- //CcInfoRow *row = CC_INFO_ROW (object);
-
- G_OBJECT_CLASS (cc_info_row_parent_class)->finalize (object);
-}
-
static void
cc_info_row_get_property (GObject *object,
guint prop_id,
@@ -114,23 +107,29 @@ cc_info_row_set_property (GObject *object,
case PROP_TITLE:
gtk_label_set_label (GTK_LABEL (row->title), g_value_get_string (value));
break;
+
case PROP_INFO:
gtk_label_set_label (GTK_LABEL (row->info), g_value_get_string (value));
break;
+
case PROP_HAS_EXPANDER:
gtk_widget_set_visible (row->expander, g_value_get_boolean (value));
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), g_value_get_boolean (value));
break;
+
case PROP_USE_MARKUP:
gtk_label_set_use_markup (GTK_LABEL (row->title), g_value_get_boolean (value));
break;
+
case PROP_IS_LINK:
row->link = g_value_get_boolean (value);
update_expander (row);
break;
+
case PROP_EXPANDED:
cc_info_row_set_expanded (row, g_value_get_boolean (value));
break;
+
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -143,7 +142,6 @@ cc_info_row_class_init (CcInfoRowClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->finalize = cc_info_row_finalize;
object_class->get_property = cc_info_row_get_property;
object_class->set_property = cc_info_row_set_property;
@@ -204,7 +202,7 @@ cc_info_row_get_expanded (CcInfoRow *row)
void
cc_info_row_set_expanded (CcInfoRow *row,
- gboolean expanded)
+ gboolean expanded)
{
if (row->expanded == expanded)
return;
diff --git a/panels/applications/cc-info-row.h b/panels/applications/cc-info-row.h
index c0961ed7f..57b9d4a9e 100644
--- a/panels/applications/cc-info-row.h
+++ b/panels/applications/cc-info-row.h
@@ -27,9 +27,11 @@ G_BEGIN_DECLS
#define CC_TYPE_INFO_ROW (cc_info_row_get_type())
G_DECLARE_FINAL_TYPE (CcInfoRow, cc_info_row, CC, INFO_ROW, GtkListBoxRow)
-CcInfoRow *cc_info_row_new (void);
+CcInfoRow* cc_info_row_new (void);
+
void cc_info_row_set_expanded (CcInfoRow *row,
gboolean expanded);
+
gboolean cc_info_row_get_expanded (CcInfoRow *row);
G_END_DECLS
diff --git a/panels/applications/cc-toggle-row.c b/panels/applications/cc-toggle-row.c
index 2653d9429..a0f3c4fce 100644
--- a/panels/applications/cc-toggle-row.c
+++ b/panels/applications/cc-toggle-row.c
@@ -24,7 +24,8 @@
#include "cc-toggle-row.h"
#include "cc-applications-resources.h"
-enum {
+enum
+{
PROP_ZERO,
PROP_TITLE,
PROP_ALLOWED
@@ -34,18 +35,16 @@ struct _CcToggleRow
{
GtkListBoxRow parent;
- GtkWidget *title;
- GtkWidget *toggle;
+ GtkWidget *title;
+ GtkWidget *toggle;
};
G_DEFINE_TYPE (CcToggleRow, cc_toggle_row, GTK_TYPE_LIST_BOX_ROW)
static void
-cc_toggle_row_finalize (GObject *object)
+changed_cb (CcToggleRow *row)
{
- //CcToggleRow *row = CC_TOGGLE_ROW (object);
-
- G_OBJECT_CLASS (cc_toggle_row_parent_class)->finalize (object);
+ g_object_notify (G_OBJECT (row), "allowed");
}
static void
@@ -92,19 +91,12 @@ cc_toggle_row_set_property (GObject *object,
}
}
-static void
-changed_cb (CcToggleRow *row)
-{
- g_object_notify (G_OBJECT (row), "allowed");
-}
-
static void
cc_toggle_row_class_init (CcToggleRowClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- object_class->finalize = cc_toggle_row_finalize;
object_class->get_property = cc_toggle_row_get_property;
object_class->set_property = cc_toggle_row_set_property;
diff --git a/panels/applications/cc-toggle-row.h b/panels/applications/cc-toggle-row.h
index 57cd76fcb..cfc66b91e 100644
--- a/panels/applications/cc-toggle-row.h
+++ b/panels/applications/cc-toggle-row.h
@@ -27,9 +27,11 @@ G_BEGIN_DECLS
#define CC_TYPE_TOGGLE_ROW (cc_toggle_row_get_type())
G_DECLARE_FINAL_TYPE (CcToggleRow, cc_toggle_row, CC, TOGGLE_ROW, GtkListBoxRow)
-CcToggleRow *cc_toggle_row_new (void);
+CcToggleRow* cc_toggle_row_new (void);
+
void cc_toggle_row_set_allowed (CcToggleRow *row,
gboolean allowed);
+
gboolean cc_toggle_row_get_allowed (CcToggleRow *row);
G_END_DECLS
diff --git a/panels/applications/globs.c b/panels/applications/globs.c
index 97244893c..4d2c939e2 100644
--- a/panels/applications/globs.c
+++ b/panels/applications/globs.c
@@ -27,8 +27,8 @@ GHashTable *
parse_globs (void)
{
GHashTable *globs;
- const char * const *dirs;
- int i;
+ const gchar * const *dirs;
+ gint i;
globs = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
@@ -36,8 +36,8 @@ parse_globs (void)
for (i = 0; dirs[i]; i++)
{
- g_autofree char *file = g_build_filename (dirs[i], "mime", "globs", NULL);
- g_autofree char *contents = NULL;
+ g_autofree gchar *file = g_build_filename (dirs[i], "mime", "globs", NULL);
+ g_autofree gchar *contents = NULL;
if (g_file_get_contents (file, &contents, NULL, NULL))
{
diff --git a/panels/applications/globs.h b/panels/applications/globs.h
index afdf9ddcc..0a54588c0 100644
--- a/panels/applications/globs.h
+++ b/panels/applications/globs.h
@@ -24,6 +24,6 @@
G_BEGIN_DECLS
-GHashTable *parse_globs (void);
+GHashTable* parse_globs (void);
G_END_DECLS
diff --git a/panels/applications/meson.build b/panels/applications/meson.build
index 316a84892..75b9157c4 100644
--- a/panels/applications/meson.build
+++ b/panels/applications/meson.build
@@ -17,14 +17,15 @@ i18n.merge_file(
install_dir : control_center_desktopdir
)
-sources = files('cc-applications-panel.c',
- 'cc-applications-row.c',
- 'cc-toggle-row.c',
- 'cc-info-row.c',
- 'cc-action-row.c',
- 'utils.c',
- 'globs.c',
- 'search.c'
+sources = files(
+ 'cc-applications-panel.c',
+ 'cc-applications-row.c',
+ 'cc-toggle-row.c',
+ 'cc-info-row.c',
+ 'cc-action-row.c',
+ 'globs.c',
+ 'search.c',
+ 'utils.c',
)
resource_data = files('cc-applications-panel.ui')
diff --git a/panels/applications/search.c b/panels/applications/search.c
index fe05b7fc0..448918ba5 100644
--- a/panels/applications/search.c
+++ b/panels/applications/search.c
@@ -27,13 +27,12 @@
static void
add_one_provider (GHashTable *search_providers,
- GFile *file)
+ GFile *file)
{
- g_autofree gchar *path = NULL;
- g_autofree gchar *app_id = NULL;
g_autoptr(GKeyFile) keyfile = NULL;
- g_autoptr(GAppInfo) app_info = NULL;
g_autoptr(GError) error = NULL;
+ g_autofree gchar *app_id = NULL;
+ g_autofree gchar *path = NULL;
gboolean default_disabled;
path = g_file_get_path (file);
@@ -71,13 +70,13 @@ add_one_provider (GHashTable *search_providers,
}
static void
-parse_search_providers_one_dir (GHashTable *search_providers,
- const char *system_dir)
+parse_search_providers_one_dir (GHashTable *search_providers,
+ const gchar *system_dir)
{
- g_autofree char *providers_path = NULL;
- g_autoptr(GFile) providers_location = NULL;
g_autoptr(GFileEnumerator) enumerator = NULL;
g_autoptr(GError) error = NULL;
+ g_autoptr(GFile) providers_location = NULL;
+ g_autofree gchar *providers_path = NULL;
providers_path = g_build_filename (system_dir, "gnome-shell", "search-providers", NULL);
providers_location = g_file_new_for_path (providers_path);
@@ -119,8 +118,8 @@ GHashTable *
parse_search_providers (void)
{
GHashTable *search_providers;
- const char * const *dirs;
- int i;
+ const gchar * const *dirs;
+ gint i;
search_providers = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
diff --git a/panels/applications/search.h b/panels/applications/search.h
index 99a1a1d63..b7ade8240 100644
--- a/panels/applications/search.h
+++ b/panels/applications/search.h
@@ -24,6 +24,6 @@
G_BEGIN_DECLS
-GHashTable *parse_search_providers (void);
+GHashTable* parse_search_providers (void);
G_END_DECLS
diff --git a/panels/applications/utils.c b/panels/applications/utils.c
index 21cbbbbb8..f21e02e1d 100644
--- a/panels/applications/utils.c
+++ b/panels/applications/utils.c
@@ -32,29 +32,32 @@
#include "utils.h"
-static int
-ftw_remove_cb (const char *path, const struct stat *sb, int typeflags, struct FTW *ftwbuf)
+static gint
+ftw_remove_cb (const gchar *path,
+ const struct stat *sb,
+ gint typeflags,
+ struct FTW *ftwbuf)
{
remove (path);
return 0;
}
static void
-file_remove_thread_func (GTask *task,
- gpointer source_object,
- gpointer task_data,
+file_remove_thread_func (GTask *task,
+ gpointer source_object,
+ gpointer task_data,
GCancellable *cancellable)
{
GFile *file = source_object;
- g_autofree char *path = g_file_get_path (file);
+ g_autofree gchar *path = g_file_get_path (file);
nftw (path, ftw_remove_cb, 20, FTW_DEPTH);
}
void
-file_remove_async (GFile *file,
- GAsyncReadyCallback callback,
- gpointer data)
+file_remove_async (GFile *file,
+ GAsyncReadyCallback callback,
+ gpointer data)
{
g_autoptr(GTask) task = g_task_new (file, NULL, callback, data);
g_task_run_in_thread (task, file_remove_thread_func);
@@ -62,8 +65,11 @@ file_remove_async (GFile *file,
static GPrivate size_key = G_PRIVATE_INIT (g_free);
-static int
-ftw_size_cb (const char *path, const struct stat *sb, int typeflags, struct FTW *ftwbuf)
+static gint
+ftw_size_cb (const gchar *path,
+ const struct stat *sb,
+ gint typeflags,
+ struct FTW *ftwbuf)
{
guint64 *size = (guint64*)g_private_get (&size_key);
if (typeflags == FTW_F)
@@ -72,13 +78,13 @@ ftw_size_cb (const char *path, const struct stat *sb, int typeflags, struct FTW
}
static void
-file_size_thread_func (GTask *task,
- gpointer source_object,
- gpointer task_data,
+file_size_thread_func (GTask *task,
+ gpointer source_object,
+ gpointer task_data,
GCancellable *cancellable)
{
GFile *file = source_object;
- g_autofree char *path = g_file_get_path (file);
+ g_autofree gchar *path = g_file_get_path (file);
guint64 *total;
g_private_replace (&size_key, g_new0 (guint64, 1));
@@ -92,9 +98,9 @@ file_size_thread_func (GTask *task,
}
void
-file_size_async (GFile *file,
- GAsyncReadyCallback callback,
- gpointer data)
+file_size_async (GFile *file,
+ GAsyncReadyCallback callback,
+ gpointer data)
{
g_autoptr(GTask) task = g_task_new (file, NULL, callback, data);
g_task_run_in_thread (task, file_size_thread_func);
@@ -115,12 +121,12 @@ container_remove_all (GtkContainer *container)
}
FlatpakInstalledRef *
-find_flatpak_ref (const char *app_id)
+find_flatpak_ref (const gchar *app_id)
{
g_autoptr(FlatpakInstallation) inst = NULL;
g_autoptr(GPtrArray) array = NULL;
FlatpakInstalledRef *ref;
- int i;
+ gint i;
inst = flatpak_installation_new_user (NULL, NULL);
ref = flatpak_installation_get_current_installed_app (inst, app_id, NULL, NULL);
@@ -140,7 +146,7 @@ find_flatpak_ref (const char *app_id)
}
guint64
-get_flatpak_app_size (const char *app_id)
+get_flatpak_app_size (const gchar *app_id)
{
g_autoptr(FlatpakInstalledRef) ref = NULL;
@@ -154,7 +160,7 @@ get_flatpak_app_size (const char *app_id)
char *
get_app_id (GAppInfo *info)
{
- char *app_id = g_strdup (g_app_info_get_id (info));
+ gchar *app_id = g_strdup (g_app_info_get_id (info));
if (g_str_has_suffix (app_id, ".desktop"))
app_id[strlen (app_id) - strlen (".desktop")] = '\0';
diff --git a/panels/applications/utils.h b/panels/applications/utils.h
index 60f5c941f..ad58dd188 100644
--- a/panels/applications/utils.h
+++ b/panels/applications/utils.h
@@ -26,11 +26,20 @@
G_BEGIN_DECLS
-void file_remove_async (GFile *file, GAsyncReadyCallback callback, gpointer data);
-void file_size_async (GFile *file, GAsyncReadyCallback callback, gpointer data);
-void container_remove_all (GtkContainer *container);
-FlatpakInstalledRef *find_flatpak_ref (const char *app_id);
-guint64 get_flatpak_app_size (const char *app_id);
-char *get_app_id (GAppInfo *info);
+void file_remove_async (GFile *file,
+ GAsyncReadyCallback callback,
+ gpointer data);
+
+void file_size_async (GFile *file,
+ GAsyncReadyCallback callback,
+ gpointer data);
+
+void container_remove_all (GtkContainer *container);
+
+FlatpakInstalledRef* find_flatpak_ref (const gchar *app_id);
+
+guint64 get_flatpak_app_size (const gchar *app_id);
+
+gchar* get_app_id (GAppInfo *info);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]