<xfce4-taskmanager:master> Fix compiler warnings (original patches from Enrico Tröger)
Mike Massonnet
noreply at xfce.org
Tue Jun 8 22:44:01 CEST 2010
Updating branch refs/heads/master
to 81bdc6d2ba5dae64e263e4b78ab499d6cf865e7f (commit)
from bdeff4e269e8ae1f734486d8ae10d6489c5116b5 (commit)
commit 81bdc6d2ba5dae64e263e4b78ab499d6cf865e7f
Author: Mike Massonnet <mmassonnet at xfce.org>
Date: Sun Jun 6 14:00:54 2010 +0200
Fix compiler warnings (original patches from Enrico Tröger)
Add missing include for geteuid() missing declaration
xtm_process_window_show_swap_usage() in process-window.
Fix various compiler warnings from main.c task-manager.c and
app-manager.c.
src/app-manager.c | 20 ++++++++++----------
src/main.c | 6 +++---
src/process-window.c | 4 ++++
src/process-window.h | 1 +
src/task-manager.c | 14 +++++++-------
5 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/src/app-manager.c b/src/app-manager.c
index 07bbf82..a3609f4 100644
--- a/src/app-manager.c
+++ b/src/app-manager.c
@@ -56,8 +56,6 @@ xtm_app_manager_init (XtmAppManager *manager)
{
WnckScreen *screen = wnck_screen_get_default ();
GList *windows, *l;
- gint i;
- App app;
/* Retrieve initial applications */
while (gtk_events_pending ())
@@ -123,9 +121,8 @@ apps_add_application (GArray *apps, WnckApplication *application)
static void
apps_remove_application (GArray *apps, WnckApplication *application)
{
- App *app;
- gint pid;
- gint i;
+ App *app = NULL;
+ guint i;
for (i = 0; i < apps->len; i++)
{
@@ -134,20 +131,23 @@ apps_remove_application (GArray *apps, WnckApplication *application)
break;
}
- g_object_unref (app->icon);
- g_array_remove_index (apps, i);
+ if (app != NULL)
+ {
+ g_object_unref (app->icon);
+ g_array_remove_index (apps, i);
+ }
}
static App *
apps_lookup_pid (GArray *apps, gint pid)
{
App *app;
- gint i;
+ guint i;
for (app = NULL, i = 0; i < apps->len; i++)
{
app = &g_array_index (apps, App, i);
- if (app->pid == pid)
+ if (app->pid == (guint)pid)
break;
app = NULL;
}
@@ -176,7 +176,7 @@ application_closed (WnckScreen *screen, WnckApplication *application, XtmAppMana
XtmAppManager *
-xtm_app_manager_new ()
+xtm_app_manager_new (void)
{
return g_object_new (XTM_TYPE_APP_MANAGER, NULL);
}
diff --git a/src/main.c b/src/main.c
index 12f823f..2d1fdb2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -26,7 +26,7 @@ static XtmTaskManager *task_manager;
static gboolean timeout = 0;
static void
-status_icon_activated ()
+status_icon_activated (void)
{
if (!(GTK_WIDGET_VISIBLE (window)))
gtk_widget_show (window);
@@ -35,7 +35,7 @@ status_icon_activated ()
}
static void
-show_hide_status_icon ()
+show_hide_status_icon (void)
{
gboolean show_status_icon;
g_object_get (settings, "show-status-icon", &show_status_icon, NULL);
@@ -96,7 +96,7 @@ force_timeout_update (void)
}
static void
-refresh_rate_changed (XtmSettings *settings)
+refresh_rate_changed (void)
{
if (!g_source_remove (timeout))
{
diff --git a/src/process-window.c b/src/process-window.c
index af75d33..43986d9 100644
--- a/src/process-window.c
+++ b/src/process-window.c
@@ -11,6 +11,10 @@
#include <config.h>
#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
#include <glib-object.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>
diff --git a/src/process-window.h b/src/process-window.h
index 8dfaeaa..f6fdc12 100644
--- a/src/process-window.h
+++ b/src/process-window.h
@@ -30,5 +30,6 @@ GType xtm_process_window_get_type (void);
GtkWidget * xtm_process_window_new ();
GtkTreeModel * xtm_process_window_get_model (XtmProcessWindow *window);
void xtm_process_window_set_system_info (XtmProcessWindow *window, guint num_processes, gfloat cpu, gfloat memory, gfloat swap);
+void xtm_process_window_show_swap_usage (XtmProcessWindow *window, gboolean show_swap_usage);
#endif /* !PROCESS_WINDOW_H */
diff --git a/src/task-manager.c b/src/task-manager.c
index 5b13ebf..76dbb9c 100644
--- a/src/task-manager.c
+++ b/src/task-manager.c
@@ -364,11 +364,11 @@ model_find_tree_iter_for_pid (GtkTreeModel *model, guint pid, GtkTreeIter *iter)
}
static glong
-__current_timestamp ()
+__current_timestamp (void)
{
- GTimeVal time;
- g_get_current_time (&time);
- return time.tv_sec;
+ GTimeVal current_time;
+ g_get_current_time (¤t_time);
+ return current_time.tv_sec;
}
@@ -609,9 +609,6 @@ xtm_task_manager_update_model (XtmTaskManager *manager)
if (found == FALSE)
{
-#if DEBUG
- g_debug ("Add new task %d %s", tasktmp->pid, tasktmp->name);
-#endif
#ifdef HAVE_WNCK
App *app = xtm_app_manager_get_app_from_pid (manager->app_manager, tasktmp->pid);
model_add_task (manager->model, tasktmp, app, __current_timestamp ());
@@ -619,6 +616,9 @@ xtm_task_manager_update_model (XtmTaskManager *manager)
model_add_task (manager->model, tasktmp, __current_timestamp ());
#endif
g_array_append_val (manager->tasks, *tasktmp);
+#if DEBUG
+ g_debug ("Add new task %d %s", tasktmp->pid, tasktmp->name);
+#endif
}
}
More information about the Xfce4-commits
mailing list