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.
This commit is contained in:
Mike Massonnet
2010-06-06 14:00:54 +02:00
parent bdeff4e269
commit 81bdc6d2ba
5 changed files with 25 additions and 20 deletions

View File

@@ -56,8 +56,6 @@ xtm_app_manager_init (XtmAppManager *manager)
{ {
WnckScreen *screen = wnck_screen_get_default (); WnckScreen *screen = wnck_screen_get_default ();
GList *windows, *l; GList *windows, *l;
gint i;
App app;
/* Retrieve initial applications */ /* Retrieve initial applications */
while (gtk_events_pending ()) while (gtk_events_pending ())
@@ -123,9 +121,8 @@ apps_add_application (GArray *apps, WnckApplication *application)
static void static void
apps_remove_application (GArray *apps, WnckApplication *application) apps_remove_application (GArray *apps, WnckApplication *application)
{ {
App *app; App *app = NULL;
gint pid; guint i;
gint i;
for (i = 0; i < apps->len; i++) for (i = 0; i < apps->len; i++)
{ {
@@ -134,20 +131,23 @@ apps_remove_application (GArray *apps, WnckApplication *application)
break; break;
} }
g_object_unref (app->icon); if (app != NULL)
g_array_remove_index (apps, i); {
g_object_unref (app->icon);
g_array_remove_index (apps, i);
}
} }
static App * static App *
apps_lookup_pid (GArray *apps, gint pid) apps_lookup_pid (GArray *apps, gint pid)
{ {
App *app; App *app;
gint i; guint i;
for (app = NULL, i = 0; i < apps->len; i++) for (app = NULL, i = 0; i < apps->len; i++)
{ {
app = &g_array_index (apps, App, i); app = &g_array_index (apps, App, i);
if (app->pid == pid) if (app->pid == (guint)pid)
break; break;
app = NULL; app = NULL;
} }
@@ -176,7 +176,7 @@ application_closed (WnckScreen *screen, WnckApplication *application, XtmAppMana
XtmAppManager * XtmAppManager *
xtm_app_manager_new () xtm_app_manager_new (void)
{ {
return g_object_new (XTM_TYPE_APP_MANAGER, NULL); return g_object_new (XTM_TYPE_APP_MANAGER, NULL);
} }

View File

@@ -26,7 +26,7 @@ static XtmTaskManager *task_manager;
static gboolean timeout = 0; static gboolean timeout = 0;
static void static void
status_icon_activated () status_icon_activated (void)
{ {
if (!(GTK_WIDGET_VISIBLE (window))) if (!(GTK_WIDGET_VISIBLE (window)))
gtk_widget_show (window); gtk_widget_show (window);
@@ -35,7 +35,7 @@ status_icon_activated ()
} }
static void static void
show_hide_status_icon () show_hide_status_icon (void)
{ {
gboolean show_status_icon; gboolean show_status_icon;
g_object_get (settings, "show-status-icon", &show_status_icon, NULL); g_object_get (settings, "show-status-icon", &show_status_icon, NULL);
@@ -96,7 +96,7 @@ force_timeout_update (void)
} }
static void static void
refresh_rate_changed (XtmSettings *settings) refresh_rate_changed (void)
{ {
if (!g_source_remove (timeout)) if (!g_source_remove (timeout))
{ {

View File

@@ -11,6 +11,10 @@
#include <config.h> #include <config.h>
#endif #endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <glib-object.h> #include <glib-object.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>

View File

@@ -30,5 +30,6 @@ GType xtm_process_window_get_type (void);
GtkWidget * xtm_process_window_new (); GtkWidget * xtm_process_window_new ();
GtkTreeModel * xtm_process_window_get_model (XtmProcessWindow *window); 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_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 */ #endif /* !PROCESS_WINDOW_H */

View File

@@ -364,11 +364,11 @@ model_find_tree_iter_for_pid (GtkTreeModel *model, guint pid, GtkTreeIter *iter)
} }
static glong static glong
__current_timestamp () __current_timestamp (void)
{ {
GTimeVal time; GTimeVal current_time;
g_get_current_time (&time); g_get_current_time (&current_time);
return time.tv_sec; return current_time.tv_sec;
} }
@@ -609,9 +609,6 @@ xtm_task_manager_update_model (XtmTaskManager *manager)
if (found == FALSE) if (found == FALSE)
{ {
#if DEBUG
g_debug ("Add new task %d %s", tasktmp->pid, tasktmp->name);
#endif
#ifdef HAVE_WNCK #ifdef HAVE_WNCK
App *app = xtm_app_manager_get_app_from_pid (manager->app_manager, tasktmp->pid); App *app = xtm_app_manager_get_app_from_pid (manager->app_manager, tasktmp->pid);
model_add_task (manager->model, tasktmp, app, __current_timestamp ()); 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 ()); model_add_task (manager->model, tasktmp, __current_timestamp ());
#endif #endif
g_array_append_val (manager->tasks, *tasktmp); g_array_append_val (manager->tasks, *tasktmp);
#if DEBUG
g_debug ("Add new task %d %s", tasktmp->pid, tasktmp->name);
#endif
} }
} }