[gnome-control-center] user-accounts: Add history dialog



commit 324d1cef8a908911c88bc3e3543330335abf2adb
Author: Ondrej Holy <oholy redhat com>
Date:   Thu Nov 22 15:18:09 2012 +0100

    user-accounts: Add history dialog
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681772

 panels/user-accounts/Makefile.am                  |    2 +
 panels/user-accounts/data/history-dialog.ui       |  160 +++++++++
 panels/user-accounts/data/user-accounts-dialog.ui |   40 ++-
 panels/user-accounts/um-history-dialog.c          |  376 +++++++++++++++++++++
 panels/user-accounts/um-history-dialog.h          |   41 +++
 panels/user-accounts/um-user-panel.c              |   29 ++
 panels/user-accounts/user-accounts.gresource.xml  |    1 +
 7 files changed, 643 insertions(+), 6 deletions(-)
---
diff --git a/panels/user-accounts/Makefile.am b/panels/user-accounts/Makefile.am
index b7aac2e..c7242e7 100644
--- a/panels/user-accounts/Makefile.am
+++ b/panels/user-accounts/Makefile.am
@@ -53,6 +53,8 @@ libuser_accounts_la_SOURCES =		\
 	um-user-panel.c			\
 	um-realm-manager.c		\
 	um-realm-manager.h		\
+	um-history-dialog.h		\
+	um-history-dialog.c		\
 	$(BUILT_SOURCES)
 
 libuser_accounts_la_LIBADD = 		\
