diff options
author | Pranav Ganorkar <pranavg189@gmail.com> | 2016-06-07 21:30:06 +0530 |
---|---|---|
committer | David King <davidk@gnome.org> | 2016-07-21 10:28:37 +0100 |
commit | 03609326db64b0ef5845a0c741a3c56630d07227 (patch) | |
tree | 8465dbd97bbd73a9b53ca1c35a5a116f27d3484b /src | |
parent | b353835d62df7bd039370324d5328142281e0062 (diff) | |
download | gnome-logs-03609326db64b0ef5845a0c741a3c56630d07227.tar.gz |
Change the "uid" variable type in GlJournalEntry
This variable was changed as we need to pass it as string for substring
search in gl-journal-model. Also, GlEventViewRow was modified to
reflect the change in the "uid" variable type.
https://bugzilla.gnome.org/show_bug.cgi?id=768848
Diffstat (limited to 'src')
-rw-r--r-- | src/gl-eventviewrow.c | 7 | ||||
-rw-r--r-- | src/gl-journal.c | 14 | ||||
-rw-r--r-- | src/gl-journal.h | 2 |
3 files changed, 12 insertions, 11 deletions
diff --git a/src/gl-eventviewrow.c b/src/gl-eventviewrow.c index ca72b7c..bbf4141 100644 --- a/src/gl-eventviewrow.c +++ b/src/gl-eventviewrow.c @@ -180,6 +180,11 @@ gl_event_view_row_construct_category_label (GlEventViewRow *row, { gint uid; GlEventViewRowPrivate *priv; + const gchar *entry_uid_string; + gint entry_uid; + + entry_uid_string = gl_journal_entry_get_uid (entry); + entry_uid = entry_uid_string ? atoi (entry_uid_string) : -1; uid = gl_util_get_uid (); priv = gl_event_view_row_get_instance_private (row); @@ -192,7 +197,7 @@ gl_event_view_row_construct_category_label (GlEventViewRow *row, if ((g_strcmp0 (gl_journal_entry_get_transport (entry), "kernel") == 0 || g_strcmp0 (gl_journal_entry_get_transport (entry), "stdout") == 0 || g_strcmp0 (gl_journal_entry_get_transport (entry), "syslog") == 0) - && gl_journal_entry_get_uid (entry) == uid) + && entry_uid == uid) { priv->category_label = gtk_label_new (_("Applications")); } diff --git a/src/gl-journal.c b/src/gl-journal.c index cc67542..cbbeff5 100644 --- a/src/gl-journal.c +++ b/src/gl-journal.c @@ -38,7 +38,7 @@ struct _GlJournalEntry gchar *transport; gchar *catalog; guint priority; - gint uid; + gchar *uid; }; G_DEFINE_TYPE (GlJournalEntry, gl_journal_entry, G_TYPE_OBJECT); @@ -363,7 +363,6 @@ _gl_journal_query_entry (GlJournal *self) sd_journal *journal; GError *error = NULL; gchar *priority; - gchar *uid; priv = gl_journal_get_instance_private (self); journal = priv->journal; @@ -479,7 +478,7 @@ _gl_journal_query_entry (GlJournal *self) g_clear_error (&error); } - uid = gl_journal_get_data (self, "_UID", &error); + entry->uid = gl_journal_get_data (self, "_UID", &error); if (error != NULL) { @@ -487,10 +486,6 @@ _gl_journal_query_entry (GlJournal *self) g_clear_error (&error); } - /* We store an invalid or non-existent UID as -1 */ - entry->uid = uid ? atoi (uid) : -1; - g_free (uid); - return entry; out: @@ -681,6 +676,7 @@ gl_journal_entry_finalize (GObject *object) g_free (entry->kernel_device); g_free (entry->audit_session); g_free (entry->transport); + g_free (entry->uid); G_OBJECT_CLASS (gl_journal_entry_parent_class)->finalize (object); } @@ -757,10 +753,10 @@ gl_journal_entry_get_priority (GlJournalEntry *entry) return entry->priority; } -gint +const gchar * gl_journal_entry_get_uid (GlJournalEntry *entry) { - g_return_val_if_fail (GL_IS_JOURNAL_ENTRY (entry), -1); + g_return_val_if_fail (GL_IS_JOURNAL_ENTRY (entry), NULL); return entry->uid; } diff --git a/src/gl-journal.h b/src/gl-journal.h index 08c8021..4173eac 100644 --- a/src/gl-journal.h +++ b/src/gl-journal.h @@ -86,7 +86,7 @@ const gchar * gl_journal_entry_get_audit_session (GlJourn const gchar * gl_journal_entry_get_transport (GlJournalEntry *entry); const gchar * gl_journal_entry_get_catalog (GlJournalEntry *entry); guint gl_journal_entry_get_priority (GlJournalEntry *entry); -gint gl_journal_entry_get_uid (GlJournalEntry *entry); +const gchar * gl_journal_entry_get_uid (GlJournalEntry *entry); G_END_DECLS |