Commit d27fdaaf authored by Nicolas Jager's avatar Nicolas Jager

set history limit

- history limit is now stored by the client. this patch ensure
only to keep the data. It does not clean the history yet.

Change-Id: Ia95b4589f9ec71f5c84fefa0341080346ef874ab
parent cfeffc36
......@@ -58,5 +58,10 @@
<summary>The user selected account.</summary>
<description>The account id of the user selected account; if empty there is no valid account selected.</description>
</key>
<key name="history-limit" type="i">
<default>0</default>
<summary>Number of days to store the history.</summary>
<description>Keep history only within the limit. 0 for unlimited history.</description>
</key>
</schema>
</schemalist>
......@@ -86,13 +86,6 @@ general_settings_view_dispose(GObject *object)
G_OBJECT_CLASS(general_settings_view_parent_class)->dispose(object);
}
static void
history_limit_changed(GtkAdjustment *adjustment, G_GNUC_UNUSED gpointer user_data)
{
int limit = (int)gtk_adjustment_get_value(GTK_ADJUSTMENT(adjustment));
CategorizedHistoryModel::instance().setHistoryLimit(limit);
}
static gboolean
clear_history_dialog(GeneralSettingsView *self)
{
......@@ -173,12 +166,9 @@ general_settings_view_init(GeneralSettingsView *self)
g_settings_bind(priv->settings, "chat-pane-horizontal",
priv->radiobutton_chatbottom, "active",
(GSettingsBindFlags) (G_SETTINGS_BIND_DEFAULT | G_SETTINGS_BIND_INVERT_BOOLEAN));
/* history limit */
gtk_adjustment_set_value(GTK_ADJUSTMENT(priv->adjustment_history_duration),
CategorizedHistoryModel::instance().historyLimit());
g_signal_connect(priv->adjustment_history_duration,
"value-changed", G_CALLBACK(history_limit_changed), NULL);
g_settings_bind(priv->settings, "history-limit",
priv->adjustment_history_duration, "value",
G_SETTINGS_BIND_DEFAULT);
/* clear history */
g_signal_connect(priv->button_clear_history, "clicked", G_CALLBACK(clear_history), self);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment