[gnome-panel] panel-applet-private: fix build warnings
- From: Alberts Muktupāvels <muktupavels src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-panel] panel-applet-private: fix build warnings
- Date: Sat, 26 Sep 2015 22:01:04 +0000 (UTC)
commit e8b364fbaa6e26c018626b8bead7bc46b2a4d1ed
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date: Sat Sep 26 23:58:03 2015 +0300
panel-applet-private: fix build warnings
.../panel-applet-container.c | 2 +-
.../panel-applets-manager-dbus.c | 123 +++++++++++---------
2 files changed, 69 insertions(+), 56 deletions(-)
---
diff --git a/gnome-panel/libpanel-applet-private/panel-applet-container.c
b/gnome-panel/libpanel-applet-private/panel-applet-container.c
index fdfc5c3..fea6bfe 100644
--- a/gnome-panel/libpanel-applet-private/panel-applet-container.c
+++ b/gnome-panel/libpanel-applet-private/panel-applet-container.c
@@ -223,7 +223,7 @@ panel_applet_container_class_init (PanelAppletContainerClass *klass)
static const AppletPropertyInfo *
panel_applet_container_child_property_get_info (const gchar *property_name)
{
- gint i;
+ gsize i;
g_assert (property_name != NULL);
diff --git a/gnome-panel/libpanel-applet-private/panel-applets-manager-dbus.c
b/gnome-panel/libpanel-applet-private/panel-applets-manager-dbus.c
index 0b25ba8..93f1cb4 100644
--- a/gnome-panel/libpanel-applet-private/panel-applets-manager-dbus.c
+++ b/gnome-panel/libpanel-applet-private/panel-applets-manager-dbus.c
@@ -124,7 +124,7 @@ panel_applets_manager_get_applet_factory_info_from_file (const gchar *filename)
GKeyFile *applet_file;
gchar **groups;
gsize n_groups;
- gint i;
+ gsize i;
GError *error = NULL;
applet_file = g_key_file_new ();
@@ -224,65 +224,78 @@ applets_directory_changed (GFileMonitor *monitor,
GFileMonitorEvent event_type,
gpointer user_data)
{
- PanelAppletsManagerDBus *manager = PANEL_APPLETS_MANAGER_DBUS (user_data);
+ PanelAppletsManagerDBus *manager;
+ PanelAppletFactoryInfo *info;
+ PanelAppletFactoryInfo *old_info;
+ gchar *filename;
+ GSList *dirs;
+ GSList *d;
- switch (event_type) {
- case G_FILE_MONITOR_EVENT_CHANGED:
- case G_FILE_MONITOR_EVENT_CREATED: {
- PanelAppletFactoryInfo *info;
- PanelAppletFactoryInfo *old_info;
- gchar *filename;
- GSList *dirs, *d;
-
- filename = g_file_get_path (file);
- if (!g_str_has_suffix (filename, PANEL_APPLETS_EXTENSION)) {
- g_free (filename);
- return;
- }
-
- info = panel_applets_manager_get_applet_factory_info_from_file (filename);
- g_free (filename);
+ /* Ignore any other change */
+ if (event_type != G_FILE_MONITOR_EVENT_CHANGED &&
+ event_type != G_FILE_MONITOR_EVENT_CREATED)
+ return;
- if (!info)
- return;
+ manager = PANEL_APPLETS_MANAGER_DBUS (user_data);
- old_info = g_hash_table_lookup (manager->priv->applet_factories, info->id);
- if (!old_info) {
- /* New applet, just insert it */
- g_hash_table_insert (manager->priv->applet_factories, g_strdup (info->id), info);
- return;
- }
+ filename = g_file_get_path (file);
- /* Make sure we don't update an applet that has changed in
- * another source dir unless it takes precedence over the
- * current one */
- if (g_strcmp0 (info->srcdir, old_info->srcdir) == 0) {
- g_hash_table_replace (manager->priv->applet_factories, g_strdup (info->id), info);
+ if (!g_str_has_suffix (filename, PANEL_APPLETS_EXTENSION))
+ {
+ g_free (filename);
return;
- }
-
- dirs = panel_applets_manager_get_applets_dirs ();
-
- for (d = dirs; d; d = g_slist_next (d)) {
- gchar *path = (gchar *) d->data;
-
- if (g_strcmp0 (path, old_info->srcdir) == 0) {
- panel_applet_factory_info_free (info);
- break;
- } else if (g_strcmp0 (path, info->srcdir) == 0) {
- g_hash_table_replace (manager->priv->applet_factories, g_strdup (info->id),
info);
- break;
- }
- }
-
- g_slist_foreach (dirs, (GFunc) g_free, NULL);
- g_slist_free (dirs);
- }
- break;
- default:
- /* Ignore any other change */
- break;
- }
+ }
+
+ info = panel_applets_manager_get_applet_factory_info_from_file (filename);
+ g_free (filename);
+
+ if (!info)
+ return;
+
+ old_info = g_hash_table_lookup (manager->priv->applet_factories, info->id);
+
+ if (!old_info)
+ {
+ /* New applet, just insert it */
+ g_hash_table_insert (manager->priv->applet_factories,
+ g_strdup (info->id), info);
+ return;
+ }
+
+ /*
+ * Make sure we don't update an applet that has changed in another source
+ * dir unless it takes precedence over the current one.
+ */
+ if (g_strcmp0 (info->srcdir, old_info->srcdir) == 0)
+ {
+ g_hash_table_replace (manager->priv->applet_factories,
+ g_strdup (info->id), info);
+ return;
+ }
+
+ dirs = panel_applets_manager_get_applets_dirs ();
+
+ for (d = dirs; d; d = g_slist_next (d))
+ {
+ gchar *path;
+
+ path = (gchar *) d->data;
+
+ if (g_strcmp0 (path, old_info->srcdir) == 0)
+ {
+ panel_applet_factory_info_free (info);
+ break;
+ }
+ else if (g_strcmp0 (path, info->srcdir) == 0)
+ {
+ g_hash_table_replace (manager->priv->applet_factories,
+ g_strdup (info->id), info);
+ break;
+ }
+ }
+
+ g_slist_foreach (dirs, (GFunc) g_free, NULL);
+ g_slist_free (dirs);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]