[Galago-commits] r2886 - in trunk/notification-daemon: . src
galago-commits at freedesktop.org
galago-commits at freedesktop.org
Sat Jul 29 19:20:58 PDT 2006
Author: chipx86
Date: 2006-07-29 19:20:30 -0700 (Sat, 29 Jul 2006)
New Revision: 2886
Modified:
trunk/notification-daemon/ChangeLog
trunk/notification-daemon/src/daemon.c
Log:
- Typedef the popup location type enum so that we can refer to it as a name, rather than assigning the values to a gchar.
- Fix a memory leak when retrieving the stack location pref string.
Modified: trunk/notification-daemon/ChangeLog
===================================================================
--- trunk/notification-daemon/ChangeLog 2006-07-29 22:36:32 UTC (rev 2885)
+++ trunk/notification-daemon/ChangeLog 2006-07-30 02:20:30 UTC (rev 2886)
@@ -1,3 +1,10 @@
+Sat Jul 29 19:19:34 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
+
+ * src/daemon.c:
+ - Typedef the popup location type enum so that we can refer to it as a
+ name, rather than assigning the values to a gchar.
+ - Fix a memory leak when retrieving the stack location pref string.
+
Sat Jul 29 15:35:44 PDT 2006 Christian Hammond <chipx86 at chipx86.com>
* data/notification-daemon.schemas.in:
Modified: trunk/notification-daemon/src/daemon.c
===================================================================
--- trunk/notification-daemon/src/daemon.c 2006-07-29 22:36:32 UTC (rev 2885)
+++ trunk/notification-daemon/src/daemon.c 2006-07-30 02:20:30 UTC (rev 2886)
@@ -48,20 +48,21 @@
#define IMAGE_SIZE 48
-enum {
+typedef enum {
+ POPUP_STACK_LOCATION_UNKNOWN = -1,
POPUP_STACK_LOCATION_TOP_LEFT,
POPUP_STACK_LOCATION_TOP_RIGHT,
POPUP_STACK_LOCATION_BOTTOM_LEFT,
- POPUP_STACK_LOCATION_BOTTOM_RIGHT,
- POPUP_STACK_LOCATION_UNKNOWN
-};
+ POPUP_STACK_LOCATION_BOTTOM_RIGHT
+} PopupStackLocationType;
+
#define POPUP_STACK_LOCATION_DEFAULT \
POPUP_STACK_LOCATION_BOTTOM_RIGHT
struct PopupStackLocation
{
- gchar id;
+ PopupStackLocationType type;
const gchar *identifier;
};
@@ -71,7 +72,7 @@
{ POPUP_STACK_LOCATION_TOP_RIGHT, "top_right" },
{ POPUP_STACK_LOCATION_BOTTOM_LEFT, "bottom_left" },
{ POPUP_STACK_LOCATION_BOTTOM_RIGHT, "bottom_right" },
- { -1, NULL }
+ { POPUP_STACK_LOCATION_UNKNOWN, NULL }
};
struct _NotifyTimeout
@@ -115,7 +116,8 @@
};
#endif /* D-BUS < 0.60 */
-static gchar _notify_daemon_stack_location_from_string(const gchar *slocation);
+static PopupStackLocationType
+ _notify_daemon_stack_location_type_from_string(const gchar *slocation);
static void notify_daemon_finalize(GObject *object);
static void _close_notification(NotifyDaemon *daemon, guint id,
gboolean hide_notification);
@@ -165,11 +167,13 @@
if (slocation != NULL && *slocation != '\0')
{
gchar location =
- _notify_daemon_stack_location_from_string(slocation);
+ _notify_daemon_stack_location_type_from_string(slocation);
if (location != POPUP_STACK_LOCATION_UNKNOWN)
daemon->priv->popup_stack_location = location;
}
+
+ g_free(slocation);
}
daemon->priv->notification_hash =
@@ -743,27 +747,29 @@
return TRUE;
}
-static gchar
-_notify_daemon_stack_location_from_string(const gchar *slocation)
+static PopupStackLocationType
+_notify_daemon_stack_location_type_from_string(const gchar *slocation)
{
- const struct PopupStackLocation* l;
+ const struct PopupStackLocation *l;
- for (l = popup_stack_locations; l->id != -1; l++)
+ for (l = popup_stack_locations;
+ l->type != POPUP_STACK_LOCATION_UNKNOWN;
+ l++)
{
if (!strcmp(slocation, l->identifier))
- return l->id;
+ return l->type;
}
return POPUP_STACK_LOCATION_UNKNOWN;
}
static void
-_pop_stack_get_origin_coordinates(const gchar location,
+_pop_stack_get_origin_coordinates(PopupStackLocationType location_type,
GdkRectangle workarea,
gint *x, gint *y, gint *shx, gint *shy,
const gint width, const gint height)
{
- switch (location)
+ switch (location_type)
{
case POPUP_STACK_LOCATION_TOP_LEFT:
*x = workarea.x;
@@ -793,13 +799,13 @@
}
static void
-_pop_stack_translate_coordinates(const gchar location,
+_pop_stack_translate_coordinates(PopupStackLocationType location_type,
GdkRectangle workarea,
gint *x, gint *y, gint *shx, gint *shy,
const gint width, const gint height,
const gint index)
{
- switch (location)
+ switch (location_type)
{
case POPUP_STACK_LOCATION_TOP_LEFT:
*x = workarea.x;
@@ -846,12 +852,12 @@
if (slocation != NULL)
{
- gchar location =
- _notify_daemon_stack_location_from_string(slocation);
+ PopupStackLocationType location_type =
+ _notify_daemon_stack_location_type_from_string(slocation);
- if (location != POPUP_STACK_LOCATION_UNKNOWN)
+ if (location_type != POPUP_STACK_LOCATION_UNKNOWN)
{
- daemon->priv->popup_stack_location = location;
+ daemon->priv->popup_stack_location = location_type;
return;
}
}
More information about the galago-commits
mailing list