summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2002-12-01 02:49:20 +0000
committerHavoc Pennington <hp@redhat.com>2002-12-01 02:49:20 +0000
commitc4850eb890dd67e35cdae7d3c07b325f1a224b3d (patch)
treeec0292f7db2a2abd6730d538105076cc83934f82
parentdb6c54e7afaaca63d13dad5c672255b0c2e1f381 (diff)
new function (sn_launcher_context_initiate): remove debug spew, and recordSTARTUP_NOTIFICATION_0_4
initiation time (sn_launcher_context_get_initiated_time): new function (sn_launcher_context_get_last_active_time): new function allow NULL return locations
-rw-r--r--ChangeLog7
-rw-r--r--libsn/sn-launcher.c44
-rw-r--r--libsn/sn-launcher.h11
-rw-r--r--libsn/sn-monitor.c12
4 files changed, 67 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 52fa445..52082c4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,14 @@
2002-11-30 Havoc Pennington <hp@pobox.com>
* libsn/sn-launcher.c (sn_launcher_context_complete): new function
+ (sn_launcher_context_initiate): remove debug spew, and record
+ initiation time
+ (sn_launcher_context_get_initiated_time): new function
+ (sn_launcher_context_get_last_active_time): new function
+ * libsn/sn-monitor.c (sn_startup_sequence_get_initiated_time):
+ allow NULL return locations
+
* configure.in: bump version to 0.4 (not releasing yet though)
* libsn/sn-monitor.c (sn_startup_sequence_complete): new function
diff --git a/libsn/sn-launcher.c b/libsn/sn-launcher.c
index ffb4b96..5f91f98 100644
--- a/libsn/sn-launcher.c
+++ b/libsn/sn-launcher.c
@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <unistd.h>
+#include <sys/time.h>
#include <assert.h>
static SnList* context_list = NULL;
@@ -43,6 +44,7 @@ struct SnLauncherContext
char *wmclass;
char *binary_name;
char *icon_name;
+ struct timeval initiation_time;
unsigned int completed : 1;
unsigned int canceled : 1;
};
@@ -262,12 +264,12 @@ sn_launcher_context_initiate (SnLauncherContext *context,
names[i] = NULL;
values[i] = NULL;
+
+ gettimeofday (&context->initiation_time, NULL);
message = sn_internal_serialize_message ("new",
(const char**) names,
(const char**) values);
-
- printf ("Sending '%s'\n", message);
sn_internal_broadcast_xmessage (context->display,
context->screen,
@@ -430,5 +432,43 @@ sn_launcher_context_set_extra_property (SnLauncherContext *context,
{
WARN_ALREADY_INITIATED (context);
+ /* FIXME implement this */
+}
+
+void
+sn_launcher_context_get_initiated_time (SnLauncherContext *context,
+ long *tv_sec,
+ long *tv_usec)
+{
+ if (context->startup_id == NULL)
+ {
+ fprintf (stderr, "%s called for an SnLauncherContext that hasn't been initiated\n",
+ "sn_launcher_context_get_initiated_time");
+ return;
+ }
+
+ if (tv_sec)
+ *tv_sec = context->initiation_time.tv_sec;
+ if (tv_usec)
+ *tv_usec = context->initiation_time.tv_usec;
+}
+
+void
+sn_launcher_context_get_last_active_time (SnLauncherContext *context,
+ long *tv_sec,
+ long *tv_usec)
+{
+ if (context->startup_id == NULL)
+ {
+ fprintf (stderr, "%s called for an SnLauncherContext that hasn't been initiated\n",
+ "sn_launcher_context_get_initiated_time");
+ return;
+ }
+
+ /* for now, maybe forever, the same as initiated time. */
+ if (tv_sec)
+ *tv_sec = context->initiation_time.tv_sec;
+ if (tv_usec)
+ *tv_usec = context->initiation_time.tv_usec;
}
diff --git a/libsn/sn-launcher.h b/libsn/sn-launcher.h
index c58d09e..f88f11c 100644
--- a/libsn/sn-launcher.h
+++ b/libsn/sn-launcher.h
@@ -44,7 +44,7 @@ void sn_launcher_context_initiate (SnLauncherContext *context,
const char *launchee_name,
Time timestamp);
void sn_launcher_context_complete (SnLauncherContext *context);
-const char* sn_launcher_context_get_launch_id (SnLauncherContext *context);
+const char* sn_launcher_context_get_startup_id (SnLauncherContext *context);
sn_bool_t sn_launcher_context_get_initiated (SnLauncherContext *context);
void sn_launcher_context_setup_child_process (SnLauncherContext *context);
@@ -66,6 +66,15 @@ void sn_launcher_context_set_extra_property (SnLauncherContext *context,
const char *name,
const char *value);
+
+void sn_launcher_context_get_initiated_time (SnLauncherContext *context,
+ long *tv_sec,
+ long *tv_usec);
+void sn_launcher_context_get_last_active_time (SnLauncherContext *context,
+ long *tv_sec,
+ long *tv_usec);
+
+
SN_END_DECLS
#endif /* __SN_LAUNCHER_H__ */
diff --git a/libsn/sn-monitor.c b/libsn/sn-monitor.c
index 3d93a09..63940de 100644
--- a/libsn/sn-monitor.c
+++ b/libsn/sn-monitor.c
@@ -343,8 +343,10 @@ sn_startup_sequence_get_initiated_time (SnStartupSequence *sequence,
long *tv_sec,
long *tv_usec)
{
- *tv_sec = sequence->initiation_time.tv_sec;
- *tv_usec = sequence->initiation_time.tv_usec;
+ if (tv_sec)
+ *tv_sec = sequence->initiation_time.tv_sec;
+ if (tv_usec)
+ *tv_usec = sequence->initiation_time.tv_usec;
}
/**
@@ -364,8 +366,10 @@ sn_startup_sequence_get_last_active_time (SnStartupSequence *sequence,
long *tv_usec)
{
/* for now the same as get_initiated_time */
- *tv_sec = sequence->initiation_time.tv_sec;
- *tv_usec = sequence->initiation_time.tv_usec;
+ if (tv_sec)
+ *tv_sec = sequence->initiation_time.tv_sec;
+ if (tv_usec)
+ *tv_usec = sequence->initiation_time.tv_usec;
}
void