diary r100 - in trunk: . src



Author: pwithnall
Date: Tue Oct 28 21:33:39 2008
New Revision: 100
URL: http://svn.gnome.org/viewvc/diary?rev=100&view=rev

Log:
2008-10-28  Philip Withnall  <philip tecnocode co uk>

	* src/Makefile.am:
	* src/entry.c (almanah_entry_get_content):
	* src/interface.c (almanah_create_interface):
	* src/main-window.c (almanah_main_window_new),
	(mw_preferences_activate_cb):
	* src/main.c (storage_manager_disconnected_cb), (almanah_quit),
	(main):
	* src/main.h: Only allow the Preferences dialogue to be opened 
if
	encryption support is compiled in.
	* src/storage-manager.c 
(almanah_storage_manager_get_statistics):
	Fix a crasher when getting database statistics.



Modified:
   trunk/ChangeLog
   trunk/src/Makefile.am
   trunk/src/entry.c
   trunk/src/interface.c
   trunk/src/main-window.c
   trunk/src/main.c
   trunk/src/main.h
   trunk/src/storage-manager.c

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Tue Oct 28 21:33:39 2008
@@ -31,8 +31,6 @@
 	add-link-dialog.h	\
 	search-dialog.c		\
 	search-dialog.h		\
-	preferences-dialog.c	\
-	preferences-dialog.h	\
 	printing.c		\
 	printing.h		\
 	entry.c			\
@@ -43,6 +41,12 @@
 	links/note.c		\
 	links/uri.c
 
+if ENCRYPTION
+almanah_SOURCES += \
+	preferences-dialog.c	\
+	preferences-dialog.h
+endif
+
 almanah_LDFLAGS = 
 almanah_LDADD = \
 	$(STANDARD_LIBS)	\

