almanah r141 - in trunk: . data src



Author: pwithnall
Date: Sun Mar  1 21:33:28 2009
New Revision: 141
URL: http://svn.gnome.org/viewvc/almanah?rev=141&view=rev

Log:
2009-03-01  Philip Withnall  <philip tecnocode co uk>

	* data/almanah.ui:
	* src/main-window.c (save_current_entry),
	(mw_insert_time_activate_cb): Added an "Insert Time" action, which
	inserts the current time at the cursor position. (Closes: #572544)



Modified:
   trunk/ChangeLog
   trunk/data/almanah.ui
   trunk/src/main-window.c

Modified: trunk/data/almanah.ui
==============================================================================
--- trunk/data/almanah.ui	(original)
+++ trunk/data/almanah.ui	Sun Mar  1 21:33:28 2009
@@ -120,6 +120,14 @@
 					<accelerator key="U" modifiers="GDK_CONTROL_MASK"/>
 				</child>
 				<child>
+					<object class="GtkToggleAction" id="almanah_ui_insert_time">
+						<property name="name">format-insert-time</property>
+						<property name="label" translatable="yes">Insert _Time</property>
+						<signal name="activate" handler="mw_insert_time_activate_cb"/>
+					</object>
+					<accelerator key="T" modifiers="GDK_CONTROL_MASK"/>
+				</child>
+				<child>
 					<object class="GtkAction" id="almanah_ui_help">
 						<property name="name">help</property>
 						<property name="label" translatable="yes">_Help</property>
@@ -196,6 +204,8 @@
 					<menuitem action="almanah_ui_bold"/>
 					<menuitem action="almanah_ui_italic"/>
 					<menuitem action="almanah_ui_underline"/>
+					<separator/>
+					<menuitem action="almanah_ui_insert_time"/>
 				</menu>
 				<menu action="almanah_ui_definitions">
 					<menuitem action="almanah_ui_add_definition"/>

Modified: trunk/src/main-window.c
==============================================================================
--- trunk/src/main-window.c	(original)
+++ trunk/src/main-window.c	Sun Mar  1 21:33:28 2009
@@ -18,6 +18,7 @@
  */
 
 #include <config.h>
+#include <time.h>
 #include <glib.h>
 #include <gtk/gtk.h>
 #include <glib/gi18n.h>
@@ -342,7 +343,8 @@
 		gchar date_string[100];
 		GtkWidget *dialog;
 
-		g_date_strftime (date_string, sizeof (date_string), "%A, %e %B %Y", &date);
+		/* Translators: This is a strftime()-format string for the date to display when asking about editing a diary entry. */
+		g_date_strftime (date_string, sizeof (date_string), _("%A, %e %B %Y"), &date);
 
 		dialog = gtk_message_dialog_new (GTK_WINDOW (self),
 						 GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
@@ -366,7 +368,8 @@
 		gchar date_string[100];
 		GtkWidget *dialog;
 
-		g_date_strftime (date_string, sizeof (date_string), "%A, %e %B %Y", &date);
+		/* Translators: This is a strftime()-format string for the date to display when asking about deleting a diary entry. */
+		g_date_strftime (date_string, sizeof (date_string), _("%A, %e %B %Y"), &date);
 
 		dialog = gtk_message_dialog_new (GTK_WINDOW (self),
 						 GTK_DIALOG_MODAL, GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
@@ -711,6 +714,18 @@
 }
 
 void
+mw_insert_time_activate_cb (GtkAction *action, AlmanahMainWindow *main_window)
+{
+	gchar time_string[100];
+	time_t time_struct;
+
+	/* Translators: This is a strftime()-format string for the time to insert into an entry when using Edit->Insert Time. */
+	time_struct = time (NULL);
+	strftime (time_string, sizeof (time_string), _("%X"), localtime (&time_struct));
+	gtk_text_buffer_insert_at_cursor (main_window->priv->entry_buffer, time_string, -1);
+}
+
+void
 mw_search_activate_cb (GtkAction *action, gpointer user_data)
 {
 	if (almanah->search_dialog == NULL)



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