almanah r131 - in trunk: . src src/definitions
- From: pwithnall svn gnome org
- To: svn-commits-list gnome org
- Subject: almanah r131 - in trunk: . src src/definitions
- Date: Tue, 27 Jan 2009 21:14:45 +0000 (UTC)
Author: pwithnall
Date: Tue Jan 27 21:14:45 2009
New Revision: 131
URL: http://svn.gnome.org/viewvc/almanah?rev=131&view=rev
Log:
2009-01-27 Philip Withnall <philip tecnocode co uk>
* src/definitions/note.c (note_view): Ensure that the main window
doesn't steal the focus when viewing a note from the definition
manager.
* src/definition-manager-window.c
(almanah_definition_manager_window_init):
* src/interface.c:
* src/interface.h:
* src/main-window.c (add_definition_to_current_entry),
(mw_search_activate_cb), (mw_preferences_activate_cb),
(mw_view_definitions_activate_cb):
* src/main.c (almanah_quit), (main):
* src/main.h: Rearrange how dialogues and windows are opened such
that they aren't resident in memory until first opened, which should
speed up Almanah on startup, and reduce initial memory consumption.
Modified:
trunk/ChangeLog
trunk/src/definition-manager-window.c
trunk/src/definitions/note.c
trunk/src/interface.c
trunk/src/interface.h
trunk/src/main-window.c
trunk/src/main.c
trunk/src/main.h
Modified: trunk/src/definition-manager-window.c
==============================================================================
--- trunk/src/definition-manager-window.c (original)
+++ trunk/src/definition-manager-window.c Tue Jan 27 21:14:45 2009
@@ -66,6 +66,7 @@
gtk_window_set_title (GTK_WINDOW (self), _("Definition Manager"));
gtk_window_set_default_size (GTK_WINDOW (self), 500, 400);
/*gtk_window_set_resizable (GTK_WINDOW (self), FALSE);*/
+ g_signal_connect (self, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), self);
}
static gboolean
Modified: trunk/src/definitions/note.c
==============================================================================
--- trunk/src/definitions/note.c (original)
+++ trunk/src/definitions/note.c Tue Jan 27 21:14:45 2009
@@ -69,7 +69,7 @@
{
const gchar *value = almanah_definition_get_value (definition);
- GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW (almanah->main_window),
+ GtkWidget *dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
Modified: trunk/src/interface.c
==============================================================================
--- trunk/src/interface.c (original)
+++ trunk/src/interface.c Tue Jan 27 21:14:45 2009
@@ -39,19 +39,6 @@
return PACKAGE_DATA_DIR"/almanah/almanah.ui";
}
-GtkWidget *
-almanah_create_interface (void)
-{
- almanah->main_window = GTK_WIDGET (almanah_main_window_new ());
- almanah->add_definition_dialog = GTK_WIDGET (almanah_add_definition_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;
-}
-
void
almanah_interface_embolden_label (GtkLabel *label)
{
Modified: trunk/src/interface.h
==============================================================================
--- trunk/src/interface.h (original)
+++ trunk/src/interface.h Tue Jan 27 21:14:45 2009
@@ -25,7 +25,6 @@
G_BEGIN_DECLS
const gchar *almanah_get_interface_filename (void);
-GtkWidget *almanah_create_interface (void);
void almanah_interface_embolden_label (GtkLabel *label);
void almanah_interface_create_text_tags (GtkTextBuffer *text_buffer, gboolean connect_events);
void almanah_calendar_month_changed_cb (GtkCalendar *calendar, gpointer user_data);
Modified: trunk/src/main-window.c
==============================================================================
--- trunk/src/main-window.c (original)
+++ trunk/src/main-window.c Tue Jan 27 21:14:45 2009
@@ -425,6 +425,10 @@
text = gtk_text_buffer_get_text (priv->entry_buffer, &start_iter, &end_iter, FALSE);
+ /* Create the Add Definition dialogue if it doesn't already exist */
+ if (almanah->add_definition_dialog == NULL)
+ almanah->add_definition_dialog = GTK_WIDGET (almanah_add_definition_dialog_new ());
+
/* Ensure that something is selected and its widget's displayed */
almanah_add_definition_dialog_set_text (ALMANAH_ADD_DEFINITION_DIALOG (almanah->add_definition_dialog), text);
g_free (text);
@@ -707,6 +711,9 @@
void
mw_search_activate_cb (GtkAction *action, gpointer user_data)
{
+ if (almanah->search_dialog == NULL)
+ almanah->search_dialog = GTK_WIDGET (almanah_search_dialog_new ());
+
gtk_widget_show_all (almanah->search_dialog);
gtk_dialog_run (GTK_DIALOG (almanah->search_dialog));
}
@@ -714,8 +721,13 @@
void
mw_preferences_activate_cb (GtkAction *action, gpointer user_data)
{
+#ifdef ENABLE_ENCRYPTION
+ if (almanah->preferences_dialog == NULL)
+ almanah->preferences_dialog = GTK_WIDGET (almanah_preferences_dialog_new ());
+
gtk_widget_show_all (almanah->preferences_dialog);
gtk_dialog_run (GTK_DIALOG (almanah->preferences_dialog));
+#endif /* ENABLE_ENCRYPTION */
}
static void
@@ -835,10 +847,10 @@
void
mw_view_definitions_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
{
- GtkWidget *definition_manager_window;
+ if (almanah->definition_manager_window == NULL)
+ almanah->definition_manager_window = GTK_WIDGET (almanah_definition_manager_window_new ());
- definition_manager_window = GTK_WIDGET (almanah_definition_manager_window_new ());
- gtk_widget_show_all (definition_manager_window);
+ gtk_widget_show_all (almanah->definition_manager_window);
}
static void
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Tue Jan 27 21:14:45 2009
@@ -26,7 +26,7 @@
#include "main.h"
#include "storage-manager.h"
#include "event-manager.h"
-#include "interface.h"
+#include "main-window.h"
Almanah *almanah;
@@ -61,11 +61,16 @@
gtk_widget_destroy (dialog);
}
- gtk_widget_destroy (almanah->add_definition_dialog);
- gtk_widget_destroy (almanah->search_dialog);
+ if (almanah->add_definition_dialog != NULL)
+ gtk_widget_destroy (almanah->add_definition_dialog);
+ if (almanah->search_dialog != NULL)
+ gtk_widget_destroy (almanah->search_dialog);
#ifdef ENABLE_ENCRYPTION
- gtk_widget_destroy (almanah->preferences_dialog);
+ if (almanah->preferences_dialog != NULL)
+ gtk_widget_destroy (almanah->preferences_dialog);
#endif /* ENABLE_ENCRYPTION */
+ if (almanah->definition_manager_window != NULL)
+ gtk_widget_destroy (almanah->definition_manager_window);
gtk_widget_destroy (almanah->main_window);
g_object_unref (almanah->event_manager);
@@ -127,7 +132,7 @@
g_option_context_free (context);
/* Setup */
- almanah = g_new (Almanah, 1);
+ almanah = g_new0 (Almanah, 1);
almanah->debug = debug;
almanah->import_mode = import_mode;
@@ -163,7 +168,7 @@
almanah->page_setup = gtk_page_setup_new ();
/* Create and show the interface */
- almanah_create_interface ();
+ almanah->main_window = GTK_WIDGET (almanah_main_window_new ());
gtk_widget_show_all (almanah->main_window);
gtk_main ();
Modified: trunk/src/main.h
==============================================================================
--- trunk/src/main.h (original)
+++ trunk/src/main.h Tue Jan 27 21:14:45 2009
@@ -44,6 +44,7 @@
GtkWidget *main_window;
GtkWidget *add_definition_dialog;
GtkWidget *search_dialog;
+ GtkWidget *definition_manager_window;
#ifdef ENABLE_ENCRYPTION
GtkWidget *preferences_dialog;
#endif /* ENABLE_ENCRYPTION */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]