diff --git a/panels/user-accounts/data/history-dialog.ui b/panels/user-accounts/data/history-dialog.ui
new file mode 100644
index 0000000..2742213
--- /dev/null
+++ b/panels/user-accounts/data/history-dialog.ui
@@ -0,0 +1,160 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.0 -->
+  <object class="GtkDialog" id="dialog">
+    <property name="can_focus">False</property>
+    <property name="title">Login History</property>
+    <property name="resizable">False</property>
+    <property name="modal">True</property>
+    <property name="window_position">center-on-parent</property>
+    <property name="icon_name">system-users</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="close-button">
+                <property name="label" translatable="yes">Close</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="box1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
+            <child>
+              <object class="GtkBox" id="box3">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="margin_left">6</property>
+                <property name="margin_right">6</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkButton" id="previous-button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <object class="GtkArrow" id="arrow1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="arrow_type">left</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="week-label">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <attributes>
+                      <attribute name="weight" value="bold"/>
+                    </attributes>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="next-button">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <child>
+                      <object class="GtkArrow" id="arrow2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                      </object>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkScrolledWindow" id="scrolledwindow1">
+                <property name="width_request">350</property>
+                <property name="height_request">300</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="hexpand">True</property>
+                <property name="vexpand">True</property>
+                <property name="border_width">6</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkViewport" id="viewport1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkGrid" id="history-grid">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="border_width">12</property>
+                        <property name="row_spacing">12</property>
+                        <property name="column_spacing">12</property>
+                        <property name="column_homogeneous">True</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="0">close-button</action-widget>
+    </action-widgets>
+  </object>
+</interface>
diff --git a/panels/user-accounts/data/user-accounts-dialog.ui b/panels/user-accounts/data/user-accounts-dialog.ui
index cbc798b..981b5af 100644
--- a/panels/user-accounts/data/user-accounts-dialog.ui
+++ b/panels/user-accounts/data/user-accounts-dialog.ui
@@ -460,14 +460,42 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="last-login-value-label">
+                          <object class="GtkGrid" id="last-login-grid">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="margin_left">6</property>
-                            <property name="margin_top">6</property>
-                            <property name="margin_bottom">6</property>
-                            <property name="hexpand">True</property>
-                            <property name="xalign">0</property>
+                            <child>
+                              <object class="GtkLabel" id="last-login-value-label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="margin_left">6</property>
+                                <property name="margin_right">6</property>
+                                <property name="margin_top">6</property>
+                                <property name="margin_bottom">6</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkButton" id="last-login-history-button">
+                                <property name="label" translatable="yes">History</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="xalign">1</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
diff --git a/panels/user-accounts/um-history-dialog.c b/panels/user-accounts/um-history-dialog.c
new file mode 100644
index 0000000..3593df6
--- /dev/null
+++ b/panels/user-accounts/um-history-dialog.c
@@ -0,0 +1,376 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright 2012  Red Hat, Inc,
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Written by: Ondrej Holy <oholy redhat com>
+ */
+
+#include "config.h"
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <act/act.h>
+
+#include "um-history-dialog.h"
+#include "um-utils.h"
+
+struct _UmHistoryDialog {
+        GtkWidget *dialog;
+        GtkBuilder *builder;
+
+        GDateTime *week;
+        GDateTime *current_week;
+
+        ActUser *user;
+};
+
+typedef struct {
+	gint64 login_time;
+	gint64 logout_time;
+	const gchar *type;
+} UmLoginHistory;
+
+static GtkWidget *
+get_widget (UmHistoryDialog *um,
+            const char *name)
+{
+        return (GtkWidget *)gtk_builder_get_object (um->builder, name);
+}
+
+static void
+close_history_dialog (GtkButton       *button,
+                      UmHistoryDialog *um)
+{
+        gtk_widget_hide (um->dialog);
+
+        um_history_dialog_set_user (um, NULL);
+
+        if (um->week) {
+                g_date_time_unref (um->week);
+                um->week = NULL;
+        }
+
+        if (um->current_week) {
+                g_date_time_unref (um->current_week);
+                um->current_week = NULL;
+        }
+}
+
+static void
+show_week_label (UmHistoryDialog *um)
+{
+        gchar *label, *from, *to;
+        GDateTime *date;
+        GTimeSpan span;
+
+        span = g_date_time_difference (um->current_week, um->week);
+        if (span == 0) {
+                label = g_strdup (_("This Week"));
+        }
+        else if (span == G_TIME_SPAN_DAY * 7) {
+                label = g_strdup (_("Last Week"));
+        }
+        else {
+                date = g_date_time_add_days (um->week, 6);
+                from = g_date_time_format (um->week, "%b %e");
+                if (g_date_time_get_year (um->week) == g_date_time_get_year (um->current_week)) {
+                        to = g_date_time_format (date, "%b %e");
+                }
+                else {
+                        to = g_date_time_format (date, "%b %e, %Y");
+                }
+
+                label = g_strconcat (from, " - ", to, NULL);
+
+                g_date_time_unref (date);
+                g_free (from);
+                g_free (to);
+        }
+
+        gtk_label_set_label (GTK_LABEL (get_widget (um, "week-label")), label);
+
+        g_free (label);
+}
+
+static void
+clear_history (UmHistoryDialog *um)
+{
+        GtkWidget *grid;
+        GList *list, *it;
+
+        grid = get_widget (um, "history-grid");
+        list = gtk_container_get_children (GTK_CONTAINER (grid));
+        for (it = list; it != NULL;  it = it->next) {
+                gtk_container_remove (GTK_CONTAINER (grid), GTK_WIDGET (it->data));
+        }
+        g_list_free (list);
+}
+
+static GArray *
+get_login_history (ActUser *user)
+{
+	GArray *login_history;
+	GVariantIter *iter, *iter2;
+	GVariant *variant;
+	const GVariant *value;
+	const gchar *key;
+	UmLoginHistory history;
+
+	login_history = NULL;
+	value = act_user_get_login_history (user);
+	g_variant_get ((GVariant *) value, "a(xxa{sv})", &iter);
+	while (g_variant_iter_loop (iter, "(xxa{sv})", &history.login_time, &history.logout_time, &iter2)) {
+		while (g_variant_iter_loop (iter2, "{sv}", &key, &variant)) {
+			if (g_strcmp0 (key, "type") == 0) {
+				history.type = g_variant_get_string (variant, NULL);
+			}
+		}
+
+		if (login_history == NULL) {
+			login_history = g_array_new (FALSE, TRUE, sizeof (UmLoginHistory));
+		}
+
+		g_array_append_val (login_history, history);
+	}
+
+	return login_history;
+}
+
+static void
+set_sensitivity (UmHistoryDialog *um)
+{
+        GArray *login_history;
+        UmLoginHistory history;
+        gboolean sensitive = FALSE;
+
+        login_history = get_login_history (um->user);
+        if (login_history != NULL) {
+                history = g_array_index (login_history, UmLoginHistory, 0);
+                sensitive = g_date_time_to_unix (um->week) > history.login_time;
+        }
+        gtk_widget_set_sensitive (get_widget (um, "previous-button"), sensitive);
+
+        sensitive = (g_date_time_compare (um->current_week, um->week) == 1);
+        gtk_widget_set_sensitive (get_widget (um, "next-button"), sensitive);
+
+        g_array_free (login_history, TRUE);
+}
+
+static void
+add_record (GtkWidget *grid, GDateTime *datetime, gchar *record_string, gint line)
+{
+        gchar *date, *time, *str;
+        GtkWidget *label;
+
+        date = get_smart_date (datetime);
+        time = g_date_time_format (datetime, "%k:%M");
+        str = g_strconcat (date, ", ", time, NULL);
+        label = gtk_label_new (str);
+        gtk_widget_set_halign (label, GTK_ALIGN_START);
+        gtk_grid_attach (GTK_GRID (grid), label, 1, line, 1, 1);
+        g_free (str);
+        g_free (date);
+        g_free (time);
+        g_date_time_unref (datetime);
+
+        label = gtk_label_new (record_string);
+        gtk_widget_set_halign (label, GTK_ALIGN_START);
+        gtk_grid_attach (GTK_GRID (grid), label, 2, line, 1, 1);
+}
+
+static void
+show_week (UmHistoryDialog *um)
+{
+        GArray *login_history;
+        GDateTime *datetime, *temp;
+        gint64 from, to;
+        gint i, line;
+        GtkWidget *grid;
+        UmLoginHistory history;
+
+        show_week_label (um);
+        clear_history (um);
+        set_sensitivity (um);
+
+        login_history = get_login_history (um->user);
+        if (login_history == NULL) {
+                return;
+        }
+
+        /* Find first record for week */
+        from = g_date_time_to_unix (um->week);
+        temp = g_date_time_add_weeks (um->week, 1);
+        to = g_date_time_to_unix (temp);
+        g_date_time_unref (temp);
+        for (i = login_history->len - 1; i >= 0; i--) {
+                history = g_array_index (login_history, UmLoginHistory, i);
+                if (history.login_time < to) {
+                        break;
+                }
+        }
+
+        /* Add new session records */
+        grid = get_widget (um, "history-grid");
+        line = 0;
+        for (;i >= 0; i--) {
+                history = g_array_index (login_history, UmLoginHistory, i);
+                if (history.logout_time > 0 && history.logout_time < from) {
+                        break;
+                }
+
+                /* Display only x-sessions */
+                if (g_strrstr (history.type, ":") == NULL) {
+                        continue;
+                }
+
+                if (history.logout_time > 0 && history.logout_time < to) {
+                        datetime = g_date_time_new_from_unix_local (history.logout_time);
+                        add_record (grid, datetime, "Session Ended", line);
+                        line++;
+                }
+
+                if (history.login_time >= from) {
+                        datetime = g_date_time_new_from_unix_local (history.login_time);
+                        add_record (grid, datetime, "Session Started", line);
+                        line++;
+                }
+        }
+
+        gtk_widget_show_all (grid);
+
+        g_array_free (login_history, TRUE);
+}
+
+static void
+show_previous (GtkButton       *button,
+               UmHistoryDialog *um)
+{
+        GDateTime *temp;
+
+        temp = um->week;
+        um->week = g_date_time_add_weeks (um->week, -1);
+        g_date_time_unref (temp);
+
+        show_week (um);
+}
+
+static void
+show_next (GtkButton       *button,
+           UmHistoryDialog *um)
+{
+        GDateTime *temp;
+
+        temp = um->week;
+        um->week = g_date_time_add_weeks (um->week, 1);
+        g_date_time_unref (temp);
+
+        show_week (um);
+}
+
+void
+um_history_dialog_set_user (UmHistoryDialog *um,
+                            ActUser         *user)
+{
+        if (um->user) {
+                g_clear_object (&um->user);
+        }
+
+        if (user) {
+                um->user = g_object_ref (user);
+        }
+}
+
+void
+um_history_dialog_show (UmHistoryDialog *um,
+                        GtkWindow       *parent)
+{
+        GDateTime *temp, *local;
+
+        /* Set the first day of this week */
+        local = g_date_time_new_now_local ();
+        temp = g_date_time_new_local (g_date_time_get_year (local),
+                                      g_date_time_get_month (local),
+                                      g_date_time_get_day_of_month (local),
+                                      0, 0, 0);
+        um->week = g_date_time_add_days (temp, 1 - g_date_time_get_day_of_week (temp));
+        um->current_week = g_date_time_ref (um->week);
+        g_date_time_unref (local);
+        g_date_time_unref (temp);
+
+        show_week (um);
+
+        gtk_window_set_transient_for (GTK_WINDOW (um->dialog), parent);
+        gtk_window_present (GTK_WINDOW (um->dialog));
+}
+
+UmHistoryDialog *
+um_history_dialog_new (void)
+{
+        GError *error = NULL;
+        UmHistoryDialog *um;
+        GtkWidget *widget;
+
+        um = g_new0 (UmHistoryDialog, 1);
+        um->builder = gtk_builder_new ();
+
+        if (!gtk_builder_add_from_resource (um->builder, "/org/gnome/control-center/user-accounts/history-dialog.ui", &error)) {
+                g_error ("%s", error->message);
+                g_error_free (error);
+                g_free (um);
+
+                return NULL;
+        }
+
+        um->dialog = get_widget (um, "dialog");
+        g_signal_connect (um->dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), NULL);
+
+        widget = get_widget (um, "close-button");
+        g_signal_connect (widget, "clicked", G_CALLBACK (close_history_dialog), um);
+
+        widget = get_widget (um, "next-button");
+        g_signal_connect (widget, "clicked", G_CALLBACK (show_next), um);
+
+        widget = get_widget (um, "previous-button");
+        g_signal_connect (widget, "clicked", G_CALLBACK (show_previous), um);
+
+        return um;
+}
+
+void
+um_history_dialog_free (UmHistoryDialog *um)
+{
+        gtk_widget_destroy (um->dialog);
+
+        g_clear_object (&um->user);
+        g_clear_object (&um->builder);
+
+        if (um->week) {
+                g_date_time_unref (um->week);
+        }
+
+        if (um->current_week) {
+                g_date_time_unref (um->current_week);
+        }
+
+        g_free (um);
+}
diff --git a/panels/user-accounts/um-history-dialog.h b/panels/user-accounts/um-history-dialog.h
new file mode 100644
index 0000000..f0fbe9e
--- /dev/null
+++ b/panels/user-accounts/um-history-dialog.h
@@ -0,0 +1,41 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright 2012  Red Hat, Inc,
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Written by: Ondrej Holy <oholy redhat com>
+ */
+
+#ifndef __UM_HISTORY_DIALOG_H__
+#define __UM_HISTORY_DIALOG_H__
+
+#include <gtk/gtk.h>
+#include <act/act-user.h>
+
+G_BEGIN_DECLS
+
+typedef struct _UmHistoryDialog UmHistoryDialog;
+
+UmHistoryDialog *um_history_dialog_new      (void);
+void             um_history_dialog_free     (UmHistoryDialog *dialog);
+void             um_history_dialog_set_user (UmHistoryDialog *dialog,
+                                             ActUser         *user);
+void             um_history_dialog_show     (UmHistoryDialog *dialog,
+                                             GtkWindow       *parent);
+
+G_END_DECLS
+
+#endif
diff --git a/panels/user-accounts/um-user-panel.c b/panels/user-accounts/um-user-panel.c
index 7b4fa61..71aeae8 100644
--- a/panels/user-accounts/um-user-panel.c
+++ b/panels/user-accounts/um-user-panel.c
@@ -50,6 +50,7 @@
 #include "um-fingerprint-dialog.h"
 #include "um-utils.h"
 #include "um-resources.h"
