diary r87 - in trunk: . data po src
- From: pwithnall svn gnome org
- To: svn-commits-list gnome org
- Subject: diary r87 - in trunk: . data po src
- Date: Mon, 13 Oct 2008 23:08:41 +0000 (UTC)
Author: pwithnall
Date: Mon Oct 13 23:08:41 2008
New Revision: 87
URL: http://svn.gnome.org/viewvc/diary?rev=87&view=rev
Log:
2008-10-14 Philip Withnall <philip tecnocode co uk>
* configure.ac:
* data/Makefile.am:
* data/almanah.schemas.in:
* data/almanah.ui:
* src/Makefile.am:
* src/interface.c (diary_create_interface):
* src/main-window.c (almanah_main_window_new),
(mw_preferences_activate_cb):
* src/main.c (diary_quit):
* src/main.h:
* src/preferences-dialog.c
(almanah_preferences_dialog_class_init),
(almanah_preferences_dialog_init),
(almanah_preferences_dialog_dispose),
(almanah_preferences_dialog_new), (pd_key_combo_changed_cb),
(pd_response_cb):
* src/preferences-dialog.h:
* src/storage-manager.c (get_encryption_key): Add a preferences
dialogue, with the ability to choose the encryption key, but not
yet the ability to create new keys. (Helps: #539792)
Added:
trunk/data/almanah.schemas.in
trunk/src/preferences-dialog.c
trunk/src/preferences-dialog.h
Modified:
trunk/ChangeLog
trunk/configure.ac
trunk/data/Makefile.am
trunk/data/almanah.ui
trunk/po/ChangeLog
trunk/po/POTFILES.in
trunk/src/Makefile.am
trunk/src/interface.c
trunk/src/main-window.c
trunk/src/main.c
trunk/src/main.h
trunk/src/storage-manager.c
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Mon Oct 13 23:08:41 2008
@@ -66,6 +66,7 @@
IT_PROG_INTLTOOL([0.35.0])
AM_PROG_LIBTOOL
+AM_GCONF_SOURCE_2
PKG_CHECK_MODULES(STANDARD, glib-2.0 gtk+-2.0 >= 2.12 gmodule-2.0 gio-2.0 sqlite3 cairo)
AC_SUBST(STANDARD_CFLAGS)
@@ -78,7 +79,7 @@
fi
if test $encryption = "true"; then
- PKG_CHECK_MODULES(ENCRYPTION, gconf-2.0)
+ PKG_CHECK_MODULES(ENCRYPTION, cryptui-0.0 gconf-2.0)
dnl Check for GPGME, which doesn't provide a pkgconfig file
dnl This code courtesy of seahorse
Modified: trunk/data/Makefile.am
==============================================================================
--- trunk/data/Makefile.am (original)
+++ trunk/data/Makefile.am Mon Oct 13 23:08:41 2008
@@ -1,5 +1,9 @@
SUBDIRS = icons
+###############################################################################
+# Icons
+###############################################################################
+
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
install-data-hook: update-icon-cache
@@ -13,18 +17,54 @@
echo "*** $(gtk_update_icon_cache)"; \
fi
+###############################################################################
# UI file
+###############################################################################
+
uidir = $(datadir)/almanah
ui_DATA = almanah.ui
+###############################################################################
# Desktop file
+###############################################################################
+
@INTLTOOL_DESKTOP_RULE@
desktop_in_files = almanah.desktop.in
desktopdir = $(datadir)/applications
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+###############################################################################
+# GConf schemas
+###############################################################################
+
+ INTLTOOL_SCHEMAS_RULE@
+
+schemasdir = $(GCONF_SCHEMA_FILE_DIR)
+schemas_in_files = almanah.schemas.in
+schemas_DATA = $(schemas_in_files:.schemas.in=.schemas)
+
+install-data-local:
+if GCONF_SCHEMAS_INSTALL
+if ENCRYPTION
+ @GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) gconftool-2 \
+ --makefile-install-rule $(schemas_DATA) || \
+ (echo ;\
+ echo "*****************************************************"; \
+ echo "Installation of schemas failed: install them manually"; \
+ echo "*****************************************************";)
+ @true
+endif
+endif
+
+###############################################################################
+# General
+###############################################################################
+
EXTRA_DIST = \
- $(ui_DATA) \
- $(desktop_in_files)
-CLEANFILES = $(desktop_DATA)
+ $(ui_DATA) \
+ $(desktop_in_files) \
+ $(schemas_in_files)
+CLEANFILES = \
+ $(desktop_DATA) \
+ $(schemas_DATA)
Added: trunk/data/almanah.schemas.in
==============================================================================
--- (empty file)
+++ trunk/data/almanah.schemas.in Mon Oct 13 23:08:41 2008
@@ -0,0 +1,15 @@
+<gconfschemafile>
+ <schemalist>
+ <schema>
+ <key>/schemas/apps/almanah/encryption_key</key>
+ <applyto>/apps/almanah/encryption_key</applyto>
+ <owner>almanah</owner>
+ <type>string</type>
+ <default></default>
+ <locale name="C">
+ <short>Database encryption key ID</short>
+ <long>The ID of the key to use to encrypt and decrypt the database, if Almanah has been built with encryption support. Leave blank to disable database encryption.</long>
+ </locale>
+ </schema>
+ </schemalist>
+</gconfschemafile>
Modified: trunk/data/almanah.ui
==============================================================================
--- trunk/data/almanah.ui (original)
+++ trunk/data/almanah.ui Mon Oct 13 23:08:41 2008
@@ -66,6 +66,13 @@
</object>
</child>
<child>
+ <object class="GtkAction" id="dry_ui_preferences">
+ <property name="stock-id">gtk-preferences</property>
+ <property name="name">edit-preferences</property>
+ <signal name="activate" handler="mw_preferences_activate_cb"/>
+ </object>
+ </child>
+ <child>
<object class="GtkAction" id="dry_ui_format">
<property name="name">format</property>
<property name="label" translatable="yes">F_ormat</property>
@@ -141,6 +148,8 @@
<menuitem action="dry_ui_delete"/>
<separator/>
<menuitem action="dry_ui_search"/>
+ <separator/>
+ <menuitem action="dry_ui_preferences"/>
</menu>
<menu action="dry_ui_format">
<menuitem action="dry_ui_bold"/>
@@ -166,10 +175,10 @@
<object class="GtkListStore" id="dry_mw_link_store">
<columns>
- <column type="gchararray"/><!--Type-->
- <column type="gchararray"/><!--Value-->
- <column type="gchararray"/><!--Value 2-->
- <column type="gchararray"/><!--Icon name-->
+ <column type="gchararray"/><!-- Type -->
+ <column type="gchararray"/><!-- Value -->
+ <column type="gchararray"/><!-- Value 2 -->
+ <column type="gchararray"/><!-- Icon name -->
</columns>
</object>
@@ -308,7 +317,6 @@
</child>
<child>
<object class="GtkButton" id="dry_mw_view_button">
- <!--<property name="use-stock">True</property>-->
<property name="image">dry_mw_view_button_image</property>
<property name="label" translatable="yes">View</property>
<signal name="clicked" handler="mw_view_button_clicked_cb"/>
@@ -341,9 +349,9 @@
<object class="GtkListStore" id="dry_ald_type_store">
<columns>
- <column type="gchararray"/><!--Name-->
- <column type="gchararray"/><!--Type-->
- <column type="gchararray"/><!--Icon name-->
+ <column type="gchararray"/><!-- Name -->
+ <column type="gchararray"/><!-- Type -->
+ <column type="gchararray"/><!-- Icon name -->
</columns>
</object>
@@ -428,8 +436,8 @@
</object>
</child>
<action-widgets>
- <action-widget response="-6">dry_ald_cancel_button</action-widget><!--GTK_RESPONSE_CANCEL-->
- <action-widget response="-5">dry_ald_add_button</action-widget><!--GTK_RESPONSE_OK-->
+ <action-widget response="-6">dry_ald_cancel_button</action-widget><!-- GTK_RESPONSE_CANCEL -->
+ <action-widget response="-5">dry_ald_add_button</action-widget><!-- GTK_RESPONSE_OK -->
</action-widgets>
</object>
@@ -439,10 +447,10 @@
<object class="GtkListStore" id="dry_sd_results_store">
<columns>
- <column type="guint"/><!--Day-->
- <column type="guint"/><!--Month-->
- <column type="guint"/><!--Year-->
- <column type="gchararray"/><!--Formatted date-->
+ <column type="guint"/><!-- Day -->
+ <column type="guint"/><!-- Month -->
+ <column type="guint"/><!-- Year -->
+ <column type="gchararray"/><!-- Formatted date -->
</columns>
</object>
@@ -525,7 +533,39 @@
</object>
</child>
<action-widgets>
- <action-widget response="-7">dry_sd_close_button</action-widget><!--GTK_RESPONSE_CLOSE-->
+ <action-widget response="-7">dry_sd_close_button</action-widget><!-- GTK_RESPONSE_CLOSE -->
+ </action-widgets>
+ </object>
+
+ <object class="AlmanahPreferencesDialog" id="dry_preferences_dialog">
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="vbox4">
+ <child>
+ <object class="GtkTable" id="dry_pd_table">
+ <property name="n-rows">1</property>
+ <property name="n-columns">2</property>
+ <property name="column-spacing">5</property>
+ <property name="row-spacing">5</property>
+ <property name="border-width">5</property>
+ <!-- Encryption key chooser and label go here, programmatically -->
+ </object>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="hbuttonbox2">
+ <child>
+ <object class="GtkButton" id="dry_pd_close_button">
+ <property name="use-stock">True</property>
+ <property name="label">gtk-close</property>
+ <property name="can-default">True</property>
+ <property name="has-default">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-7">dry_pd_close_button</action-widget><!-- GTK_RESPONSE_CLOSE -->
</action-widgets>
</object>
</interface>
Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in (original)
+++ trunk/po/POTFILES.in Mon Oct 13 23:08:41 2008
@@ -1,6 +1,7 @@
# List of source files containing translatable strings.
[encoding: UTF-8]
data/almanah.desktop.in
+data/almanah.schemas.in
[type: gettext/glade]data/almanah.ui
src/interface.c
src/link.c
@@ -9,6 +10,7 @@
src/links/uri.c
src/main-window.c
src/main.c
+src/preferences-dialog.c
src/printing.c
src/search-dialog.c
src/storage-manager.c
Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am (original)
+++ trunk/src/Makefile.am Mon Oct 13 23:08:41 2008
@@ -31,6 +31,8 @@
add-link-dialog.h \
search-dialog.c \
search-dialog.h \
+ preferences-dialog.c \
+ preferences-dialog.h \
printing.c \
printing.h \
entry.c \
Modified: trunk/src/interface.c
==============================================================================
--- trunk/src/interface.c (original)
+++ trunk/src/interface.c Mon Oct 13 23:08:41 2008
@@ -25,6 +25,7 @@
#include "main-window.h"
#include "add-link-dialog.h"
#include "search-dialog.h"
+#include "preferences-dialog.h"
#include "interface.h"
const gchar *
@@ -42,6 +43,7 @@
diary->main_window = GTK_WIDGET (almanah_main_window_new ());
diary->add_link_dialog = GTK_WIDGET (almanah_add_link_dialog_new ());
diary->search_dialog = GTK_WIDGET (almanah_search_dialog_new ());
+ diary->preferences_dialog = GTK_WIDGET (almanah_preferences_dialog_new ());
return diary->main_window;
}
Modified: trunk/src/main-window.c
==============================================================================
--- trunk/src/main-window.c (original)
+++ trunk/src/main-window.c Mon Oct 13 23:08:41 2008
@@ -183,6 +183,7 @@
gchar *error_message = g_strdup_printf (_("The spelling checker could not be initialized: %s"), error->message);
diary_interface_error (error_message, NULL);
g_free (error_message);
+ g_error_free (error);
}
#endif /* ENABLE_SPELL_CHECKING */
@@ -524,6 +525,13 @@
gtk_dialog_run (GTK_DIALOG (diary->search_dialog));
}
+void
+mw_preferences_activate_cb (GtkAction *action, gpointer user_data)
+{
+ gtk_widget_show_all (diary->preferences_dialog);
+ gtk_dialog_run (GTK_DIALOG (diary->preferences_dialog));
+}
+
static void
apply_formatting (AlmanahMainWindow *self, const gchar *tag_name, gboolean applying)
{
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Mon Oct 13 23:08:41 2008
@@ -49,13 +49,14 @@
{
GError *error = NULL;
- g_signal_connect (diary->storage_manager, "disconnected", storage_manager_disconnected_cb, NULL);
+ g_signal_connect (diary->storage_manager, "disconnected", G_CALLBACK (storage_manager_disconnected_cb), NULL);
if (almanah_storage_manager_disconnect (diary->storage_manager, &error) == FALSE) {
diary_interface_error (error->message, diary->main_window);
}
gtk_widget_destroy (diary->add_link_dialog);
gtk_widget_destroy (diary->search_dialog);
+ gtk_widget_destroy (diary->preferences_dialog);
gtk_widget_destroy (diary->main_window);
/* Quitting is actually done in storage_manager_disconnected_cb, which is called once
Modified: trunk/src/main.h
==============================================================================
--- trunk/src/main.h (original)
+++ trunk/src/main.h Mon Oct 13 23:08:41 2008
@@ -29,6 +29,10 @@
#ifndef DIARY_MAIN_H
#define DIARY_MAIN_H
+#ifdef ENABLE_ENCRYPTION
+#define ENCRYPTION_KEY_GCONF_PATH "/apps/almanah/encryption_key"
+#endif /* ENABLE_ENCRYPTION */
+
G_BEGIN_DECLS
typedef struct {
@@ -40,6 +44,7 @@
GtkWidget *main_window;
GtkWidget *add_link_dialog;
GtkWidget *search_dialog;
+ GtkWidget *preferences_dialog;
GdkAtom native_serialisation_atom;
Added: trunk/src/preferences-dialog.c
==============================================================================
--- (empty file)
+++ trunk/src/preferences-dialog.c Mon Oct 13 23:08:41 2008
@@ -0,0 +1,199 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Almanah
+ * Copyright (C) Philip Withnall 2008 <philip tecnocode co uk>
+ *
+ * Almanah 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Almanah 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 Almanah. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <config.h>
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#ifdef ENABLE_ENCRYPTION
+#define LIBCRYPTUI_API_SUBJECT_TO_CHANGE
+#include <libcryptui/cryptui-key-combo.h>
+#include <libcryptui/cryptui-keyset.h>
+#endif /* ENABLE_ENCRYPTION */
+
+#include "preferences-dialog.h"
+#include "interface.h"
+#include "main.h"
+#include "main-window.h"
+
+static void almanah_preferences_dialog_init (AlmanahPreferencesDialog *self);
+static void almanah_preferences_dialog_dispose (GObject *object);
+#ifdef ENABLE_ENCRYPTION
+static void pd_key_combo_changed_cb (GtkComboBox *combo_box, AlmanahPreferencesDialog *preferences_dialog);
+#endif /* ENABLE_ENCRYPTION */
+static void pd_response_cb (GtkDialog *dialog, gint response_id, AlmanahPreferencesDialog *preferences_dialog);
+
+struct _AlmanahPreferencesDialogPrivate {
+#ifdef ENABLE_ENCRYPTION
+ CryptUIKeyset *keyset;
+ CryptUIKeyStore *key_store;
+ GtkComboBox *key_combo;
+#endif /* ENABLE_ENCRYPTION */
+};
+
+G_DEFINE_TYPE (AlmanahPreferencesDialog, almanah_preferences_dialog, GTK_TYPE_DIALOG)
+#define ALMANAH_PREFERENCES_DIALOG_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), ALMANAH_TYPE_PREFERENCES_DIALOG, AlmanahPreferencesDialogPrivate))
+
+static void
+almanah_preferences_dialog_class_init (AlmanahPreferencesDialogClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+ g_type_class_add_private (klass, sizeof (AlmanahPreferencesDialogPrivate));
+ gobject_class->dispose = almanah_preferences_dialog_dispose;
+}
+
+static void
+almanah_preferences_dialog_init (AlmanahPreferencesDialog *self)
+{
+ self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, ALMANAH_TYPE_PREFERENCES_DIALOG, AlmanahPreferencesDialogPrivate);
+
+ g_signal_connect (self, "response", G_CALLBACK (pd_response_cb), self);
+ gtk_dialog_set_has_separator (GTK_DIALOG (self), FALSE);
+ gtk_window_set_modal (GTK_WINDOW (self), FALSE);
+ gtk_window_set_title (GTK_WINDOW (self), _("Almanah Preferences"));
+ gtk_widget_set_size_request (GTK_WIDGET (self), 400, 100);
+}
+
+static void
+almanah_preferences_dialog_dispose (GObject *object)
+{
+ AlmanahPreferencesDialogPrivate *priv = ALMANAH_PREFERENCES_DIALOG (object)->priv;
+
+#ifdef ENABLE_ENCRYPTION
+ if (priv->keyset != NULL) {
+ g_object_unref (priv->keyset);
+ priv->keyset = NULL;
+ }
+
+ if (priv->key_store != NULL) {
+ g_object_unref (priv->key_store);
+ priv->key_store = NULL;
+ }
+#endif /* ENABLE_ENCRYPTION */
+
+ /* Chain up to the parent class */
+ G_OBJECT_CLASS (almanah_preferences_dialog_parent_class)->dispose (object);
+}
+
+AlmanahPreferencesDialog *
+almanah_preferences_dialog_new (void)
+{
+ GtkBuilder *builder;
+#ifdef ENABLE_ENCRYPTION
+ GtkWidget *label;
+ GtkTable *table;
+ gchar *key;
+#endif /* ENABLE_ENCRYPTION */
+ AlmanahPreferencesDialog *preferences_dialog;
+ AlmanahPreferencesDialogPrivate *priv;
+ GError *error = NULL;
+ const gchar *interface_filename = diary_get_interface_filename ();
+ const gchar *object_names[] = {
+ "dry_preferences_dialog",
+ NULL
+ };
+
+ builder = gtk_builder_new ();
+
+ if (gtk_builder_add_objects_from_file (builder, interface_filename, (gchar**) object_names, &error) == FALSE) {
+ /* Show an error */
+ GtkWidget *dialog = gtk_message_dialog_new (NULL,
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_OK,
+ _("UI file \"%s\" could not be loaded."), interface_filename);
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+
+ g_error_free (error);
+ g_object_unref (builder);
+
+ return NULL;
+ }
+
+ gtk_builder_set_translation_domain (builder, GETTEXT_PACKAGE);
+ preferences_dialog = ALMANAH_PREFERENCES_DIALOG (gtk_builder_get_object (builder, "dry_preferences_dialog"));
+ gtk_builder_connect_signals (builder, preferences_dialog);
+
+ if (preferences_dialog == NULL) {
+ g_object_unref (builder);
+ return NULL;
+ }
+
+ priv = ALMANAH_PREFERENCES_DIALOG (preferences_dialog)->priv;
+
+#ifdef ENABLE_ENCRYPTION
+ /* Grab our child widgets */
+ table = GTK_TABLE (gtk_builder_get_object (builder, "dry_pd_table"));
+ label = gtk_label_new (_("Encryption Key"));
+ diary_interface_embolden_label (GTK_LABEL (label));
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_table_attach (table, label, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
+
+ priv->keyset = cryptui_keyset_new ("openpgp", FALSE);
+ priv->key_store = cryptui_key_store_new (priv->keyset, FALSE, _("None (don't encrypt)"));
+ priv->key_combo = cryptui_key_combo_new (priv->key_store);
+
+ gtk_table_attach_defaults (table, GTK_WIDGET (priv->key_combo), 2, 3, 1, 2);
+
+ /* Set the selected key combo value */
+ key = gconf_client_get_string (diary->gconf_client, ENCRYPTION_KEY_GCONF_PATH, NULL);
+ if (*key == '\0') {
+ g_free (key);
+ key = NULL;
+ }
+
+ cryptui_key_combo_set_key (priv->key_combo, key);
+ g_free (key);
+
+ g_signal_connect (priv->key_combo, "changed", G_CALLBACK (pd_key_combo_changed_cb), preferences_dialog);
+#endif /* ENABLE_ENCRYPTION */
+
+ g_object_unref (builder);
+
+ return preferences_dialog;
+}
+
+#ifdef ENABLE_ENCRYPTION
+static void
+pd_key_combo_changed_cb (GtkComboBox *combo_box, AlmanahPreferencesDialog *preferences_dialog)
+{
+ const gchar *key;
+ GError *error = NULL;
+
+ /* Save the new encryption key to GConf */
+ key = cryptui_key_combo_get_key (preferences_dialog->priv->key_combo);
+ if (key == NULL)
+ key = "";
+
+ if (gconf_client_set_string (diary->gconf_client, ENCRYPTION_KEY_GCONF_PATH, key, &error) == FALSE) {
+ gchar *error_message = g_strdup_printf (_("There was an error saving the encryption key: %s"), error->message);
+ diary_interface_error (error_message, GTK_WIDGET (preferences_dialog));
+ g_free (error_message);
+ g_error_free (error);
+ }
+}
+#endif /* ENABLE_ENCRYPTION */
+
+static void
+pd_response_cb (GtkDialog *dialog, gint response_id, AlmanahPreferencesDialog *preferences_dialog)
+{
+ gtk_widget_hide_all (GTK_WIDGET (dialog));
+}
Added: trunk/src/preferences-dialog.h
==============================================================================
--- (empty file)
+++ trunk/src/preferences-dialog.h Mon Oct 13 23:08:41 2008
@@ -0,0 +1,51 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/*
+ * Almanah
+ * Copyright (C) Philip Withnall 2008 <philip tecnocode co uk>
+ *
+ * Almanah 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Almanah 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 Almanah. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef ALMANAH_PREFERENCES_DIALOG_H
+#define ALMANAH_PREFERENCES_DIALOG_H
+
+#include <glib.h>
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define ALMANAH_TYPE_PREFERENCES_DIALOG (almanah_preferences_dialog_get_type ())
+#define ALMANAH_PREFERENCES_DIALOG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), ALMANAH_TYPE_PREFERENCES_DIALOG, AlmanahPreferencesDialog))
+#define ALMANAH_PREFERENCES_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), ALMANAH_TYPE_PREFERENCES_DIALOG, AlmanahPreferencesDialogClass))
+#define ALMANAH_IS_PREFERENCES_DIALOG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), ALMANAH_TYPE_PREFERENCES_DIALOG))
+#define ALMANAH_IS_PREFERENCES_DIALOG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), ALMANAH_TYPE_PREFERENCES_DIALOG))
+#define ALMANAH_PREFERENCES_DIALOG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), ALMANAH_TYPE_PREFERENCES_DIALOG, AlmanahPreferencesDialogClass))
+
+typedef struct _AlmanahPreferencesDialogPrivate AlmanahPreferencesDialogPrivate;
+
+typedef struct {
+ GtkDialog parent;
+ AlmanahPreferencesDialogPrivate *priv;
+} AlmanahPreferencesDialog;
+
+typedef struct {
+ GtkDialogClass parent;
+} AlmanahPreferencesDialogClass;
+
+GType almanah_preferences_dialog_get_type (void);
+AlmanahPreferencesDialog *almanah_preferences_dialog_new (void);
+
+G_END_DECLS
+
+#endif /* !ALMANAH_PREFERENCES_DIALOG_H */
Modified: trunk/src/storage-manager.c
==============================================================================
--- trunk/src/storage-manager.c (original)
+++ trunk/src/storage-manager.c Mon Oct 13 23:08:41 2008
@@ -34,8 +34,6 @@
#include "link.h"
#include "storage-manager.h"
-#define ENCRYPTION_KEY_GCONF_PATH "/desktop/pgp/default_key"
-
static void almanah_storage_manager_init (AlmanahStorageManager *self);
static void almanah_storage_manager_finalize (GObject *object);
static void almanah_storage_manager_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
@@ -411,8 +409,10 @@
gchar *encryption_key;
encryption_key = gconf_client_get_string (diary->gconf_client, ENCRYPTION_KEY_GCONF_PATH, NULL);
- if (encryption_key == NULL || encryption_key[0] == '\0')
+ if (encryption_key == NULL || encryption_key[0] == '\0') {
+ g_free (encryption_key);
return NULL;
+ }
/* Key is generally in the form openpgp:FOOBARKEY, and GPGME doesn't
* like the openpgp: prefix, so it must be removed. */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]