[gnome-logs/wip/empty-listbox] Show only user events in the applications category
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-logs/wip/empty-listbox] Show only user events in the applications category
- Date: Mon, 28 Oct 2013 13:52:37 +0000 (UTC)
commit 619a1c700c192cc4ebc65f82a5a31c8ea8a57406
Author: David King <davidk gnome org>
Date: Mon Oct 28 13:30:49 2013 +0000
Show only user events in the applications category
Refine the query for applications to only show events from the same user
that is running the application.
src/gl-eventview.c | 44 +++++++++++++++++++++++++++++++++++++-------
1 files changed, 37 insertions(+), 7 deletions(-)
---
diff --git a/src/gl-eventview.c b/src/gl-eventview.c
index 1d351d0..74b4208 100644
--- a/src/gl-eventview.c
+++ b/src/gl-eventview.c
@@ -898,25 +898,55 @@ static void
gl_event_view_add_listbox_applications (GlEventView *view)
{
GlEventViewPrivate *priv;
- /* Allow all _TRANSPORT != kernel. */
- const GlJournalQuery query = { N_RESULTS,
- (gchar *[4]){ "_TRANSPORT=journal",
- "_TRANSPORT=stdout",
- "_TRANSPORT=syslog", NULL } };
+ GCredentials *creds;
+ uid_t uid;
GtkWidget *listbox;
GtkWidget *scrolled;
priv = gl_event_view_get_instance_private (view);
listbox = gl_event_view_list_box_new (view);
+ creds = g_credentials_new ();
+ uid = g_credentials_get_unix_user (creds, NULL);
- insert_journal_query_cmdline (priv->journal, &query,
- GTK_LIST_BOX (listbox));
+ /* Allow all _TRANSPORT != kernel. Attempt to filter by only processes
+ * owned by the same UID. */
+ if (uid != -1)
+ {
+ gchar *uid_str;
+
+ uid_str = g_strdup_printf ("_UID=%d", uid);
+
+ {
+ GlJournalQuery query = { N_RESULTS,
+ (gchar *[5]){ "_TRANSPORT=journal",
+ "_TRANSPORT=stdout",
+ "_TRANSPORT=syslog",
+ uid_str, NULL } };
+
+ insert_journal_query_cmdline (priv->journal, &query,
+ GTK_LIST_BOX (listbox));
+ }
+
+ g_free (uid_str);
+ }
+ else
+ {
+ GlJournalQuery query = { N_RESULTS,
+ (gchar *[4]){ "_TRANSPORT=journal",
+ "_TRANSPORT=stdout",
+ "_TRANSPORT=syslog", NULL } };
+
+ insert_journal_query_cmdline (priv->journal, &query,
+ GTK_LIST_BOX (listbox));
+ }
scrolled = gtk_scrolled_window_new (NULL, NULL);
gtk_container_add (GTK_CONTAINER (scrolled), listbox);
gtk_widget_show_all (scrolled);
gtk_stack_add_named (GTK_STACK (view), scrolled, "listbox-applications");
+
+ g_object_unref (creds);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]