2004-08-29 Colin Walters <walters@verbum.org>

* test/nminfotest.c: Include string.h and stdlib.h.
	(get_network_string_property, get_networks_of_type): Return NULL.

	* test/nmclienttest.c (get_device_name, get_active_device): Return
	NULL.

	* src/backends/NetworkManagerRedHat.c (nm_system_device_stop_dhcp): Just
	use strlen, fgets always NULL-terminates the string.

	* src/NetworkManagerDbus.c (nm_dbus_nmi_filter,
	dbus_message_get_member): Remove /* in comment.

	* src/NetworkManagerUtils.c (LOCKING_DEBUG): Ditto.

	* src/NetworkManager.c (quit): Unused, delete.
	(nm_data_free): Cast arg to GFunc.

	* panel-applet/NMWirelessAppletDbus.c: Need to include
	string.h, and dbus-glib-lowlevel.h (the latter is needed
	for dbus_connection_setup_with_g_main at present).
	(nmwa_dbus_update_wireless_network_list): Parenthesize
	assignment in conditional.
	(nmwa_dbus_worker): Return NULL.

	* panel-applet/NMWirelessApplet.c (nmwa_redraw)
	(nmwa_get_menu_pos, nmwa_toplevel_menu_activate)
	(nmwa_menu_add_text_item, nmwa_setup_widgets): Kill unused variables.
	(nmwa_populate_menu): Return NULL on failure, instead of just
	return;

	* initscript/NMLaunchHelper.c (g_timeout_add): Cast arg to GSourceFunc.

	* info-daemon/NetworkManagerInfoNetworksDialog.c (nmi_networks_dialog_init): Kill unused
	variables.

	* info-daemon/NetworkManagerInfo.c (nmi_print_usage): Unused,
	delete.


git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@105 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
Colin Walters
2004-08-29 06:06:51 +00:00
parent c639ff8694
commit 6871fe28bc
12 changed files with 65 additions and 55 deletions

View File

@@ -1,3 +1,43 @@
2004-08-29 Colin Walters <walters@verbum.org>
* test/nminfotest.c: Include string.h and stdlib.h.
(get_network_string_property, get_networks_of_type): Return NULL.
* test/nmclienttest.c (get_device_name, get_active_device): Return
NULL.
* src/backends/NetworkManagerRedHat.c (nm_system_device_stop_dhcp): Just
use strlen, fgets always NULL-terminates the string.
* src/NetworkManagerDbus.c (nm_dbus_nmi_filter,
dbus_message_get_member): Remove /* in comment.
* src/NetworkManagerUtils.c (LOCKING_DEBUG): Ditto.
* src/NetworkManager.c (quit): Unused, delete.
(nm_data_free): Cast arg to GFunc.
* panel-applet/NMWirelessAppletDbus.c: Need to include
string.h, and dbus-glib-lowlevel.h (the latter is needed
for dbus_connection_setup_with_g_main at present).
(nmwa_dbus_update_wireless_network_list): Parenthesize
assignment in conditional.
(nmwa_dbus_worker): Return NULL.
* panel-applet/NMWirelessApplet.c (nmwa_redraw)
(nmwa_get_menu_pos, nmwa_toplevel_menu_activate)
(nmwa_menu_add_text_item, nmwa_setup_widgets): Kill unused variables.
(nmwa_populate_menu): Return NULL on failure, instead of just
return;
* initscript/NMLaunchHelper.c (g_timeout_add): Cast arg to GSourceFunc.
* info-daemon/NetworkManagerInfoNetworksDialog.c (nmi_networks_dialog_init): Kill unused
variables.
* info-daemon/NetworkManagerInfo.c (nmi_print_usage): Unused,
delete.
2004-08-29 Colin Walters <walters@verbum.org> 2004-08-29 Colin Walters <walters@verbum.org>
* src/NetworkManagerDbus.c (nm_dbus_get_network_timestamp): Return * src/NetworkManagerDbus.c (nm_dbus_get_network_timestamp): Return

View File

@@ -92,26 +92,6 @@ void nmi_gconf_notify_callback (GConfClient *client, guint connection_id, GConfE
} }
/*
* nmi_print_usage
*
* Prints program usage.
*
*/
static void nmi_print_usage (void)
{
fprintf (stderr, "\n" "usage : NetworkManagerInfo [--daemon=yes|no] [--help]\n");
fprintf (stderr,
"\n"
" --daemon=yes|no Become a daemon\n"
" --help Show this information and exit\n"
"\n"
"NetworkManagerInfo responds to NetworkManager requests for allowed access points\n"
"and WEP keys.\n"
"\n");
}
/* /*
* main * main
* *

View File

@@ -43,12 +43,6 @@
int nmi_networks_dialog_init (NMIAppInfo *info) int nmi_networks_dialog_init (NMIAppInfo *info)
{ {
GtkWidget *dialog; GtkWidget *dialog;
GtkWidget *list_view;
GtkButton *save_button;
GtkButton *cancel_button;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GError *error = NULL;
info->networks_dialog = glade_xml_new(GLADEDIR"/networks.glade", NULL, NULL); info->networks_dialog = glade_xml_new(GLADEDIR"/networks.glade", NULL, NULL);
if (!info->networks_dialog) if (!info->networks_dialog)

View File

@@ -159,7 +159,7 @@ int main( int argc, char *argv[] )
/* If NM doesn't get a connection within a reasonable amount of time, /* If NM doesn't get a connection within a reasonable amount of time,
* exit to let bootup continue. * exit to let bootup continue.
*/ */
timeout = g_timeout_add (10000, g_main_loop_quit, loop); timeout = g_timeout_add (10000, (GSourceFunc) g_main_loop_quit, loop);
g_main_loop_run (loop); g_main_loop_run (loop);

