[gnome-system-tools: 39/39] Fix all warnings in users-admin



commit b5eb029b8c78991f9599b1d01a35a75b6ba469d3
Author: Milan Bouchet-Valat <nalimilan club fr>
Date:   Mon Nov 30 23:21:52 2009 +0100

    Fix all warnings in users-admin
    
    Since no warnings were enabled until now, a load of cruft has accumulated, mostly unused variables and missing headers. Fix all of this so that we can work more cleanly from now on.

 src/common/gst-dialog.c         |    6 ++--
 src/common/gst-tool.h           |    5 ++++
 src/users/callbacks.c           |   10 +------
 src/users/group-members-table.h |    4 ++-
 src/users/group-settings.c      |    2 +
 src/users/groups-table.c        |    1 -
 src/users/groups-table.h        |    6 ++++
 src/users/privileges-table.c    |    6 +++-
 src/users/user-profiles.c       |   11 ++------
 src/users/user-settings.c       |   49 +-------------------------------------
 src/users/user-settings.h       |    4 +++
 src/users/users-table.c         |    3 --
 src/users/users-tool.c          |    4 +++
 13 files changed, 38 insertions(+), 73 deletions(-)
---
diff --git a/src/common/gst-dialog.c b/src/common/gst-dialog.c
index ebf2641..f528da5 100644
--- a/src/common/gst-dialog.c
+++ b/src/common/gst-dialog.c
@@ -245,10 +245,10 @@ gst_dialog_constructor (GType                  type,
 			action_area = gtk_dialog_get_action_area (GTK_DIALOG (dialog));
 			gtk_box_pack_start (GTK_BOX (action_area), priv->polkit_button, TRUE, TRUE, 0);
 			gtk_widget_show (priv->polkit_button);
-		}
 
-		g_signal_connect_swapped (priv->polkit_button, "changed",
-					  G_CALLBACK (gst_dialog_lock_changed), dialog);
+			g_signal_connect_swapped (priv->polkit_button, "changed",
+		                          G_CALLBACK (gst_dialog_lock_changed), dialog);
+		}
 	}
 #endif
 
diff --git a/src/common/gst-tool.h b/src/common/gst-tool.h
index 2845621..5cd7a70 100644
--- a/src/common/gst-tool.h
+++ b/src/common/gst-tool.h
@@ -89,6 +89,11 @@ void         gst_init                     (const gchar *app_name,
 					   int argc, char *argv [],
 					   GOptionEntry *entries);
 
+void         gst_init_tool                (const char   *app_name,
+                                           int           argc,
+                                           char         *argv [],
+                                           GOptionEntry *entries);
+
 void         gst_tool_update_gui          (GstTool *tool);
 void         gst_tool_update_config       (GstTool *tool);
 void         gst_tool_close               (GstTool *tool);
