Fixed the coding style.

This commit is contained in:
Christian Hammond 2006-01-20 05:55:30 +00:00
parent 3b0e8d2986
commit fd53ececa2
7 changed files with 740 additions and 778 deletions

View File

@ -1,3 +1,13 @@
Thu Jan 19 21:55:08 PST 2006 Christian Hammond <chipx86@chipx86.com>
* libnotify/dbus-compat.h:
* libnotify/notify.c:
* libnotify/notifycommon.h:
* libnotify/notify.h:
* libnotify/notifynotification.c:
* libnotify/notifynotification.h:
- Fixed the coding style.
Thu Jan 19 01:34:57 PST 2006 Christian Hammond <chipx86@chipx86.com>
* tools/notify-send.c:

View File

@ -1,3 +1,4 @@
/**
* @file libnotify/dbus-compat.h Private D-BUS Compatibility API
*

View File

@ -1,9 +1,8 @@
/* -*- mode: c-mode; tab-width: 4; indent-tabs-mode: t; -*- */
/**
* @file libnotify/notify.c Notifications library
*
* @Copyright (C) 2004 Christian Hammond <chipx86@chipx86.com>
* @Copyright (C) 2004 Mike Hearn <mike@navi.cx>
* @Copyright (C) 2004-2006 Christian Hammond <chipx86@chipx86.com>
* @Copyright (C) 2004-2006 Mike Hearn <mike@navi.cx>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -50,65 +49,65 @@ static DBusGProxy *_proxy = NULL;
#if 0
static void format_func
print_error (char *message, ...)
print_error(char *message, ...)
{
char buf[1024];
va_list args;
char buf[1024];
va_list args;
va_start (args, message);
vsnprintf (buf, sizeof (buf), message, args);
va_end (args);
va_start(args, message);
vsnprintf(buf, sizeof(buf), message, args);
va_end(args);
fprintf (stderr, "%s(%d): libnotify: %s",
(getenv ("_") ? getenv ("_") : ""), getpid (), buf);
fprintf(stderr, "%s(%d): libnotify: %s",
(getenv("_") ? getenv("_") : ""), getpid(), buf);
}
#endif
gboolean
notify_init (const char *app_name)
notify_init(const char *app_name)
{
g_return_val_if_fail (app_name != NULL, FALSE);
g_return_val_if_fail (*app_name != '\0', FALSE);
g_return_val_if_fail(app_name != NULL, FALSE);
g_return_val_if_fail(*app_name != '\0', FALSE);
if (_initted)
return TRUE;
if (_initted)
return TRUE;
_app_name = g_strdup (app_name);
_app_name = g_strdup(app_name);
g_type_init ();
g_type_init();
#ifdef HAVE_ATEXIT
atexit (notify_uninit);
atexit(notify_uninit);
#endif /* HAVE_ATEXIT */
_initted = TRUE;
_initted = TRUE;
return TRUE;
return TRUE;
}
const gchar *
notify_get_app_name (void)
notify_get_app_name(void)
{
return _app_name;
return _app_name;
}
void
notify_uninit (void)
notify_uninit(void)
{
if (_app_name != NULL)
{
g_free (_app_name);
_app_name = NULL;
}
if (_app_name != NULL)
{
g_free(_app_name);
_app_name = NULL;
}
/* TODO: keep track of all notifications and destroy them here? */
/* TODO: keep track of all notifications and destroy them here? */
}
gboolean
notify_is_initted (void)
notify_is_initted(void)
{
return _initted;
return _initted;
}
static DBusGProxy *

View File

@ -1,8 +1,7 @@
/* -*- mode: c-mode; tab-width: 4; indent-tabs-mode: t; -*- */
/**
* @file libnotify/notify.h Notifications library
*
* @Copyright (C) 2004 Christian Hammond
* @Copyright (C) 2004-2006 Christian Hammond
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@ -19,7 +18,6 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef _LIBNOTIFY_NOTIFY_H_
#define _LIBNOTIFY_NOTIFY_H_
@ -58,6 +56,11 @@ void notify_uninit(void);
*/
gboolean notify_is_initted(void);
/**
* Returns the name of the application set when notify_init() was called.
*
* @return The name of the application.
*/
const gchar *notify_get_app_name(void);
/**
@ -79,8 +82,10 @@ GList *notify_get_server_caps(void);
*
* @return TRUE if the call succeeded, or FALSE if there were errors.
*/
gboolean notify_get_server_info(char **ret_name, char **ret_vendor,
char **ret_version, char **ret_spec_version);
gboolean notify_get_server_info(char **ret_name,
char **ret_vendor,
char **ret_version,
char **ret_spec_version);
/*@}*/

