[Galago-commits] r2391 - in trunk/libnotify-ng: . libnotify tests

galago-commits at freedesktop.org galago-commits at freedesktop.org
Mon Jan 9 10:16:51 PST 2006


Author: chipx86
Date: 2006-01-09 10:16:48 -0800 (Mon, 09 Jan 2006)
New Revision: 2391

Modified:
   trunk/libnotify-ng/ChangeLog
   trunk/libnotify-ng/libnotify/Makefile.in
   trunk/libnotify-ng/libnotify/notify.c
   trunk/libnotify-ng/libnotify/notifynotification.c
   trunk/libnotify-ng/tests/test-default-action.c
   trunk/libnotify-ng/tests/test-image.c
   trunk/libnotify-ng/tests/test-multi-actions.c
   trunk/libnotify-ng/tests/test-replace-widget.c
   trunk/libnotify-ng/tests/test-xy-stress.c
Log:
Clean up lots of warnings.


Modified: trunk/libnotify-ng/ChangeLog
===================================================================
--- trunk/libnotify-ng/ChangeLog	2006-01-03 23:51:03 UTC (rev 2390)
+++ trunk/libnotify-ng/ChangeLog	2006-01-09 18:16:48 UTC (rev 2391)
@@ -1,3 +1,17 @@
+Mon Jan 09 10:15:57 PST 2006  Christian Hammond <chipx86 at chipx86.com>
+
+	* libnotify/Makefile.in:
+	* libnotify/notify.c:
+	* libnotify/notifynotification.c:
+	* tests/test-default-action.c:
+	* tests/test-image.c:
+	* tests/test-multi-actions.c:
+	* tests/test-replace-widget.c:
+	* tests/test-xy-stress.c:
+	  - Clean up lots of warnings.
+
+========================= 0.3.0 =========================
+
 Tue Dec 13 2005  John (J5) Palmieri <johnp at redhat.com>
 	
 	* Release 0.3.0 

Modified: trunk/libnotify-ng/libnotify/Makefile.in
===================================================================
--- trunk/libnotify-ng/libnotify/Makefile.in	2006-01-03 23:51:03 UTC (rev 2390)
+++ trunk/libnotify-ng/libnotify/Makefile.in	2006-01-09 18:16:48 UTC (rev 2391)
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
+# Makefile.in generated by automake 1.9.5 from Makefile.am.
 # @configure_input@
 
 # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -15,6 +15,8 @@
 @SET_MAKE@
 
 
+SOURCES = $(libnotify_la_SOURCES)
+
 srcdir = @srcdir@
 top_srcdir = @top_srcdir@
 VPATH = @srcdir@

Modified: trunk/libnotify-ng/libnotify/notify.c
===================================================================
--- trunk/libnotify-ng/libnotify/notify.c	2006-01-03 23:51:03 UTC (rev 2390)
+++ trunk/libnotify-ng/libnotify/notify.c	2006-01-09 18:16:48 UTC (rev 2391)
@@ -46,6 +46,7 @@
 #  define format_func
 #endif
 
+#if 0
 static void format_func
 print_error (char *message, ...)
 {
@@ -59,6 +60,7 @@
   fprintf (stderr, "%s(%d): libnotify: %s",
 	   (getenv ("_") ? getenv ("_") : ""), getpid (), buf);
 }
+#endif
 
 gboolean
 notify_init (const char *app_name)

Modified: trunk/libnotify-ng/libnotify/notifynotification.c
===================================================================
--- trunk/libnotify-ng/libnotify/notifynotification.c	2006-01-03 23:51:03 UTC (rev 2390)
+++ trunk/libnotify-ng/libnotify/notifynotification.c	2006-01-09 18:16:48 UTC (rev 2391)
@@ -474,11 +474,9 @@
   NotifyNotificationPrivate *priv;
   GError *tmp_error;
   gchar **action_array;
-  int i;
 
   g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-
   priv = notification->priv;
 
   tmp_error = NULL;

Modified: trunk/libnotify-ng/tests/test-default-action.c
===================================================================
--- trunk/libnotify-ng/tests/test-default-action.c	2006-01-03 23:51:03 UTC (rev 2390)
+++ trunk/libnotify-ng/tests/test-default-action.c	2006-01-09 18:16:48 UTC (rev 2391)
@@ -26,7 +26,7 @@
 #include <assert.h>
 #include <string.h>
 