diff --git a/src/users/callbacks.c b/src/users/callbacks.c
index c4d0874..c5f4a3a 100644
--- a/src/users/callbacks.c
+++ b/src/users/callbacks.c
@@ -43,9 +43,6 @@ extern GstTool *tool;
 static void
 actions_set_sensitive (gint table, gint count)
 {
-	OobsObject *object = GST_USERS_TOOL (tool)->self_config;
-	gboolean sensitive;
-
 	switch (table) {
 	case TABLE_USERS:
 		gst_dialog_try_set_sensitive (tool->main_dialog,
@@ -76,7 +73,6 @@ void
 on_table_selection_changed (GtkTreeSelection *selection, gpointer data)
 {
 	gint count, table;
-	gboolean active;
 	OobsUser *user = NULL;
 
 	table = GPOINTER_TO_INT (data);
@@ -215,13 +211,12 @@ on_popup_delete_activate (GtkAction *action, gpointer data)
 void
 on_user_settings_clicked (GtkButton *button, gpointer user_data)
 {
-	GtkWidget *table, *dialog;
+	GtkWidget *table;
 	GtkTreePath *path;
 	GtkTreeModel *model;
-	GtkTreeIter iter, filter_iter;
+	GtkTreeIter iter;
 	OobsUser *user;
 	OobsListIter *list_iter;
-	gint response;
 
 	table = gst_dialog_get_widget (tool->main_dialog, "users_table");
 	model = gtk_tree_view_get_model (GTK_TREE_VIEW (table));
@@ -369,7 +364,6 @@ on_group_delete_clicked (GtkButton *button, gpointer user_data)
 {
 	GtkTreeModel *model;
 	GtkTreePath *path;
-	GtkTreeIter iter;
 	GList *list, *elem;
 
 	list = elem = table_get_row_references (TABLE_GROUPS, &model);
diff --git a/src/users/group-members-table.h b/src/users/group-members-table.h
index 7f82dc7..881735c 100644
--- a/src/users/group-members-table.h
+++ b/src/users/group-members-table.h
@@ -19,4 +19,6 @@
  * Authors: Carlos Garnacho Parro <carlosg gnome org>
  */
 
-void   create_group_members_table   (void);
+void   create_group_members_table         (void);
+void   group_members_table_set_from_group (OobsGroup *group);
+void   group_members_table_save           (OobsGroup *group);
diff --git a/src/users/group-settings.c b/src/users/group-settings.c
index ee2dd75..5cae1c8 100644
--- a/src/users/group-settings.c
+++ b/src/users/group-settings.c
@@ -26,7 +26,9 @@
 #include <glib/gi18n.h>
 
 #include <string.h>
+#include <ctype.h>
 
+#include "group-members-table.h"
 #include "groups-table.h"
 #include "table.h"
 #include "callbacks.h"
diff --git a/src/users/groups-table.c b/src/users/groups-table.c
index a526360..15ab37f 100644
--- a/src/users/groups-table.c
+++ b/src/users/groups-table.c
@@ -36,7 +36,6 @@ add_group_columns (GtkTreeView *treeview)
 {
 	GtkTreeViewColumn *column;
 	GtkCellRenderer *renderer;
-	guint i;
 
 	column = gtk_tree_view_column_new ();
 
diff --git a/src/users/groups-table.h b/src/users/groups-table.h
index d45f29b..55ccf41 100644
--- a/src/users/groups-table.h
+++ b/src/users/groups-table.h
@@ -54,4 +54,10 @@ void	create_groups_table		(void);
 void	populate_groups_table		(void);
 void	group_table_update_content	(void);
 
+void    groups_table_set_group          (OobsGroup    *group,
+                                         OobsListIter *list_iter,
+                                         GtkTreeIter  *iter);
+void    groups_table_add_group          (OobsGroup    *group,
+                                         OobsListIter *list_iter);
+
 #endif /* _GROUPS_TABLE_H */
diff --git a/src/users/privileges-table.c b/src/users/privileges-table.c
index 94f5fca..64fc98f 100644
--- a/src/users/privileges-table.c
+++ b/src/users/privileges-table.c
@@ -24,8 +24,11 @@
  */
 
 #include <config.h>
-#include "gst.h"
+
+#include <stdlib.h>
 #include <glib/gi18n.h>
+
+#include "gst.h"
 #include "privileges-table.h"
 #include "user-profiles.h"
 
@@ -139,7 +142,6 @@ create_user_privileges_table (void)
 	GtkTreeModel *model, *filter_model;
 	GtkCellRenderer *renderer;
 	GtkTreeViewColumn *column;
-	GtkTreeIter iter;
 
 	list = gst_dialog_get_widget (tool->main_dialog, "user_privileges");
 
diff --git a/src/users/user-profiles.c b/src/users/user-profiles.c
index 22437b4..594b83c 100644
--- a/src/users/user-profiles.c
+++ b/src/users/user-profiles.c
@@ -84,7 +84,6 @@ load_profiles (GstUserProfiles *profiles)
 	GKeyFile *key_file;
 	gchar **groups, **group, **group_name;
 	GstUserProfile *profile;
-	GList *l, *item;
 
 	priv = GST_USER_PROFILES_GET_PRIVATE (profiles);
 	key_file = g_key_file_new ();
@@ -202,8 +201,6 @@ GList*
 gst_user_profiles_get_list (GstUserProfiles *profiles)
 {
 	GstUserProfilesPrivate *priv;
-	GstUserProfile *profile;
-	GList *l;
 
 	g_return_val_if_fail (GST_IS_USER_PROFILES (profiles), NULL);
 	priv = GST_USER_PROFILES_GET_PRIVATE (profiles);
@@ -216,7 +213,7 @@ gst_user_profiles_get_default_profile (GstUserProfiles *profiles)
 {
 	GstUserProfilesPrivate *priv;
 
-	g_return_if_fail (GST_IS_USER_PROFILES (profiles));
+	g_return_val_if_fail (GST_IS_USER_PROFILES (profiles), NULL);
 
 	priv = GST_USER_PROFILES_GET_PRIVATE (profiles);
 
@@ -243,12 +240,10 @@ gst_user_profiles_get_for_user (GstUserProfiles *profiles,
 	GstUserProfilesPrivate *priv;
 	GstUserProfile *profile;
 	GstUserProfile *matched;
-	GHashTableIter iter;
-	gpointer value;
 	GFile *file_home, *file_prefix;
 	const gchar *shell, *home;
 	gint uid;
-	gchar **groups, **group_name;
+	gchar **group_name;
 	OobsGroup *group;
 	GList *l, *m;
 	gboolean matched_groups, in_profile, in_group;
@@ -292,7 +287,7 @@ gst_user_profiles_get_for_user (GstUserProfiles *profiles,
 			continue;
 
 		/* check user's membership to all groups of the profile,
-		/* also check that user is not member of any group
+		 * also check that user is not member of any group
 		 * that defines another profile vs the current one */
 		matched_groups = TRUE;
 		for (m = priv->all_groups; m && matched_groups; m = m->next) {
diff --git a/src/users/user-settings.c b/src/users/user-settings.c
index 9b1ea71..162e52a 100644
--- a/src/users/user-settings.c
+++ b/src/users/user-settings.c
@@ -156,7 +156,6 @@ on_user_delete_clicked (GtkButton *button, gpointer user_data)
 {
 	GtkTreeModel *model;
 	GtkTreePath *path;
-	GtkTreeIter iter;
 	GList *list, *elem;
 	gboolean count;
 
@@ -299,7 +298,6 @@ get_no_passwd_login_group ()
 	OobsGroup *group;
 	gboolean valid;
 	const gchar *group_name;
-	gid_t gid;
 
 	config = OOBS_GROUPS_CONFIG (GST_USERS_TOOL (tool)->groups_config);
 	groups_list = oobs_groups_config_get_groups (config);
@@ -454,10 +452,8 @@ void
 user_settings_set (OobsUser *user)
 {
 	OobsUsersConfig *config;
-	OobsGroup *no_passwd_login_group;
-	GtkWidget *dialog, *widget, *widget2, *notice;
+	GtkWidget *widget, *widget2, *notice;
 	const gchar *login = NULL;
-	gchar *title;
 	gint uid;
 	GdkPixbuf *face;
 	GstUserProfile *profile;
@@ -579,44 +575,6 @@ login_exists (const gchar *login)
 }
 
 static void
-check_login (gchar **primary_text, gchar **secondary_text, gpointer data)
-{
-	OobsUser *user;
-	GtkWidget *widget;
-	GtkWidget *combo;
-	GtkTreeModel *model;
-	GtkTreeIter iter;
-	const gchar *login;
-	gchar *group;
-
-	user = g_object_get_data (G_OBJECT (data), "user");
-
-	widget = gst_dialog_get_widget (tool->main_dialog, "user_settings_name");
-	login = gtk_entry_get_text (GTK_ENTRY (widget));
-
-	combo = gst_dialog_get_widget (tool->main_dialog, "user_settings_group");
-
-	if (strlen (login) < 1) {
-		*primary_text = g_strdup (_("User name is empty"));
-		*secondary_text = g_strdup (_("A user name must be specified."));
-	} else if (!is_valid_name (login)) {
-		*primary_text = g_strdup (_("User name has invalid characters"));
-		*secondary_text = g_strdup (_("Please set a valid user name consisting of "
-		                              "a lower case letter followed by lower case "
-		                              "letters and numbers."));
-	} else if (!user && login_exists (login)) {
-		*primary_text = g_strdup_printf (_("User name \"%s\" already exists"), login);
-		*secondary_text = g_strdup (_("Please choose a different user name."));
-	/* Check that the new user won't be added to an already existing group
-	 * without that group being explicitly chosen in the list (temporary security check) */
-	} else if (!user && gtk_combo_box_get_active (GTK_COMBO_BOX (combo)) == -1
-	                 && group_settings_group_exists (login)) {
-		*primary_text = g_strdup_printf (_("Group \"%s\" already exists"), login);
-		*secondary_text = g_strdup (_("Please choose a different user name."));
-	}
-}
-
-static void
 check_comments (gchar **primary_text, gchar **secondary_text, gpointer data)
 {
 	GtkWidget *name, *room_number, *wphone, *hphone;
@@ -778,7 +736,6 @@ on_user_new_name_changed (GtkEditable *user_name, gpointer user_data)
 	GtkWidget *validate_button;
 	GtkWidget *user_login;
 	GtkTreeModel *model;
-	GdkColor color;
 	gboolean valid_login;
 	gboolean valid_name;
 	const char *name;
@@ -1118,6 +1075,7 @@ on_user_new (GtkButton *button, gpointer user_data)
 		gst_tool_commit (tool, GST_USERS_TOOL (tool)->groups_config);
 		user_path = users_table_add_user (user, &list_iter);
 		users_table_select_path (user_path);
+		gtk_tree_path_free (user_path);
 
 		/* Finally, run the password edit dialog.
 		 * User can hit cancel, leaving the account disabled */
@@ -1125,7 +1083,6 @@ on_user_new (GtkButton *button, gpointer user_data)
 	}
 
 	g_object_unref (user);
-	gtk_tree_path_free (user_path);
 }
 
 /*
@@ -1308,7 +1265,6 @@ on_edit_user_profile (GtkButton *button, gpointer user_data)
 {
 	int response;
 	GtkWidget *user_profile_dialog;
-	GtkWidget *user_profile_entry;
 	GtkWidget *face_image;
 	GtkWidget *name_label;
 	GtkWidget *table;
@@ -1321,7 +1277,6 @@ on_edit_user_profile (GtkButton *button, gpointer user_data)
 	gpointer value;
 	OobsUser *user;
 	GstUserProfile *profile;
-	gchar *name;
 
 	user_profile_dialog = gst_dialog_get_widget (tool->main_dialog, "user_profile_dialog");
 	face_image = gst_dialog_get_widget (tool->main_dialog, "user_profile_face");
diff --git a/src/users/user-settings.h b/src/users/user-settings.h
index 028ef2c..5328838 100644
--- a/src/users/user-settings.h
+++ b/src/users/user-settings.h
@@ -40,6 +40,10 @@ OobsUser *      user_settings_dialog_get_data    (GtkWidget *dialog);
 GdkPixbuf *     user_settings_get_user_face      (OobsUser *user, int size);
 uid_t           user_settings_find_new_uid       (gint uid_min,
                                                   gint uid_max);
+gboolean        user_settings_is_user_in_group   (OobsUser  *user,
+                                                  OobsGroup *group);
+
+void            on_user_new                      (GtkButton *button, gpointer user_data);
 
 
 #endif /* USER_SETTINGS_H */
diff --git a/src/users/users-table.c b/src/users/users-table.c
index ff51cb0..73dbc1a 100644
--- a/src/users/users-table.c
+++ b/src/users/users-table.c
@@ -142,12 +142,10 @@ users_table_set_user (OobsUser *user, OobsListIter *list_iter, GtkTreeIter *iter
 	GtkWidget *users_table = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "users_table");
 	GtkTreeModel *filter_model = gtk_tree_view_get_model (GTK_TREE_VIEW (users_table));
 	GtkTreeModel *model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (filter_model));
-	OobsObject *object = GST_USERS_TOOL (tool)->self_config;
 	GdkPixbuf *face;
 	const char *name;
 	const char *login;
 	char *label;
-	gboolean sensitive;
 
 	face = user_settings_get_user_face (user, 48);
 	name = oobs_user_get_full_name (user);
@@ -181,7 +179,6 @@ users_table_add_user (OobsUser *user, OobsListIter *list_iter)
 	GtkWidget *users_table = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "users_table");
 	GtkTreeModel *filter_model = gtk_tree_view_get_model (GTK_TREE_VIEW (users_table));
 	GtkTreeModel *model = gtk_tree_model_filter_get_model (GTK_TREE_MODEL_FILTER (filter_model));
-	GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (users_table));
 	GtkTreeIter iter;
 
 	gtk_list_store_append (GTK_LIST_STORE (model), &iter);
diff --git a/src/users/users-tool.c b/src/users/users-tool.c
index 424e168..310d407 100644
--- a/src/users/users-tool.c
+++ b/src/users/users-tool.c
@@ -23,6 +23,10 @@
 #include <glib/gi18n.h>
 #include "callbacks.h"
 #include "user-profiles.h"
+#include "users-table.h"
+#include "groups-table.h"
+#include "privileges-table.h"
+#include "table.h"
 #include "users-tool.h"
 #include "gst.h"
 



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