View File

@ -3,7 +3,7 @@
#include <glib.h>
#define NOTIFY_TIMEOUT_DEFAULT -1
#define NOTIFY_TIMEOUT_NEVER 0
#define NOTIFY_TIMEOUT_NEVER 0
#define NOTIFY_DBUS_NAME "org.freedesktop.Notifications"
#define NOTIFY_DBUS_CORE_INTERFACE "org.freedesktop.Notifications"
@ -14,8 +14,8 @@
*/
typedef enum
{
NOTIFY_URGENCY_LOW, /**< Low urgency. */
NOTIFY_URGENCY_NORMAL, /**< Normal urgency. */
NOTIFY_URGENCY_LOW, /**< Low urgency. */
NOTIFY_URGENCY_NORMAL, /**< Normal urgency. */
NOTIFY_URGENCY_CRITICAL, /**< Critical urgency. */
} NotifyUrgency;

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +1,26 @@
/*
* This program is free software; you can redistribute it and/or
/**
* @file libnotify/notifynotification.h Notification object
*
* @Copyright (C) 2006 Christian Hammond
* @Copyright (C) 2006 John Palmieri
*
* 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.
*
* This program is distributed in the hope that it will be useful,
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with main.c; if not, write to:
* The Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef NOTIFY_NOTIFICATION_H
#define NOTIFY_NOTIFICATION_H
#ifndef _NOTIFY_NOTIFICATION_H_
#define _NOTIFY_NOTIFICATION_H_
#include <glib.h>
#include <glib-object.h>
@ -27,100 +30,111 @@
G_BEGIN_DECLS
#define NOTIFY_TYPE_NOTIFICATION (notify_notification_get_type ())
#define NOTIFY_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), NOTIFY_TYPE_NOTIFICATION, NotifyNotification))
#define NOTIFY_NOTIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), NOTIFY_TYPE_NOTIFICATION, NotifyNotificationClass))
#define NOTIFY_IS_NOTIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), NOTIFY_TYPE_NOTIFICATION))
#define NOTIFY_IS_NOTIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), NOTIFY_TYPE_NOTIFICATION))
#define NOTIFY_NOTIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), NOTIFY_TYPE_NOTIFICATION, NotifyNotificationClass))
#define NOTIFY_TYPE_NOTIFICATION (notify_notification_get_type ())
#define NOTIFY_NOTIFICATION(o) \
(G_TYPE_CHECK_INSTANCE_CAST ((o), NOTIFY_TYPE_NOTIFICATION, \
NotifyNotification))
#define NOTIFY_NOTIFICATION_CLASS(k) \
(G_TYPE_CHECK_CLASS_CAST((k), NOTIFY_TYPE_NOTIFICATION, \
NotifyNotificationClass))
#define NOTIFY_IS_NOTIFICATION(o) \
(G_TYPE_CHECK_INSTANCE_TYPE ((o), NOTIFY_TYPE_NOTIFICATION))
#define NOTIFY_IS_NOTIFICATION_CLASS(k) \
(G_TYPE_CHECK_CLASS_TYPE ((k), NOTIFY_TYPE_NOTIFICATION))
#define NOTIFY_NOTIFICATION_GET_CLASS(o) \
(G_TYPE_INSTANCE_GET_CLASS ((o), NOTIFY_TYPE_NOTIFICATION, \
NotifyNotificationClass))
typedef struct NotifyNotificationPrivate NotifyNotificationPrivate;
typedef struct _NotifyNotification NotifyNotification;
typedef struct _NotifyNotificationClass NotifyNotificationClass;
typedef struct _NotifyNotificationPrivate NotifyNotificationPrivate;
typedef struct {
struct _NotifyNotification
{
GObject parent;
NotifyNotificationPrivate *priv;
} NotifyNotification;
};
typedef struct {
struct _NotifyNotificationClass
{
GObjectClass parent_class;
/* Add Signal Functions Here */
void (*closed) (void);
} NotifyNotificationClass;
typedef void (*NotifyActionCallback )(NotifyNotification *, gchar *);
/* Signals */
void (*closed)(NotifyNotification *notification);
};
typedef void (*NotifyActionCallback)(NotifyNotification *, gchar *);
GType notify_notification_get_type();
NotifyNotification *notify_notification_new (const gchar *summary,
const gchar *message,
const gchar *icon,
GtkWidget *attach);
gboolean notify_notification_update (NotifyNotification *notification,
const gchar *summary,
const gchar *message,
const gchar *icon);
NotifyNotification *notify_notification_new(const gchar *summary,
const gchar *message,
const gchar *icon,
GtkWidget *attach);
void notify_notification_attach_to_widget (NotifyNotification *notification,
GtkWidget *attach);
gboolean notify_notification_update(NotifyNotification *notification,
const gchar *summary,
const gchar *message,
const gchar *icon);
gboolean notify_notification_set_user_data (NotifyNotification *notification,
void *user_data,
GFreeFunc free_func);
void notify_notification_attach_to_widget(NotifyNotification* notification,
GtkWidget *attach);
gpointer notify_notification_get_user_data (NotifyNotification *notification);
gboolean notify_notification_set_user_data(NotifyNotification *notification,
void *user_data,
GFreeFunc free_func);
gboolean notify_notification_show (NotifyNotification *notification,
GError **error);
gpointer notify_notification_get_user_data(NotifyNotification *notification);
gboolean notify_notification_show_and_forget (NotifyNotification *notification,
GError **error);
gboolean notify_notification_show(NotifyNotification *notification,
GError **error);
void notify_notification_set_timeout (NotifyNotification *notification,
gint timeout);
gboolean notify_notification_show_and_forget(NotifyNotification *notification,
GError **error);
gboolean notify_notification_set_category (NotifyNotification *notification,
const char *category);
void notify_notification_set_timeout(NotifyNotification *notification,
gint timeout);
gboolean notify_notification_set_urgency (NotifyNotification *notification,
NotifyUrgency l);
gboolean notify_notification_set_category(NotifyNotification *notification,
const char *category);
gboolean notify_notification_set_icon_data_from_pixbuf (NotifyNotification *notification,
GdkPixbuf *icon);
gboolean notify_notification_set_urgency(NotifyNotification *notification,
NotifyUrgency l);
gboolean notify_notification_set_hint_int32 (NotifyNotification *notification,
const gchar *key,
gint value);
gboolean notify_notification_set_icon_data_from_pixbuf(
NotifyNotification *notification, GdkPixbuf *icon);
gboolean notify_notification_set_hint_double (NotifyNotification *notification,
const gchar *key,
gdouble value);
gboolean notify_notification_set_hint_string (NotifyNotification *notification,
const gchar *key,
const gchar *value);
gboolean notify_notification_set_hint_byte (NotifyNotification *notification,
const gchar *key,
guchar value);
gboolean notify_notification_set_hint_int32(NotifyNotification *notification,
const gchar *key, gint value);
gboolean notify_notification_set_hint_byte_array (
NotifyNotification *notification,
const gchar *key,
const guchar *value,
gsize len);
gboolean notify_notification_set_hint_double(NotifyNotification *notification,
const gchar *key,
gdouble value);
void notify_notification_clear_hints (NotifyNotification *notification);
gboolean notify_notification_set_hint_string(NotifyNotification *notification,
const gchar *key,
const gchar *value);
gboolean notify_notification_add_action (NotifyNotification *notification,
const char *action,
const char *label,
NotifyActionCallback callback);
gboolean notify_notification_set_hint_byte(NotifyNotification *notification,
const gchar *key,
guchar value);
gboolean notify_notification_set_hint_byte_array(
NotifyNotification *notification, const gchar *key,
const guchar *value, gsize len);
void notify_notification_clear_hints(NotifyNotification *notification);
gboolean notify_notification_add_action(NotifyNotification *notification,
const char *action,
const char *label,
NotifyActionCallback callback);
void notify_notification_clear_actions(NotifyNotification *notification);
gboolean notify_notification_close(NotifyNotification *notification,
GError **error);
NotifyNotification *notify_notification_ref(NotifyNotification *notification);
void notify_notification_unref(NotifyNotification *notification);
void notify_notification_clear_actions (NotifyNotification *notification);
gboolean notify_notification_close (NotifyNotification *notification,
GError **error);
NotifyNotification *notify_notification_ref (NotifyNotification *notification);
void notify_notification_unref (NotifyNotification *notification);
#endif /* NOTIFY_NOTIFICATION_H */