+#include "um-history-dialog.h"
 
 #include "cc-common-language.h"
 
@@ -70,6 +71,7 @@ struct _CcUserPanelPrivate {
 
         UmPasswordDialog *password_dialog;
         UmPhotoDialog *photo_dialog;
+        UmHistoryDialog *history_dialog;
 };
 
 static GtkWidget *
@@ -680,6 +682,11 @@ show_user (ActUser *user, CcUserPanelPrivate *d)
         }
         gtk_widget_set_visible (widget, show);
         gtk_widget_set_visible (label, show);
+
+        enable = act_user_get_login_history (user) != NULL;
+        widget = get_widget (d, "last-login-history-button");
+        gtk_widget_set_visible (widget, show);
+        gtk_widget_set_sensitive (widget, enable);
 }
 
 static void on_permission_changed (GPermission *permission, GParamSpec *pspec, gpointer data);
@@ -855,6 +862,19 @@ change_fingerprint (GtkButton *button, CcUserPanelPrivate *d)
         g_object_unref (user);
 }
 
+static void
+show_history (GtkButton *button, CcUserPanelPrivate *d)
+{
+        ActUser *user;
+
+        user = get_selected_user (d);
+
+        um_history_dialog_set_user (d->history_dialog, user);
+        um_history_dialog_show (d->history_dialog, GTK_WINDOW (gtk_widget_get_toplevel (d->main_box)));
+
+        g_object_unref (user);
+}
+
 static gint
 sort_users (GtkTreeModel *model,
             GtkTreeIter  *a,
@@ -1276,6 +1296,10 @@ setup_main_window (CcUserPanelPrivate *d)
         g_signal_connect (button, "clicked",
                           G_CALLBACK (change_fingerprint), d);
 
+        button = get_widget (d, "last-login-history-button");
+        g_signal_connect (button, "clicked",
+                          G_CALLBACK (show_history), d);
+
         d->permission = (GPermission *)polkit_permission_new_sync (USER_ACCOUNTS_PERMISSION, NULL, NULL, &error);
         if (d->permission != NULL) {
                 g_signal_connect (d->permission, "notify",
@@ -1340,6 +1364,7 @@ cc_user_panel_init (CcUserPanel *self)
         d->photo_dialog = um_photo_dialog_new (button);
         d->main_box = get_widget (d, "accounts-vbox");
         gtk_widget_reparent (d->main_box, GTK_WIDGET (self));
+        d->history_dialog = um_history_dialog_new ();
 
         context = gtk_widget_get_style_context (get_widget (d, "list-scrolledwindow"));
         gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
@@ -1364,6 +1389,10 @@ cc_user_panel_dispose (GObject *object)
                 um_photo_dialog_free (priv->photo_dialog);
                 priv->photo_dialog = NULL;
         }
+        if (priv->history_dialog) {
+                um_history_dialog_free (priv->history_dialog);
+                priv->history_dialog = NULL;
+        }
         if (priv->language_chooser) {
                 gtk_widget_destroy (priv->language_chooser);
                 priv->language_chooser = NULL;
diff --git a/panels/user-accounts/user-accounts.gresource.xml b/panels/user-accounts/user-accounts.gresource.xml
index f80689b..5a47577 100644
--- a/panels/user-accounts/user-accounts.gresource.xml
+++ b/panels/user-accounts/user-accounts.gresource.xml
@@ -5,6 +5,7 @@
     <file alias="account-fingerprint.ui" preprocess="xml-stripblanks">data/account-fingerprint.ui</file>
     <file alias="password-dialog.ui" preprocess="xml-stripblanks">data/password-dialog.ui</file>
     <file alias="photo-dialog.ui" preprocess="xml-stripblanks">data/photo-dialog.ui</file>
+    <file alias="history-dialog.ui" preprocess="xml-stripblanks">data/history-dialog.ui</file>
     <file alias="user-accounts-dialog.ui" preprocess="xml-stripblanks">data/user-accounts-dialog.ui</file>
     <file alias="left-index-finger.png">data/icons/left-index-finger.png</file>
     <file alias="left-middle-finger.png">data/icons/left-middle-finger.png</file>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]