View File

@@ -107,9 +107,6 @@ static GType nmwa_get_type (void)
*/ */
static void nmwa_redraw (NMWirelessApplet *applet) static void nmwa_redraw (NMWirelessApplet *applet)
{ {
const char *label_text;
char *tmp;
if (applet->pixmaps[applet->pix_state] != applet->current_pixbuf) if (applet->pixmaps[applet->pix_state] != applet->current_pixbuf)
{ {
applet->current_pixbuf = (GdkPixbuf *)applet->pixmaps[applet->pix_state]; applet->current_pixbuf = (GdkPixbuf *)applet->pixmaps[applet->pix_state];
@@ -337,7 +334,7 @@ static void nmwa_destroy (NMWirelessApplet *applet, gpointer user_data)
static void nmwa_get_menu_pos (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data) static void nmwa_get_menu_pos (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer data)
{ {
NMWirelessApplet *applet = data; NMWirelessApplet *applet = data;
GtkRequisition reqmenu, reqapplet; GtkRequisition reqmenu;
gint tempx, tempy, width, height; gint tempx, tempy, width, height;
gint screen_width, screen_height; gint screen_width, screen_height;
@@ -450,9 +447,6 @@ void nmwa_menu_item_activate (GtkMenuItem *item, gpointer user_data)
*/ */
static void nmwa_toplevel_menu_activate (GtkWidget *menu, NMWirelessApplet *applet) static void nmwa_toplevel_menu_activate (GtkWidget *menu, NMWirelessApplet *applet)
{ {
GtkWidget *submenu;
GtkWidget *menu_item;
nmwa_dispose_menu_items (applet); nmwa_dispose_menu_items (applet);
nmwa_populate_menu (applet); nmwa_populate_menu (applet);
gtk_widget_show (applet->menu); gtk_widget_show (applet->menu);
@@ -482,7 +476,6 @@ void nmwa_menu_add_separator_item (GtkWidget *menu)
void nmwa_menu_add_text_item (GtkWidget *menu, char *text) void nmwa_menu_add_text_item (GtkWidget *menu, char *text)
{ {
GtkWidget *menu_item; GtkWidget *menu_item;
GtkWidget *label;
g_return_if_fail (text != NULL); g_return_if_fail (text != NULL);
g_return_if_fail (menu != NULL); g_return_if_fail (menu != NULL);
@@ -727,12 +720,12 @@ GtkWidget * nmwa_populate_menu (NMWirelessApplet *applet)
{ {
GtkWidget *menu = applet->menu; GtkWidget *menu = applet->menu;
g_return_if_fail (applet != NULL); g_return_val_if_fail (applet != NULL, NULL);
if (applet->applet_state == APPLET_STATE_NO_NM) if (applet->applet_state == APPLET_STATE_NO_NM)
{ {
nmwa_menu_add_text_item (menu, _("NetworkManager is not running...")); nmwa_menu_add_text_item (menu, _("NetworkManager is not running..."));
return; return NULL;
} }
nmwa_menu_add_text_item (menu, _("Network Connections")); nmwa_menu_add_text_item (menu, _("Network Connections"));
@@ -772,8 +765,6 @@ GtkWidget * nmwa_populate_menu (NMWirelessApplet *applet)
*/ */
static void nmwa_setup_widgets (NMWirelessApplet *applet) static void nmwa_setup_widgets (NMWirelessApplet *applet)
{ {
GtkRequisition req;
gint total_size = 0;
gboolean horizontal = FALSE; gboolean horizontal = FALSE;
gint panel_size; gint panel_size;
GtkWidget *menu_bar; GtkWidget *menu_bar;

View File

@@ -20,7 +20,9 @@
*/ */
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <dbus/dbus.h> #include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
#include "NMWirelessAppletDbus.h" #include "NMWirelessAppletDbus.h"
#include "NMWirelessApplet.h" #include "NMWirelessApplet.h"
@@ -834,7 +836,7 @@ void nmwa_dbus_update_wireless_network_list (NMWirelessApplet *applet)
* them here. * them here.
*/ */
for (j = 0; j < i; j++) for (j = 0; j < i; j++)
if (found = (networks[j] && (strcmp (networks[i], networks[j]) == 0))) if ((found = (networks[j] && (strcmp (networks[i], networks[j]) == 0))))
break; break;
if (found) if (found)
continue; continue;
@@ -1210,4 +1212,6 @@ gpointer nmwa_dbus_worker (gpointer user_data)
g_main_loop_run (thread_loop); g_main_loop_run (thread_loop);
g_source_destroy (timeout_source); g_source_destroy (timeout_source);
return NULL;
} }

View File

@@ -48,7 +48,6 @@
static GMainLoop *loop = NULL; static GMainLoop *loop = NULL;
static NMData *nm_data = NULL; static NMData *nm_data = NULL;
gboolean debug = TRUE; gboolean debug = TRUE;
static gboolean quit = FALSE;
extern gboolean allowed_ap_worker_exit; extern gboolean allowed_ap_worker_exit;
static void nm_data_free (NMData *data); static void nm_data_free (NMData *data);
@@ -435,7 +434,7 @@ static void nm_data_free (NMData *data)
nm_device_unref (data->active_device); nm_device_unref (data->active_device);
g_slist_foreach (data->dev_list, nm_device_unref, NULL); g_slist_foreach (data->dev_list, (GFunc) nm_device_unref, NULL);
g_slist_free (data->dev_list); g_slist_free (data->dev_list);
g_mutex_free (data->dev_list_mutex); g_mutex_free (data->dev_list_mutex);

View File

@@ -808,7 +808,7 @@ static DBusHandlerResult nm_dbus_nmi_filter (DBusConnection *connection, DBusMes
if (!(object_path = dbus_message_get_path (message))) if (!(object_path = dbus_message_get_path (message)))
return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED); return (DBUS_HANDLER_RESULT_NOT_YET_HANDLED);
/* syslog (LOG_DEBUG, "nm_dbus_nmi_filter() got method %s for path %s", method, object_path); /**/ /* syslog (LOG_DEBUG, "nm_dbus_nmi_filter() got method %s for path %s", method, object_path); */
if ( (strcmp (object_path, NMI_DBUS_PATH) == 0) if ( (strcmp (object_path, NMI_DBUS_PATH) == 0)
&& dbus_message_is_signal (message, NMI_DBUS_INTERFACE, "TrustedNetworkUpdate")) && dbus_message_is_signal (message, NMI_DBUS_INTERFACE, "TrustedNetworkUpdate"))
@@ -1100,7 +1100,7 @@ static DBusHandlerResult nm_dbus_nm_message_handler (DBusConnection *connection,
method = dbus_message_get_member (message); method = dbus_message_get_member (message);
path = dbus_message_get_path (message); path = dbus_message_get_path (message);
/* syslog (LOG_DEBUG, "nm_dbus_nm_message_handler() got method %s for path %s", method, path); /**/ /* syslog (LOG_DEBUG, "nm_dbus_nm_message_handler() got method %s for path %s", method, path); */
if (strcmp ("getActiveDevice", method) == 0) if (strcmp ("getActiveDevice", method) == 0)
reply_message = nm_dbus_nm_get_active_device (connection, message, data); reply_message = nm_dbus_nm_get_active_device (connection, message, data);

View File

@@ -31,7 +31,7 @@
extern gboolean debug; extern gboolean debug;
/*#define LOCKING_DEBUG /**/ /*#define LOCKING_DEBUG */
/* /*
* nm_try_acquire_mutex * nm_try_acquire_mutex

View File

@@ -90,8 +90,8 @@ void nm_system_device_stop_dhcp (NMDevice *dev)
pid_t n_pid = -1; pid_t n_pid = -1;
memset (s_pid, 0, 20); memset (s_pid, 0, 20);
fgets (s_pid, 19, pidfile); fgets (s_pid, 20, pidfile);
len = strnlen (s_pid, 20); len = strlen (s_pid);
fclose (pidfile); fclose (pidfile);
n_pid = atoi (s_pid); n_pid = atoi (s_pid);

View File

@@ -40,7 +40,7 @@ char * get_active_device (DBusConnection *connection)
if (message == NULL) if (message == NULL)
{ {
fprintf (stderr, "Couldn't allocate the dbus message\n"); fprintf (stderr, "Couldn't allocate the dbus message\n");
return; return NULL;
} }
dbus_error_init (&error); dbus_error_init (&error);
@@ -49,14 +49,14 @@ char * get_active_device (DBusConnection *connection)
{ {
fprintf (stderr, "%s raised:\n %s\n\n", error.name, error.message); fprintf (stderr, "%s raised:\n %s\n\n", error.name, error.message);
dbus_message_unref (message); dbus_message_unref (message);
return; return NULL;
} }
if (reply == NULL) if (reply == NULL)
{ {
fprintf( stderr, "dbus reply message was NULL\n" ); fprintf( stderr, "dbus reply message was NULL\n" );
dbus_message_unref (message); dbus_message_unref (message);
return; return NULL;
} }
/* now analyze reply */ /* now analyze reply */
@@ -66,7 +66,7 @@ char * get_active_device (DBusConnection *connection)
if (!string) if (!string)
{ {
fprintf (stderr, "NetworkManager returned a NULL active device object path" ); fprintf (stderr, "NetworkManager returned a NULL active device object path" );
return; return NULL;
} }
fprintf (stderr, "Active device: '%s'\n", string ); fprintf (stderr, "Active device: '%s'\n", string );

View File

@@ -24,6 +24,8 @@
#include <dbus/dbus-glib-lowlevel.h> #include <dbus/dbus-glib-lowlevel.h>
#include <dbus/dbus-glib.h> #include <dbus/dbus-glib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define NMI_DBUS_NMI_OBJECT_PATH_PREFIX "/org/freedesktop/NetworkManagerInfo" #define NMI_DBUS_NMI_OBJECT_PATH_PREFIX "/org/freedesktop/NetworkManagerInfo"
#define NMI_DBUS_NMI_NAMESPACE "org.freedesktop.NetworkManagerInfo" #define NMI_DBUS_NMI_NAMESPACE "org.freedesktop.NetworkManagerInfo"
@@ -55,7 +57,7 @@ char * get_network_string_property (DBusConnection *connection, char *network, c
if (message == NULL) if (message == NULL)
{ {
fprintf (stderr, "Couldn't allocate the dbus message\n"); fprintf (stderr, "Couldn't allocate the dbus message\n");
return; return NULL;
} }
dbus_message_append_args (message, DBUS_TYPE_STRING, network, DBUS_TYPE_INT32, type, DBUS_TYPE_INVALID); dbus_message_append_args (message, DBUS_TYPE_STRING, network, DBUS_TYPE_INT32, type, DBUS_TYPE_INVALID);
@@ -65,14 +67,14 @@ char * get_network_string_property (DBusConnection *connection, char *network, c
{ {
fprintf (stderr, "%s raised:\n %s\n\n", error.name, error.message); fprintf (stderr, "%s raised:\n %s\n\n", error.name, error.message);
dbus_message_unref (message); dbus_message_unref (message);
return; return NULL;
} }
if (reply == NULL) if (reply == NULL)
{ {
fprintf( stderr, "dbus reply message was NULL\n" ); fprintf( stderr, "dbus reply message was NULL\n" );
dbus_message_unref (message); dbus_message_unref (message);
return; return NULL;
} }
/* now analyze reply */ /* now analyze reply */
@@ -82,7 +84,7 @@ char * get_network_string_property (DBusConnection *connection, char *network, c
if (!string) if (!string)
{ {
fprintf (stderr, "NetworkManagerInfo returned a NULL string for method '%s'", method ); fprintf (stderr, "NetworkManagerInfo returned a NULL string for method '%s'", method );
return; return NULL;
} }
ret_string = g_strdup (string); ret_string = g_strdup (string);
dbus_free (string); dbus_free (string);