[netspeed] Fix compiler warnings



commit d4f00e8e74ca53490cfa9d4265c1c821d3119f8a
Author: Jörgen Scheibengruber <mfcn gmx de>
Date:   Sat Jun 5 17:07:46 2010 +0300

    Fix compiler warnings

 src/backend.c  |    8 ++++++--
 src/netspeed.c |   14 ++++++++------
 2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/src/backend.c b/src/backend.c
index 1f52f13..aa9b1bb 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -96,8 +96,12 @@ get_default_route(void)
 		char buffer[1024]; 
 		unsigned int ip, gw, flags, ref, use, metric, mask, mtu, window, irtt;
 		int retval;
+		char *rv;
 		
-		fgets(buffer, 1024, fp);
+		rv = fgets(buffer, 1024, fp);
+		if (!rv) {
+			break;
+		}
 		
 		retval = sscanf(buffer, "%49s %x %x %x %d %d %d %x %d %d %d",
 				device, &ip, &gw, &flags, &ref, &use, &metric, &mask, &mtu, &window, &irtt);
@@ -107,7 +111,7 @@ get_default_route(void)
 		if (ip == 0 && !is_dummy_device(device)) {
 			fclose(fp);
 			return device;
-		}			
+		}
 	}
 	fclose(fp);	
 	return NULL;
diff --git a/src/netspeed.c b/src/netspeed.c
index 62e1061..46c01c3 100644
--- a/src/netspeed.c
+++ b/src/netspeed.c
@@ -1360,26 +1360,26 @@ applet_button_press(GtkWidget *widget, GdkEventButton *event, NetspeedApplet *ap
 		
 		if (applet->up_cmd && applet->down_cmd)
 		{
-			char *question;
+			const char *question;
 			int response;
 			
 			if (applet->devinfo.up) 
 			{
-				question = g_strdup_printf(_("Do you want to disconnect %s now?"), applet->devinfo.name); 
+				question = _("Do you want to disconnect %s now?");
 			} 
 			else
 			{
-				question = g_strdup_printf(_("Do you want to connect %s now?"), applet->devinfo.name);
+				question = _("Do you want to connect %s now?");
 			}
 			
 			applet->connect_dialog = gtk_message_dialog_new(NULL, 
 					GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
 					GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
-					question);
+					question,
+					applet->devinfo.name);
 			response = gtk_dialog_run(GTK_DIALOG(applet->connect_dialog));
 			gtk_widget_destroy (applet->connect_dialog);
 			applet->connect_dialog = NULL;
-			g_free(question);
 			
 			if (response == GTK_RESPONSE_YES)
 			{
@@ -1392,9 +1392,11 @@ applet_button_press(GtkWidget *widget, GdkEventButton *event, NetspeedApplet *ap
 
 				if (!g_spawn_command_line_async(command, &error))
 				{
-					dialog = gtk_message_dialog_new(NULL, 
+					dialog = gtk_message_dialog_new_with_markup(NULL, 
 							GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
 							GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
+							_("<b>Running command %s failed</b>\n%s"),
+							command,
 							error->message);
 					gtk_dialog_run (GTK_DIALOG (dialog));
 					gtk_widget_destroy (dialog);



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