Modified: trunk/src/entry.c
==============================================================================
--- trunk/src/entry.c	(original)
+++ trunk/src/entry.c	Tue Oct 28 21:33:39 2008
@@ -189,7 +189,7 @@
 					 priv->data, priv->length,
 					 &deserialise_error) == FALSE) {
 		/* Since that failed, check the data's in the old format, and try to just load it as text */
-		if (g_strcmp0 (priv->data, "GTKTEXTBUFFERCONTENTS-0001") != 0) {
+		if (g_strcmp0 ((gchar*) priv->data, "GTKTEXTBUFFERCONTENTS-0001") != 0) {
 			gtk_text_buffer_set_text (text_buffer, (gchar*) priv->data, priv->length);
 			g_error_free (deserialise_error);
 			return TRUE;

Modified: trunk/src/interface.c
==============================================================================
--- trunk/src/interface.c	(original)
+++ trunk/src/interface.c	Tue Oct 28 21:33:39 2008
@@ -25,7 +25,9 @@
 #include "main-window.h"
 #include "add-link-dialog.h"
 #include "search-dialog.h"
+#ifdef ENABLE_ENCRYPTION
 #include "preferences-dialog.h"
+#endif /* ENABLE_ENCRYPTION */
 #include "interface.h"
 
 const gchar *
@@ -43,7 +45,9 @@
 	almanah->main_window = GTK_WIDGET (almanah_main_window_new ());
 	almanah->add_link_dialog = GTK_WIDGET (almanah_add_link_dialog_new ());
 	almanah->search_dialog = GTK_WIDGET (almanah_search_dialog_new ());
+#ifdef ENABLE_ENCRYPTION
 	almanah->preferences_dialog = GTK_WIDGET (almanah_preferences_dialog_new ());
+#endif /* ENABLE_ENCRYPTION */
 
 	return almanah->main_window;
 }

Modified: trunk/src/main-window.c
==============================================================================
--- trunk/src/main-window.c	(original)
+++ trunk/src/main-window.c	Tue Oct 28 21:33:39 2008
@@ -21,6 +21,7 @@
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
+#include <gconf/gconf.h>
 #ifdef ENABLE_SPELL_CHECKING
 #include <gtkspell/gtkspell.h>
 #endif /* ENABLE_SPELL_CHECKING */
@@ -232,6 +233,11 @@
 	almanah_interface_embolden_label (GTK_LABEL (gtk_builder_get_object (builder, "dry_mw_calendar_label")));
 	almanah_interface_embolden_label (GTK_LABEL (gtk_builder_get_object (builder, "dry_mw_attached_links_label")));
 
+#ifndef ENABLE_ENCRYPTION
+	/* Remove the "Preferences" entry from the menu */
+	gtk_action_set_visible (GTK_ACTION (gtk_builder_get_object (builder, "dry_ui_preferences")), FALSE);
+#endif /* !ENABLE_ENCRYPTION */
+
 	g_object_unref (builder);
 
 	restore_window_state (main_window);
@@ -659,8 +665,10 @@
 void
 mw_preferences_activate_cb (GtkAction *action, gpointer user_data)
 {
+#ifdef ENABLE_ENCRYPTION
 	gtk_widget_show_all (almanah->preferences_dialog);
 	gtk_dialog_run (GTK_DIALOG (almanah->preferences_dialog));
+#endif /* ENABLE_ENCRYPTION */
 }
 
 static void

Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c	(original)
+++ trunk/src/main.c	Tue Oct 28 21:33:39 2008
@@ -21,9 +21,7 @@
 #include <stdlib.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
-#ifdef ENABLE_ENCRYPTION
 #include <gconf/gconf.h>
-#endif /* ENABLE_ENCRYPTION */
 
 #include "main.h"
 #include "storage-manager.h"
@@ -33,9 +31,8 @@
 storage_manager_disconnected_cb (AlmanahStorageManager *self, gpointer user_data)
 {
 	g_object_unref (almanah->storage_manager);
-#ifdef ENABLE_ENCRYPTION
 	g_object_unref (almanah->gconf_client);
-#endif /* ENABLE_ENCRYPTION */
+
 	g_free (almanah);
 
 	if (gtk_main_level () > 0)
@@ -61,7 +58,9 @@
 
 	gtk_widget_destroy (almanah->add_link_dialog);
 	gtk_widget_destroy (almanah->search_dialog);
+#ifdef ENABLE_ENCRYPTION
 	gtk_widget_destroy (almanah->preferences_dialog);
+#endif /* ENABLE_ENCRYPTION */
 	gtk_widget_destroy (almanah->main_window);
 
 	/* Quitting is actually done in storage_manager_disconnected_cb, which is called once
@@ -123,10 +122,8 @@
 	almanah = g_new (Almanah, 1);
 	almanah->debug = debug;
 
-#ifdef ENABLE_ENCRYPTION
 	/* Open GConf */
 	almanah->gconf_client = gconf_client_get_default ();
-#endif /* ENABLE_ENCRYPTION */
 
 	/* Ensure the DB directory exists */
 	if (g_file_test (g_get_user_data_dir (), G_FILE_TEST_IS_DIR) == FALSE)

Modified: trunk/src/main.h
==============================================================================
--- trunk/src/main.h	(original)
+++ trunk/src/main.h	Tue Oct 28 21:33:39 2008
@@ -20,9 +20,7 @@
 #include <config.h>
 #include <gtk/gtk.h>
 #include <glib.h>
-#ifdef ENABLE_ENCRYPTION
 #include <gconf/gconf-client.h>
-#endif /* ENABLE_ENCRYPTION */
 
 #include "storage-manager.h"
 
@@ -37,14 +35,14 @@
 
 typedef struct {
 	AlmanahStorageManager *storage_manager;
-#ifdef ENABLE_ENCRYPTION
 	GConfClient *gconf_client;
-#endif /* ENABLE_ENCRYPTION */
 
 	GtkWidget *main_window;
 	GtkWidget *add_link_dialog;
 	GtkWidget *search_dialog;
+#ifdef ENABLE_ENCRYPTION
 	GtkWidget *preferences_dialog;
+#endif /* ENABLE_ENCRYPTION */
 
 	gboolean debug;
 } Almanah;

Modified: trunk/src/storage-manager.c
==============================================================================
--- trunk/src/storage-manager.c	(original)
+++ trunk/src/storage-manager.c	Tue Oct 28 21:33:39 2008
@@ -611,7 +611,7 @@
 		almanah_storage_manager_free_results (results);
 		return FALSE;
 	} else {
-		*entry_count = atoi (results->data[2]);
+		*entry_count = atoi (results->data[1]);
 		if (*entry_count == 0) {
 			*link_count = 0;
 			return TRUE;



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