-#define DBUS_API_SUBJECT_TO_CHANGE 1
+#define DBUS_API_SUBJECT_TO_CHANGE
 
 #include <glib.h>
 #include <dbus/dbus.h>
@@ -59,7 +59,8 @@
 
         n = notify_notification_new ("Matt is online", "", NULL, NULL);
         notify_notification_set_timeout (n, NOTIFY_TIMEOUT_NEVER);
-        notify_notification_add_action (n, "default", "Do Default Action", callback); 
+        notify_notification_add_action (n, "default", "Do Default Action",
+										(NotifyActionCallback)callback);
 	notify_notification_set_category (n, "presence.online");
 
 	if (!notify_notification_show (n, NULL)) {

Modified: trunk/libnotify-ng/tests/test-image.c
===================================================================
--- trunk/libnotify-ng/tests/test-image.c	2006-01-03 23:51:03 UTC (rev 2390)
+++ trunk/libnotify-ng/tests/test-image.c	2006-01-09 18:16:48 UTC (rev 2391)
@@ -1,12 +1,12 @@
 /*
  * @file tests/test-image.c Unit test: images
  *
- * @Copyright (C) 2004 Mike Hearn <mike at navi.cx>
+ * @Copyright(C) 2004 Mike Hearn <mike at navi.cx>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or(at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -31,7 +31,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 
-#define DBUS_API_SUBJECT_TO_CHANGE 1
+#define DBUS_API_SUBJECT_TO_CHANGE
 
 #include <glib.h>
 #include <gtk/gtk.h>
@@ -42,72 +42,78 @@
 GMainLoop *loop;
 NotifyNotification *n;
 
-int main(int argc, char *argv[]) {
+int
+main(int argc, char *argv[])
+{
 	char file[PATH_MAX];
 	int size;
-        char *uri;
+	char *uri;
 	GdkPixbuf *icon;
-	gchar *buf;
-	gsize buf_size;
 	GtkWidget *helper;
 
-	gtk_init (&argc, &argv);
+	gtk_init(&argc, &argv);
 
-	if (!notify_init("Images Test")) exit(1);
+	if (!notify_init("Images Test"))
+		exit(1);
 
-	n = notify_notification_new ("Icon Test", "Testing stock icon", "stock_help", NULL);
+	n = notify_notification_new("Icon Test", "Testing stock icon",
+								"stock_help", NULL);
 
-        notify_notification_set_hint_int32 (n, "x", 300);
-        notify_notification_set_hint_int32 (n, "y", 24);
+	notify_notification_set_hint_int32(n, "x", 300);
+	notify_notification_set_hint_int32(n, "y", 24);
+	notify_notification_set_timeout(n, NOTIFY_TIMEOUT_NEVER);
 
-        notify_notification_set_timeout (n, NOTIFY_TIMEOUT_NEVER);
-	if (!notify_notification_show (n, NULL)) {
+	if (!notify_notification_show(n, NULL))
+	{
 		fprintf(stderr, "failed to send notification\n");
 		return 1;
 	}
 
-	g_usleep (5000000); //5 seconds
+	g_usleep(5000000); // 5 seconds
 
 	size = readlink("/proc/self/cwd", file, PATH_MAX - 1);
 	file[size] = '\0';
-        uri = g_strdup_printf ("file://%s/%s", file, "applet-critical.png");
+	uri = g_strdup_printf("file://%s/%s", file, "applet-critical.png");
 
 	printf("sending %s\n", uri);
 
-	notify_notification_update (n, "Alert!", "Testing URI icons", uri);
+	notify_notification_update(n, "Alert!", "Testing URI icons", uri);
 
-	if (!notify_notification_show (n, NULL)) {
+	if (!notify_notification_show(n, NULL))
+	{
 		fprintf(stderr, "failed to send notification\n");
 		return 1;
 	}
 
-	g_usleep (5000000); //5 seconds
+	g_usleep(5000000); // 5 seconds
 
-	notify_notification_update (n, "Raw image test", "Testing sending raw pixbufs", NULL);
+	notify_notification_update(n, "Raw image test",
+							   "Testing sending raw pixbufs", NULL);
 
-	/* This is just a hack to get a stock icon's pixbuf
-	   in a realworld app if you were sending bitmapped data
-	   you would know the file location and open it up with
-	   a method that could generate a bmp for you*/
+	/*
+	 * This is just a hack to get a stock icon's pixbuf in a realworld app
+	 * if you were sending bitmapped data you would know the file location
+	 * and open it up with a method that could generate a bmp for you
+	 */
 	helper = gtk_button_new();
-	icon = gtk_widget_render_icon (helper,
+	icon = gtk_widget_render_icon(helper,
 	                              GTK_STOCK_DIALOG_QUESTION,
 	                              GTK_ICON_SIZE_DIALOG,
 	                              "");
 
+	notify_notification_set_icon_data_from_pixbuf(n, icon);
 
-	notify_notification_set_icon_data_from_pixbuf (n, 
-	                                               icon);
-
-	if (!notify_notification_show (n, NULL)) {
+	if (!notify_notification_show(n, NULL))
+	{
 		fprintf(stderr, "failed to send notification\n");
 		return 1;
 	}
 
 
-	gtk_widget_destroy (helper);
-	g_object_unref ((GObject *)icon);
+	gtk_widget_destroy(helper);
+	g_object_unref(G_OBJECT(icon));
 
-	g_usleep (5000000); //5 seconds
+	g_usleep(5000000); // 5 seconds
+
 	return 0;
 }

Modified: trunk/libnotify-ng/tests/test-multi-actions.c
===================================================================
--- trunk/libnotify-ng/tests/test-multi-actions.c	2006-01-03 23:51:03 UTC (rev 2390)
+++ trunk/libnotify-ng/tests/test-multi-actions.c	2006-01-09 18:16:48 UTC (rev 2391)
@@ -1,12 +1,12 @@
 /*
  * @file tests/test-multi-actions.c Unit test: multiple actions
  *
- * @Copyright (C) 2004 Mike Hearn <mike at navi.cx>
+ * @Copyright(C) 2004 Mike Hearn <mike at navi.cx>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or(at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -23,22 +23,22 @@
 #include <stdio.h>
 #include <unistd.h>
 #include <stdlib.h>
-#include <assert.h>
 #include <string.h>
 
-#define DBUS_API_SUBJECT_TO_CHANGE 1
+#define DBUS_API_SUBJECT_TO_CHANGE
 
 #include <glib.h>
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-lowlevel.h>
 
-GMainLoop *loop;
+static GMainLoop *loop;
 
-static void help_callback(NotifyNotification *n, const char *action)
+static void
+help_callback(NotifyNotification *n, const char *action)
 {
-	assert( action != NULL ); 
-	assert( strcmp (action, "help") == 0 );
+	g_assert(action != NULL);
+	g_assert(strcmp(action, "help") == 0);
 
 	printf("You clicked Help\n");
 
@@ -47,10 +47,11 @@
 	g_main_loop_quit(loop);
 }
 
-static void ignore_callback(NotifyNotification *n, const char *action)
+static void
+ignore_callback(NotifyNotification *n, const char *action)
 {
-	assert( action != NULL ); 
-	assert( strcmp (action, "ignore") == 0 );
+	g_assert(action != NULL);
+	g_assert(strcmp(action, "ignore") == 0);
 
 	printf("You clicked Ignore\n");
 
@@ -59,11 +60,11 @@
 	g_main_loop_quit(loop);
 }
 
-
-static void empty_callback(NotifyNotification *n, const char *action)
+static void
+empty_callback(NotifyNotification *n, const char *action)
 {
-	assert( action != NULL ); 
-	assert( strcmp (action, "empty") == 0 );
+	g_assert(action != NULL);
+	g_assert(strcmp(action, "empty") == 0);
 
 	printf("You clicked Empty Trash\n");
 
@@ -73,27 +74,35 @@
 }
 
 
-int main() {
-        NotifyNotification *n;
+int
+main(int argc, char **argv)
+{
+	NotifyNotification *n;
+	DBusConnection *conn;
 
-	if (!notify_init("Multi Action Test")) exit(1);
+	if (!notify_init("Multi Action Test"))
+		exit(1);
 
-	DBusConnection *conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+	conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
 	loop = g_main_loop_new(NULL, FALSE);
 
 	dbus_connection_setup_with_g_main(conn, NULL);
 
-        n = notify_notification_new ("Low disk space", 
-                                     "You can free up some disk space by "
-                                     "emptying the trash can.",
-                                     NULL, NULL);
-        notify_notification_set_timeout (n, NOTIFY_TIMEOUT_NEVER);
-        notify_notification_add_action (n, "help", "Help", help_callback);
-        notify_notification_add_action (n, "ignore", "Ignore", ignore_callback);
-        notify_notification_add_action (n, "empty", "Empty Trash", empty_callback);
-	notify_notification_set_category (n, "device");
+	n = notify_notification_new("Low disk space",
+								"You can free up some disk space by "
+								"emptying the trash can.",
+								NULL, NULL);
+	notify_notification_set_timeout(n, NOTIFY_TIMEOUT_NEVER);
+	notify_notification_add_action(n, "help", "Help",
+								   (NotifyActionCallback)help_callback);
+	notify_notification_add_action(n, "ignore", "Ignore",
+								   (NotifyActionCallback)ignore_callback);
+	notify_notification_add_action(n, "empty", "Empty Trash",
+								   (NotifyActionCallback)empty_callback);
+	notify_notification_set_category(n, "device");
 
-	if (!notify_notification_show (n, NULL)) {
+	if (!notify_notification_show(n, NULL))
+	{
 		fprintf(stderr, "failed to send notification\n");
 		return 1;
 	}

Modified: trunk/libnotify-ng/tests/test-replace-widget.c
===================================================================
--- trunk/libnotify-ng/tests/test-replace-widget.c	2006-01-03 23:51:03 UTC (rev 2390)
+++ trunk/libnotify-ng/tests/test-replace-widget.c	2006-01-09 18:16:48 UTC (rev 2391)
@@ -4,59 +4,61 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 
-
 static int count = 0;
 
-void on_exposed (GtkWidget *widget, GdkEventExpose *ev, void *user_data) {
-    NotifyNotification *n = NOTIFY_NOTIFICATION (user_data);
+static void
+on_exposed(GtkWidget *widget, GdkEventExpose *ev, void *user_data)
+{
+	NotifyNotification *n = NOTIFY_NOTIFICATION(user_data);
 
-    g_signal_handlers_disconnect_by_func(widget, on_exposed, user_data);
+	g_signal_handlers_disconnect_by_func(widget, on_exposed, user_data);
 
-    notify_notification_show (n, NULL);
+	notify_notification_show(n, NULL);
 }
- 
-void on_clicked (GtkButton *button, void *user_data) {
-    GError *error;
-    gchar *buf;
-    NotifyNotification *n = NOTIFY_NOTIFICATION (user_data);
 
-    count++;
-    buf = g_strdup_printf ("You clicked the button %i times", count);
+static void
+on_clicked(GtkButton *button, void *user_data)
+{
+	gchar *buf;
+	NotifyNotification *n = NOTIFY_NOTIFICATION(user_data);
 
-    notify_notification_update (n, "Widget Attachment Test", 
-                                buf, NULL);
+	count++;
+	buf = g_strdup_printf("You clicked the button %i times", count);
+	notify_notification_update(n, "Widget Attachment Test", buf, NULL);
+	g_free(buf);
 
-    notify_notification_show (n, NULL);
-    g_free (buf);
+	notify_notification_show(n, NULL);
 }
 
-int main(int argc, char *argv[]) {
-    NotifyNotification *n;
-    GtkWidget *window;
-    GtkWidget *button;
+int
+main(int argc, char *argv[])
+{
+	NotifyNotification *n;
+	GtkWidget *window;
+	GtkWidget *button;
 
-    GError *error;
-    error = NULL;
+	gtk_init(&argc, &argv);
+	notify_init("Replace Test");
 
-    gtk_init (&argc, &argv);
-    notify_init("Replace Test");
-   
-    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-    button = gtk_button_new_with_label ("click here to change notification");
-    gtk_container_add (GTK_CONTAINER(window), button);
+	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+	button = gtk_button_new_with_label("click here to change notification");
+	gtk_container_add(GTK_CONTAINER(window), button);
 
-    gtk_widget_show_all (window);  
+	gtk_widget_show_all(window);
 
+	n = notify_notification_new("Widget Attachment Test",
+								"Button has not been clicked yet",
+								NULL,  //no icon
+								button); //attach to button
 
-    n = notify_notification_new ("Widget Attachment Test", "Button has not been clicked yet", 
-                                  NULL,  //no icon
-                                  button); //attach to button
+	notify_notification_set_timeout(n, 0); //don't timeout
 
-   
-    notify_notification_set_timeout (n, 0); //don't timeout
-    
-    g_signal_connect (button, "clicked", (GCallback *)on_clicked, n);
-    g_signal_connect_after (button, "expose-event", (GCallback *)on_exposed, n);
+	g_signal_connect(G_OBJECT(button), "clicked",
+					 G_CALLBACK(on_clicked), n);
+	g_signal_connect_after(G_OBJECT(button), "expose-event",
+						   G_CALLBACK(on_exposed), n);
 
-    gtk_main();
+	gtk_main();
+
+	return 0;
 }

Modified: trunk/libnotify-ng/tests/test-xy-stress.c
===================================================================
--- trunk/libnotify-ng/tests/test-xy-stress.c	2006-01-03 23:51:03 UTC (rev 2390)
+++ trunk/libnotify-ng/tests/test-xy-stress.c	2006-01-09 18:16:48 UTC (rev 2391)
@@ -1,12 +1,12 @@
 /*
  * @file tests/test-xy.c Unit test: X, Y hints
  *
- * @Copyright (C) 2005 Christian Hammond <chipx86 at chipx86.com>
+ * @Copyright(C) 2005 Christian Hammond <chipx86 at chipx86.com>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * version 2.1 of the License, or(at your option) any later version.
  *
  * This library is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,40 +26,39 @@
 
 #include <dbus/dbus.h>
 #include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
 
 static void
-_handle_closed (GObject *o)
+_handle_closed(GObject *obj)
 {
-  g_message ("closing");
-  g_object_unref (o);
+	g_message("closing");
+	g_object_unref(obj);
 }
 
 static void
 emit_notification(int x, int y)
 {
-	static char buffer[BUFSIZ];
+	char *buffer;
 	NotifyNotification *n;
 
-	g_snprintf(buffer, sizeof(buffer),
-			   "This notification should point to %d, %d.", x, y);
+	buffer = g_strdup_printf("This notification should point to %d, %d.",
+							 x, y);
 
-	n = notify_notification_new ("X, Y Test", 
-                                     buffer,
-                                     NULL, NULL);
+	n = notify_notification_new("X, Y Test", buffer, NULL, NULL);
+	g_free(buffer);
 
-	notify_notification_set_hint_int32 (n, "x", x);
-	notify_notification_set_hint_int32 (n, "y", y);	
+	notify_notification_set_hint_int32(n, "x", x);
+	notify_notification_set_hint_int32(n, "y", y);
 
-	g_signal_connect (n, "closed", _handle_closed, NULL);
+	g_signal_connect(G_OBJECT(n), "closed",
+					 G_CALLBACK(_handle_closed), NULL);
 
-	if (!notify_notification_show (n, NULL)) {
+	if (!notify_notification_show(n, NULL))
 		fprintf(stderr, "failed to send notification\n");
-		return 1;
-	}
 }
 
 static gboolean
-_popup_random_bubble (void)
+_popup_random_bubble(gpointer unused)
 {
 	GdkDisplay *display;
 	GdkScreen *screen;
@@ -72,8 +71,8 @@
 	screen_x2 = gdk_screen_get_width(screen)  - 1;
 	screen_y2 = gdk_screen_get_height(screen) - 1;
 
-	x = g_random_int_range (0, screen_x2);
-	y = g_random_int_range (0, screen_y2);
+	x = g_random_int_range(0, screen_x2);
+	y = g_random_int_range(0, screen_y2);
 	emit_notification(x, y);
 
 	return TRUE;
@@ -82,19 +81,20 @@
 int
 main(int argc, char **argv)
 {
-        GMainLoop *loop;
-        DBusConnection *conn;
- 
+	GMainLoop *loop;
+	DBusConnection *conn;
+
 	gdk_init(&argc, &argv);
 
 	notify_init("XY");
 
-        conn = dbus_bus_get (DBUS_BUS_SESSION, NULL);
+	conn = dbus_bus_get(DBUS_BUS_SESSION, NULL);
+	dbus_connection_setup_with_g_main(conn, NULL);
 
-        dbus_connection_setup_with_g_main (conn, NULL);
+	g_timeout_add(1000, _popup_random_bubble, NULL);
 
-        g_timeout_add (1000, _popup_random_bubble, NULL);
+	loop = g_main_loop_new(NULL, FALSE);
+	g_main_loop_run(loop);
 
-        loop = g_main_loop_new (NULL, FALSE);
-        g_main_loop_run (loop);
+	return 0;
 }



More information about the galago-commits mailing list