Revision: 744 Author: eht16 Date: 2006-08-19 05:56:30 -0700 (Sat, 19 Aug 2006) ViewCVS: http://svn.sourceforge.net/geany/?rev=744&view=rev
Log Message: ----------- Added menu items to insert configurable date/time strings.
Modified Paths: -------------- trunk/ChangeLog trunk/TODO trunk/geany.glade trunk/src/callbacks.c trunk/src/callbacks.h trunk/src/dialogs.c trunk/src/dialogs.h trunk/src/geany.h trunk/src/interface.c trunk/src/keybindings.c trunk/src/keybindings.h trunk/src/keyfile.c trunk/src/main.c trunk/src/utils.c trunk/src/utils.h Modified: trunk/ChangeLog =================================================================== --- trunk/ChangeLog 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/ChangeLog 2006-08-19 12:56:30 UTC (rev 744) @@ -1,3 +1,13 @@ +2006-08-19 Enrico Tröger enrico.troeger@uvena.de + + * geany.glade, src/interface.c, src/keybindings.c, src/utils.c, + src/geany.h, src/callbacks.c, src/main.c, src/keyfile.c: + Added menu items to insert configurable date/time strings. + * src/dialogs.c, src/callbacks.c: + Replaced dialogs_show_make_target() by dialogs_show_input() to have + a general input dialog. + + 2006-08-19 Nick Treleaven nick.treleaven@btinternet.com
* src/callbacks.c: Fix a segfault at startup if terminal follow path @@ -4,7 +14,7 @@ setting is enabled.
-2006-08-18 Administrator Administrator@localhost +2006-08-18 Enrico Tröger enrico.troeger@uvena.de
* src/document.c: Use codepage SC_CP_UTF8 because we use always GTK even under Windows. @@ -976,7 +986,7 @@ 2006-06-12 Frank Lanitz frank@frank.uvena.de
* configure.in: Added Belarusian and Russian language support. - More Information at po/ChangeLog + More Information at po/ChangeLog
2006-06-11 Enrico Troeger enrico.troeger@uvena.de
Modified: trunk/TODO =================================================================== --- trunk/TODO 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/TODO 2006-08-19 12:56:30 UTC (rev 744) @@ -5,11 +5,8 @@
Geany 0.8 or later:
- o configurable "date/time" o Go to xxx - definable command o documentation: list and explain filetype modes - o inverting highlighting by selection - o src/sci_cb.c: improve auto completion(include local tags) o user-definable auto completion structs o documentation: preferences o save build includes & arguments @@ -17,10 +14,10 @@ o don't override Scintilla keybindings by default o allow use of custom global tags files o common default highlighting all in one config file - o show checked items for document->set menuitems o (DBUS) o (startup notification) - o (indent wrapped lines, but how?) + o (indent wrapped lines - Scintilla issue) + o (inverting highlighting by selection - Scintilla issue) o (project management) o (folder tree in the sidebar) o (improved Windows support)
Modified: trunk/geany.glade =================================================================== --- trunk/geany.glade 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/geany.glade 2006-08-19 12:56:30 UTC (rev 744) @@ -57,7 +57,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image1017"> + <widget class="GtkImage" id="image1037"> <property name="visible">True</property> <property name="stock">gtk-new</property> <property name="icon_size">1</property> @@ -150,7 +150,7 @@ <signal name="activate" handler="on_save_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image1018"> + <widget class="GtkImage" id="image1038"> <property name="visible">True</property> <property name="stock">gtk-save</property> <property name="icon_size">1</property> @@ -171,7 +171,7 @@ <signal name="activate" handler="on_toolbutton23_clicked" last_modification_time="Mon, 24 Jul 2006 19:26:04 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image1019"> + <widget class="GtkImage" id="image1039"> <property name="visible">True</property> <property name="stock">gtk-revert-to-saved</property> <property name="icon_size">1</property> @@ -191,7 +191,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image1020"> + <widget class="GtkImage" id="image1040"> <property name="visible">True</property> <property name="stock">gtk-revert-to-saved</property> <property name="icon_size">1</property> @@ -271,7 +271,7 @@ <signal name="activate" handler="on_close_all1_activate" last_modification_time="Thu, 02 Jun 2005 14:15:30 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image1021"> + <widget class="GtkImage" id="image1041"> <property name="visible">True</property> <property name="stock">gtk-close</property> <property name="icon_size">1</property> @@ -402,7 +402,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image1022"> + <widget class="GtkImage" id="image1042"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -434,7 +434,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image1023"> + <widget class="GtkImage" id="image1043"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -503,6 +503,26 @@ </child>
<child> + <widget class="GtkMenuItem" id="insert_date1"> + <property name="visible">True</property> + <property name="label" translatable="yes">Insert Dat_e</property> + <property name="use_underline">True</property> + + <child> + <widget class="GtkMenu" id="insert_date1_menu"> + + <child> + <widget class="GtkMenuItem" id="invisible8"> + <property name="label" translatable="yes">invisible</property> + <property name="use_underline">True</property> + </widget> + </child> + </widget> + </child> + </widget> + </child> + + <child> <widget class="GtkSeparatorMenuItem" id="separator18"> <property name="visible">True</property> </widget> @@ -670,7 +690,7 @@ <signal name="activate" handler="on_replace1_activate" last_modification_time="Sun, 23 Oct 2005 13:22:36 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image1024"> + <widget class="GtkImage" id="image1044"> <property name="visible">True</property> <property name="stock">gtk-find-and-replace</property> <property name="icon_size">1</property> @@ -712,7 +732,7 @@ <signal name="activate" handler="on_go_to_line1_activate" last_modification_time="Tue, 23 May 2006 17:10:49 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image1025"> + <widget class="GtkImage" id="image1045"> <property name="visible">True</property> <property name="stock">gtk-jump-to</property> <property name="icon_size">1</property> @@ -747,7 +767,7 @@ <signal name="activate" handler="on_change_font1_activate" last_modification_time="Fri, 22 Apr 2005 18:58:45 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image1026"> + <widget class="GtkImage" id="image1046"> <property name="visible">True</property> <property name="stock">gtk-select-font</property> <property name="icon_size">1</property> @@ -769,7 +789,7 @@ <signal name="activate" handler="on_show_color_chooser1_activate" last_modification_time="Wed, 22 Jun 2005 18:10:21 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image1027"> + <widget class="GtkImage" id="image1047"> <property name="visible">True</property> <property name="stock">gtk-select-color</property> <property name="icon_size">1</property> @@ -1021,7 +1041,7 @@ <property name="visible">True</property> <property name="label" translatable="yes">Convert and set to CR (_Mac)</property> <property name="use_underline">True</property> - <property name="active">False</property> + <property name="active">True</property> <property name="group">crlf</property> <signal name="activate" handler="on_cr_activate" last_modification_time="Thu, 28 Apr 2005 16:27:24 GMT"/> </widget> @@ -2257,7 +2277,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image983"> + <widget class="GtkImage" id="image1048"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -2289,7 +2309,7 @@ <property name="use_underline">True</property>
<child internal-child="image"> - <widget class="GtkImage" id="image984"> + <widget class="GtkImage" id="image1049"> <property name="visible">True</property> <property name="stock">gtk-add</property> <property name="icon_size">1</property> @@ -2358,6 +2378,26 @@ </child>
<child> + <widget class="GtkMenuItem" id="insert_date2"> + <property name="visible">True</property> + <property name="label" translatable="yes">Insert Dat_e</property> + <property name="use_underline">True</property> + + <child> + <widget class="GtkMenu" id="insert_date2_menu"> + + <child> + <widget class="GtkMenuItem" id="invisible10"> + <property name="label" translatable="yes">invisible</property> + <property name="use_underline">True</property> + </widget> + </child> + </widget> + </child> + </widget> + </child> + + <child> <widget class="GtkSeparatorMenuItem" id="separator17"> <property name="visible">True</property> </widget> @@ -2465,7 +2505,7 @@ <signal name="activate" handler="on_find_usage1_activate" last_modification_time="Fri, 27 May 2005 21:55:12 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image985"> + <widget class="GtkImage" id="image1050"> <property name="visible">True</property> <property name="stock">gtk-find</property> <property name="icon_size">1</property> @@ -2511,7 +2551,7 @@ <signal name="activate" handler="on_go_to_line_activate" last_modification_time="Sat, 16 Jul 2005 11:20:32 GMT"/>
<child internal-child="image"> - <widget class="GtkImage" id="image986"> + <widget class="GtkImage" id="image1051"> <property name="visible">True</property> <property name="stock">gtk-jump-to</property> <property name="icon_size">1</property>
Modified: trunk/src/callbacks.c =================================================================== --- trunk/src/callbacks.c 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/callbacks.c 2006-08-19 12:56:30 UTC (rev 744) @@ -27,6 +27,7 @@ #include <unistd.h> #include <string.h> #include <gdk/gdkkeysyms.h> +#include <time.h>
#include "callbacks.h" #include "interface.h" @@ -1679,8 +1680,14 @@ switch (GPOINTER_TO_INT(user_data)) { case 1: //custom target - dialogs_show_make_target(); - break; + { + dialogs_show_input(_("Enter custom options for the make tool"), + _("Enter custom options here, all entered text is passed to the make command."), + app->build_make_custopt, + G_CALLBACK(on_make_target_dialog_response), + G_CALLBACK(on_make_target_entry_activate)); + break; + }
case 2: //make object { @@ -1696,12 +1703,13 @@ object_file = g_strdup_printf("%s.o", noext); g_free(noext);
- g_strlcpy(app->build_make_custopt, object_file, 255); + g_free(app->build_make_custopt); + app->build_make_custopt = g_strdup(object_file); g_free(object_file); make_object = TRUE; } + // fall through - case 0: //make all { GPid child_pid; @@ -1775,7 +1783,8 @@
if (doc_list[idx].changed) document_save_file(idx, FALSE);
- strncpy(app->build_make_custopt, gtk_entry_get_text(GTK_ENTRY(user_data)), 255); + g_free(app->build_make_custopt); + app->build_make_custopt = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_data)));
child_pid = build_make_file(idx, TRUE); if (child_pid != (GPid) 0) @@ -2191,6 +2200,85 @@
void +on_custom_date_dialog_response (GtkDialog *dialog, + gint response, + gpointer user_data) +{ + if (response == GTK_RESPONSE_ACCEPT) + { + g_free(app->custom_date_format); + app->custom_date_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(user_data))); + } + gtk_widget_destroy(GTK_WIDGET(dialog)); +} + + +void +on_custom_date_entry_activate (GtkEntry *entry, + gpointer user_data) +{ + on_custom_date_dialog_response(GTK_DIALOG(user_data), GTK_RESPONSE_ACCEPT, entry); +} + + +void +on_insert_date_activate (GtkMenuItem *menuitem, + gpointer user_data) +{ + gint idx = document_get_cur_idx(); + gchar *format; + gchar time_str[300]; // the entered format string can be maximal 256 chars long, so we have + // 44 additional characters for strtime's conversion + time_t t; + struct tm *tm; + + if (idx < 0 || ! doc_list[idx].is_valid) return; + + if (utils_strcmp(_("dd.mm.yyyy"), (gchar*) user_data)) + format = "%d.%m.%Y"; + else if (utils_strcmp(_("mm.dd.yyyy"), (gchar*) user_data)) + format = "%m.%d.%Y"; + else if (utils_strcmp(_("yyyy/mm/dd"), (gchar*) user_data)) + format = "%Y/%m/%d"; + else if (utils_strcmp(_("dd.mm.yyyy hh:mm:ss"), (gchar*) user_data)) + format = "%d.%m.%Y %H:%M:%S"; + else if (utils_strcmp(_("mm.dd.yyyy hh:mm:ss"), (gchar*) user_data)) + format = "%m.%d.%Y %H:%M:%S"; + else if (utils_strcmp(_("yyyy/mm/dd hh:mm:ss"), (gchar*) user_data)) + format = "%Y/%m/%d %H:%M:%S"; + else if (utils_strcmp(_("Use custom date format"), (gchar*) user_data)) + format = app->custom_date_format; + else + { + // set default value + if (utils_strcmp("", app->custom_date_format)) app->custom_date_format = g_strdup("%d.%m.%Y"); + + dialogs_show_input(_("Custom date format"), + _("Enter here a custom date and time format which should be inserted. You can use all conversion specifiers which can be used with the ANSI C strftime function. See "man strftime" for more information."), + app->custom_date_format, + G_CALLBACK(on_custom_date_dialog_response), + G_CALLBACK(on_custom_date_entry_activate)); + return; + } + + // get the current time + t = time(NULL); + tm = localtime(&t); + if (strftime(time_str, sizeof time_str, format, tm) != 0) + { + /// FIXME inserts at wrong position if not clicked and the cursor was moved by keyboard + sci_insert_text(doc_list[idx].sci, clickpos, time_str); + } + else + { + utils_beep(); + msgwin_status_add( + _("Date format string could not be converted (possibly too long).")); + } +} + + +void on_insert_include_activate (GtkMenuItem *menuitem, gpointer user_data) { @@ -2207,6 +2295,7 @@ text = g_strconcat("#include <", user_data, ">\n", NULL); }
+ /// FIXME inserts at wrong position if not clicked and the cursor was moved by keyboard sci_insert_text(doc_list[idx].sci, clickpos, text); g_free(text); if (pos > 0) sci_goto_pos(doc_list[idx].sci, pos, FALSE);
Modified: trunk/src/callbacks.h =================================================================== --- trunk/src/callbacks.h 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/callbacks.h 2006-08-19 12:56:30 UTC (rev 744) @@ -461,6 +461,19 @@ gpointer user_data);
void +on_custom_date_dialog_response (GtkDialog *dialog, + gint response, + gpointer user_data); + +void +on_custom_date_entry_activate (GtkEntry *entry, + gpointer user_data); + +void +on_insert_date_activate (GtkMenuItem *menuitem, + gpointer user_data); + +void on_recent_file_activate (GtkMenuItem *menuitem, gpointer user_data);
Modified: trunk/src/dialogs.c =================================================================== --- trunk/src/dialogs.c 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/dialogs.c 2006-08-19 12:56:30 UTC (rev 744) @@ -701,28 +701,29 @@ }
-void dialogs_show_make_target(void) +void dialogs_show_input(const gchar *title, const gchar *label_text, const gchar *default_text, + GCallback cb_dialog, GCallback cb_entry) { GtkWidget *dialog, *label, *entry;
- dialog = gtk_dialog_new_with_buttons(_("Enter custom options for the make tool"), GTK_WINDOW(app->window), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, - GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); + dialog = gtk_dialog_new_with_buttons(title, GTK_WINDOW(app->window), + GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
- label = gtk_label_new(_("Enter custom options here, all entered text is passed to the make command.")); + label = gtk_label_new(label_text); + gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); gtk_misc_set_padding(GTK_MISC(label), 0, 6); gtk_misc_set_alignment(GTK_MISC(label), 0, 0); entry = gtk_entry_new(); - if (app->build_make_custopt) + if (default_text != NULL) { - gtk_entry_set_text(GTK_ENTRY(entry), app->build_make_custopt); + gtk_entry_set_text(GTK_ENTRY(entry), default_text); } - gtk_entry_set_max_length(GTK_ENTRY(entry), 248); + gtk_entry_set_max_length(GTK_ENTRY(entry), 255); gtk_entry_set_width_chars(GTK_ENTRY(entry), 30);
- g_signal_connect((gpointer) entry, "activate", G_CALLBACK(on_make_target_entry_activate), dialog); - g_signal_connect((gpointer) dialog, "response", G_CALLBACK(on_make_target_dialog_response), entry); + if (cb_entry != NULL) g_signal_connect((gpointer) entry, "activate", cb_entry, dialog); + g_signal_connect((gpointer) dialog, "response", cb_dialog, entry); g_signal_connect((gpointer) dialog, "delete_event", G_CALLBACK(gtk_widget_destroy), NULL);
gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label);
Modified: trunk/src/dialogs.h =================================================================== --- trunk/src/dialogs.h 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/dialogs.h 2006-08-19 12:56:30 UTC (rev 744) @@ -47,7 +47,8 @@
GtkWidget *dialogs_create_build_menu_tex(gint idx);
-void dialogs_show_make_target(void); +void dialogs_show_input(const gchar *title, const gchar *label_text, const gchar *default_text, + GCallback cb_dialog, GCallback cb_entry);
void dialogs_show_goto_line(void);
Modified: trunk/src/geany.h =================================================================== --- trunk/src/geany.h 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/geany.h 2006-08-19 12:56:30 UTC (rev 744) @@ -190,7 +190,8 @@ gchar *configdir; gchar *datadir; gchar *docdir; - gchar build_make_custopt[256]; + gchar *build_make_custopt; + gchar *custom_date_format; gchar *tools_browser_cmd; gchar *tools_make_cmd; gchar *tools_term_cmd; @@ -216,7 +217,7 @@ GtkWidget *redo_items[3]; GtkWidget *undo_items[3]; GtkWidget *save_buttons[2]; - GtkWidget *sensitive_buttons[35]; + GtkWidget *sensitive_buttons[37]; GtkWidget *open_colorsel; GtkWidget *open_fontsel; GtkWidget *open_filesel;
Modified: trunk/src/interface.c =================================================================== --- trunk/src/interface.c 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/interface.c 2006-08-19 12:56:30 UTC (rev 744) @@ -37,7 +37,7 @@ GtkWidget *menuitem1_menu; GtkWidget *menu_new1; GtkWidget *menu_new_with_template1; - GtkWidget *image1017; + GtkWidget *image1037; GtkWidget *menu_new_with_template1_menu; GtkWidget *invisible2; GtkWidget *separator12; @@ -49,11 +49,11 @@ GtkWidget *menu_save1; GtkWidget *menu_save_as1; GtkWidget *menu_save_all1; - GtkWidget *image1018; + GtkWidget *image1038; GtkWidget *menu_reload1; - GtkWidget *image1019; + GtkWidget *image1039; GtkWidget *menu_reload_as1; - GtkWidget *image1020; + GtkWidget *image1040; GtkWidget *menu_reload_as1_menu; GtkWidget *invisible7; GtkWidget *separator21; @@ -63,7 +63,7 @@ GtkWidget *separator14; GtkWidget *menu_close1; GtkWidget *menu_close_all1; - GtkWidget *image1021; + GtkWidget *image1041; GtkWidget *menu_separatormenuitem1; GtkWidget *menu_quit1; GtkWidget *edit1; @@ -79,17 +79,20 @@ GtkWidget *menu_select_all1; GtkWidget *separator25; GtkWidget *insert_include2; - GtkWidget *image1022; + GtkWidget *image1042; GtkWidget *insert_include2_menu; GtkWidget *invisible4; GtkWidget *add_comments1; - GtkWidget *image1023; + GtkWidget *image1043; GtkWidget *add_comments1_menu; GtkWidget *menu_add_changelog_entry1; GtkWidget *insert_file_header1; GtkWidget *insert_function_description2; GtkWidget *insert_multiline_comment2; GtkWidget *insert_gpl_notice2; + GtkWidget *insert_date1; + GtkWidget *insert_date1_menu; + GtkWidget *invisible8; GtkWidget *separator18; GtkWidget *menu_format1; GtkWidget *menu_format1_menu; @@ -111,18 +114,18 @@ GtkWidget *find_next1; GtkWidget *find_previous1; GtkWidget *replace1; - GtkWidget *image1024; + GtkWidget *image1044; GtkWidget *separator27; GtkWidget *find_in_files1; GtkWidget *separator11; GtkWidget *go_to_line1; - GtkWidget *image1025; + GtkWidget *image1045; GtkWidget *menuitem3; GtkWidget *menuitem3_menu; GtkWidget *menu_change_font1; - GtkWidget *image1026; + GtkWidget *image1046; GtkWidget *menu_choose_color1; - GtkWidget *image1027; + GtkWidget *image1047; GtkWidget *menu_separator4; GtkWidget *menu_fullscreen1; GtkWidget *menu_show_messages_window1; @@ -259,9 +262,9 @@ gtk_widget_show (menu_new_with_template1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_new_with_template1);
- image1017 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1017); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image1017); + image1037 = gtk_image_new_from_stock ("gtk-new", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1037); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_new_with_template1), image1037);
menu_new_with_template1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_new_with_template1), menu_new_with_template1_menu); @@ -306,25 +309,25 @@ gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_save_all1); gtk_tooltips_set_tip (tooltips, menu_save_all1, _("Saves all open files"), NULL);
- image1018 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1018); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image1018); + image1038 = gtk_image_new_from_stock ("gtk-save", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1038); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_save_all1), image1038);
menu_reload1 = gtk_image_menu_item_new_with_mnemonic (_("_Reload")); gtk_widget_show (menu_reload1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_reload1);
- image1019 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1019); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image1019); + image1039 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1039); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload1), image1039);
menu_reload_as1 = gtk_image_menu_item_new_with_mnemonic (_("R_eload as")); gtk_widget_show (menu_reload_as1); gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_reload_as1);
- image1020 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1020); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image1020); + image1040 = gtk_image_new_from_stock ("gtk-revert-to-saved", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1040); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_reload_as1), image1040);
menu_reload_as1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu_reload_as1), menu_reload_as1_menu); @@ -365,9 +368,9 @@ gtk_container_add (GTK_CONTAINER (menuitem1_menu), menu_close_all1); gtk_tooltips_set_tip (tooltips, menu_close_all1, _("Closes all open files"), NULL);
- image1021 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1021); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image1021); + image1041 = gtk_image_new_from_stock ("gtk-close", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1041); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_close_all1), image1041);
menu_separatormenuitem1 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separatormenuitem1); @@ -433,9 +436,9 @@ gtk_widget_show (insert_include2); gtk_container_add (GTK_CONTAINER (edit1_menu), insert_include2);
- image1022 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1022); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image1022); + image1042 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1042); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include2), image1042);
insert_include2_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include2), insert_include2_menu); @@ -447,9 +450,9 @@ gtk_widget_show (add_comments1); gtk_container_add (GTK_CONTAINER (edit1_menu), add_comments1);
- image1023 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1023); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image1023); + image1043 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1043); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (add_comments1), image1043);
add_comments1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (add_comments1), add_comments1_menu); @@ -479,6 +482,16 @@ gtk_container_add (GTK_CONTAINER (add_comments1_menu), insert_gpl_notice2); gtk_tooltips_set_tip (tooltips, insert_gpl_notice2, _("Inserts a GPL notice (should be done at the beginning of the file)"), NULL);
+ insert_date1 = gtk_menu_item_new_with_mnemonic (_("Insert Dat_e")); + gtk_widget_show (insert_date1); + gtk_container_add (GTK_CONTAINER (edit1_menu), insert_date1); + + insert_date1_menu = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date1), insert_date1_menu); + + invisible8 = gtk_menu_item_new_with_mnemonic (_("invisible")); + gtk_container_add (GTK_CONTAINER (insert_date1_menu), invisible8); + separator18 = gtk_separator_menu_item_new (); gtk_widget_show (separator18); gtk_container_add (GTK_CONTAINER (edit1_menu), separator18); @@ -567,9 +580,9 @@ gtk_widget_show (replace1); gtk_container_add (GTK_CONTAINER (search1_menu), replace1);
- image1024 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1024); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image1024); + image1044 = gtk_image_new_from_stock ("gtk-find-and-replace", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1044); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (replace1), image1044);
separator27 = gtk_separator_menu_item_new (); gtk_widget_show (separator27); @@ -589,9 +602,9 @@ gtk_widget_show (go_to_line1); gtk_container_add (GTK_CONTAINER (search1_menu), go_to_line1);
- image1025 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1025); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image1025); + image1045 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1045); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line1), image1045);
menuitem3 = gtk_menu_item_new_with_mnemonic (_("_View")); gtk_widget_show (menuitem3); @@ -605,18 +618,18 @@ gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_change_font1); gtk_tooltips_set_tip (tooltips, menu_change_font1, _("Change the default font"), NULL);
- image1026 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1026); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image1026); + image1046 = gtk_image_new_from_stock ("gtk-select-font", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1046); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_change_font1), image1046);
menu_choose_color1 = gtk_image_menu_item_new_with_mnemonic (_("Show _Colour Chooser")); gtk_widget_show (menu_choose_color1); gtk_container_add (GTK_CONTAINER (menuitem3_menu), menu_choose_color1); gtk_tooltips_set_tip (tooltips, menu_choose_color1, _("Open a color chooser dialog, to interactively pick colors from a palette."), NULL);
- image1027 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); - gtk_widget_show (image1027); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image1027); + image1047 = gtk_image_new_from_stock ("gtk-select-color", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1047); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (menu_choose_color1), image1047);
menu_separator4 = gtk_separator_menu_item_new (); gtk_widget_show (menu_separator4); @@ -746,6 +759,7 @@ crlf_group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM (cr)); gtk_widget_show (cr); gtk_container_add (GTK_CONTAINER (menu_line_endings1_menu), cr); + gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (cr), TRUE);
separator8 = gtk_separator_menu_item_new (); gtk_widget_show (separator8); @@ -1358,7 +1372,7 @@ GLADE_HOOKUP_OBJECT (window1, menuitem1_menu, "menuitem1_menu"); GLADE_HOOKUP_OBJECT (window1, menu_new1, "menu_new1"); GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1, "menu_new_with_template1"); - GLADE_HOOKUP_OBJECT (window1, image1017, "image1017"); + GLADE_HOOKUP_OBJECT (window1, image1037, "image1037"); GLADE_HOOKUP_OBJECT (window1, menu_new_with_template1_menu, "menu_new_with_template1_menu"); GLADE_HOOKUP_OBJECT (window1, invisible2, "invisible2"); GLADE_HOOKUP_OBJECT (window1, separator12, "separator12"); @@ -1370,11 +1384,11 @@ GLADE_HOOKUP_OBJECT (window1, menu_save1, "menu_save1"); GLADE_HOOKUP_OBJECT (window1, menu_save_as1, "menu_save_as1"); GLADE_HOOKUP_OBJECT (window1, menu_save_all1, "menu_save_all1"); - GLADE_HOOKUP_OBJECT (window1, image1018, "image1018"); + GLADE_HOOKUP_OBJECT (window1, image1038, "image1038"); GLADE_HOOKUP_OBJECT (window1, menu_reload1, "menu_reload1"); - GLADE_HOOKUP_OBJECT (window1, image1019, "image1019"); + GLADE_HOOKUP_OBJECT (window1, image1039, "image1039"); GLADE_HOOKUP_OBJECT (window1, menu_reload_as1, "menu_reload_as1"); - GLADE_HOOKUP_OBJECT (window1, image1020, "image1020"); + GLADE_HOOKUP_OBJECT (window1, image1040, "image1040"); GLADE_HOOKUP_OBJECT (window1, menu_reload_as1_menu, "menu_reload_as1_menu"); GLADE_HOOKUP_OBJECT (window1, invisible7, "invisible7"); GLADE_HOOKUP_OBJECT (window1, separator21, "separator21"); @@ -1384,7 +1398,7 @@ GLADE_HOOKUP_OBJECT (window1, separator14, "separator14"); GLADE_HOOKUP_OBJECT (window1, menu_close1, "menu_close1"); GLADE_HOOKUP_OBJECT (window1, menu_close_all1, "menu_close_all1"); - GLADE_HOOKUP_OBJECT (window1, image1021, "image1021"); + GLADE_HOOKUP_OBJECT (window1, image1041, "image1041"); GLADE_HOOKUP_OBJECT (window1, menu_separatormenuitem1, "menu_separatormenuitem1"); GLADE_HOOKUP_OBJECT (window1, menu_quit1, "menu_quit1"); GLADE_HOOKUP_OBJECT (window1, edit1, "edit1"); @@ -1400,17 +1414,20 @@ GLADE_HOOKUP_OBJECT (window1, menu_select_all1, "menu_select_all1"); GLADE_HOOKUP_OBJECT (window1, separator25, "separator25"); GLADE_HOOKUP_OBJECT (window1, insert_include2, "insert_include2"); - GLADE_HOOKUP_OBJECT (window1, image1022, "image1022"); + GLADE_HOOKUP_OBJECT (window1, image1042, "image1042"); GLADE_HOOKUP_OBJECT (window1, insert_include2_menu, "insert_include2_menu"); GLADE_HOOKUP_OBJECT (window1, invisible4, "invisible4"); GLADE_HOOKUP_OBJECT (window1, add_comments1, "add_comments1"); - GLADE_HOOKUP_OBJECT (window1, image1023, "image1023"); + GLADE_HOOKUP_OBJECT (window1, image1043, "image1043"); GLADE_HOOKUP_OBJECT (window1, add_comments1_menu, "add_comments1_menu"); GLADE_HOOKUP_OBJECT (window1, menu_add_changelog_entry1, "menu_add_changelog_entry1"); GLADE_HOOKUP_OBJECT (window1, insert_file_header1, "insert_file_header1"); GLADE_HOOKUP_OBJECT (window1, insert_function_description2, "insert_function_description2"); GLADE_HOOKUP_OBJECT (window1, insert_multiline_comment2, "insert_multiline_comment2"); GLADE_HOOKUP_OBJECT (window1, insert_gpl_notice2, "insert_gpl_notice2"); + GLADE_HOOKUP_OBJECT (window1, insert_date1, "insert_date1"); + GLADE_HOOKUP_OBJECT (window1, insert_date1_menu, "insert_date1_menu"); + GLADE_HOOKUP_OBJECT (window1, invisible8, "invisible8"); GLADE_HOOKUP_OBJECT (window1, separator18, "separator18"); GLADE_HOOKUP_OBJECT (window1, menu_format1, "menu_format1"); GLADE_HOOKUP_OBJECT (window1, menu_format1_menu, "menu_format1_menu"); @@ -1432,18 +1449,18 @@ GLADE_HOOKUP_OBJECT (window1, find_next1, "find_next1"); GLADE_HOOKUP_OBJECT (window1, find_previous1, "find_previous1"); GLADE_HOOKUP_OBJECT (window1, replace1, "replace1"); - GLADE_HOOKUP_OBJECT (window1, image1024, "image1024"); + GLADE_HOOKUP_OBJECT (window1, image1044, "image1044"); GLADE_HOOKUP_OBJECT (window1, separator27, "separator27"); GLADE_HOOKUP_OBJECT (window1, find_in_files1, "find_in_files1"); GLADE_HOOKUP_OBJECT (window1, separator11, "separator11"); GLADE_HOOKUP_OBJECT (window1, go_to_line1, "go_to_line1"); - GLADE_HOOKUP_OBJECT (window1, image1025, "image1025"); + GLADE_HOOKUP_OBJECT (window1, image1045, "image1045"); GLADE_HOOKUP_OBJECT (window1, menuitem3, "menuitem3"); GLADE_HOOKUP_OBJECT (window1, menuitem3_menu, "menuitem3_menu"); GLADE_HOOKUP_OBJECT (window1, menu_change_font1, "menu_change_font1"); - GLADE_HOOKUP_OBJECT (window1, image1026, "image1026"); + GLADE_HOOKUP_OBJECT (window1, image1046, "image1046"); GLADE_HOOKUP_OBJECT (window1, menu_choose_color1, "menu_choose_color1"); - GLADE_HOOKUP_OBJECT (window1, image1027, "image1027"); + GLADE_HOOKUP_OBJECT (window1, image1047, "image1047"); GLADE_HOOKUP_OBJECT (window1, menu_separator4, "menu_separator4"); GLADE_HOOKUP_OBJECT (window1, menu_fullscreen1, "menu_fullscreen1"); GLADE_HOOKUP_OBJECT (window1, menu_show_messages_window1, "menu_show_messages_window1"); @@ -1668,17 +1685,20 @@ GtkWidget *normal_size2; GtkWidget *separator6; GtkWidget *insert_include1; - GtkWidget *image983; + GtkWidget *image1048; GtkWidget *insert_include1_menu; GtkWidget *invisible3; GtkWidget *comments; - GtkWidget *image984; + GtkWidget *image1049; GtkWidget *comments_menu; GtkWidget *add_changelog_entry2; GtkWidget *insert_file_header2; GtkWidget *insert_function_description1; GtkWidget *insert_multiline_comment1; GtkWidget *insert_gpl_notice1; + GtkWidget *insert_date2; + GtkWidget *insert_date2_menu; + GtkWidget *invisible10; GtkWidget *separator17; GtkWidget *menu_format2; GtkWidget *menu_format2_menu; @@ -1693,12 +1713,12 @@ GtkWidget *menu_decrease_indent2; GtkWidget *separator7; GtkWidget *find_usage1; - GtkWidget *image985; + GtkWidget *image1050; GtkWidget *goto_tag_definition1; GtkWidget *goto_tag_declaration1; GtkWidget *separator15; GtkWidget *go_to_line; - GtkWidget *image986; + GtkWidget *image1051; GtkAccelGroup *accel_group; GtkTooltips *tooltips;
@@ -1772,9 +1792,9 @@ gtk_widget_show (insert_include1); gtk_container_add (GTK_CONTAINER (edit_menu1), insert_include1);
- image983 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image983); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include1), image983); + image1048 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1048); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (insert_include1), image1048);
insert_include1_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_include1), insert_include1_menu); @@ -1786,9 +1806,9 @@ gtk_widget_show (comments); gtk_container_add (GTK_CONTAINER (edit_menu1), comments);
- image984 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); - gtk_widget_show (image984); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (comments), image984); + image1049 = gtk_image_new_from_stock ("gtk-add", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1049); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (comments), image1049);
comments_menu = gtk_menu_new (); gtk_menu_item_set_submenu (GTK_MENU_ITEM (comments), comments_menu); @@ -1818,6 +1838,16 @@ gtk_container_add (GTK_CONTAINER (comments_menu), insert_gpl_notice1); gtk_tooltips_set_tip (tooltips, insert_gpl_notice1, _("Inserts a GPL notice (should be done at the beginning of the file)"), NULL);
+ insert_date2 = gtk_menu_item_new_with_mnemonic (_("Insert Dat_e")); + gtk_widget_show (insert_date2); + gtk_container_add (GTK_CONTAINER (edit_menu1), insert_date2); + + insert_date2_menu = gtk_menu_new (); + gtk_menu_item_set_submenu (GTK_MENU_ITEM (insert_date2), insert_date2_menu); + + invisible10 = gtk_menu_item_new_with_mnemonic (_("invisible")); + gtk_container_add (GTK_CONTAINER (insert_date2_menu), invisible10); + separator17 = gtk_separator_menu_item_new (); gtk_widget_show (separator17); gtk_container_add (GTK_CONTAINER (edit_menu1), separator17); @@ -1877,9 +1907,9 @@ gtk_widget_show (find_usage1); gtk_container_add (GTK_CONTAINER (edit_menu1), find_usage1);
- image985 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_MENU); - gtk_widget_show (image985); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (find_usage1), image985); + image1050 = gtk_image_new_from_stock ("gtk-find", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1050); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (find_usage1), image1050);
goto_tag_definition1 = gtk_menu_item_new_with_mnemonic (_("Go to tag definition")); gtk_widget_show (goto_tag_definition1); @@ -1899,9 +1929,9 @@ gtk_container_add (GTK_CONTAINER (edit_menu1), go_to_line); gtk_tooltips_set_tip (tooltips, go_to_line, _("Goto to the entered line"), NULL);
- image986 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); - gtk_widget_show (image986); - gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line), image986); + image1051 = gtk_image_new_from_stock ("gtk-jump-to", GTK_ICON_SIZE_MENU); + gtk_widget_show (image1051); + gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (go_to_line), image1051);
g_signal_connect ((gpointer) undo1, "activate", G_CALLBACK (on_undo1_activate), @@ -1999,17 +2029,20 @@ GLADE_HOOKUP_OBJECT (edit_menu1, normal_size2, "normal_size2"); GLADE_HOOKUP_OBJECT (edit_menu1, separator6, "separator6"); GLADE_HOOKUP_OBJECT (edit_menu1, insert_include1, "insert_include1"); - GLADE_HOOKUP_OBJECT (edit_menu1, image983, "image983"); + GLADE_HOOKUP_OBJECT (edit_menu1, image1048, "image1048"); GLADE_HOOKUP_OBJECT (edit_menu1, insert_include1_menu, "insert_include1_menu"); GLADE_HOOKUP_OBJECT (edit_menu1, invisible3, "invisible3"); GLADE_HOOKUP_OBJECT (edit_menu1, comments, "comments"); - GLADE_HOOKUP_OBJECT (edit_menu1, image984, "image984"); + GLADE_HOOKUP_OBJECT (edit_menu1, image1049, "image1049"); GLADE_HOOKUP_OBJECT (edit_menu1, comments_menu, "comments_menu"); GLADE_HOOKUP_OBJECT (edit_menu1, add_changelog_entry2, "add_changelog_entry2"); GLADE_HOOKUP_OBJECT (edit_menu1, insert_file_header2, "insert_file_header2"); GLADE_HOOKUP_OBJECT (edit_menu1, insert_function_description1, "insert_function_description1"); GLADE_HOOKUP_OBJECT (edit_menu1, insert_multiline_comment1, "insert_multiline_comment1"); GLADE_HOOKUP_OBJECT (edit_menu1, insert_gpl_notice1, "insert_gpl_notice1"); + GLADE_HOOKUP_OBJECT (edit_menu1, insert_date2, "insert_date2"); + GLADE_HOOKUP_OBJECT (edit_menu1, insert_date2_menu, "insert_date2_menu"); + GLADE_HOOKUP_OBJECT (edit_menu1, invisible10, "invisible10"); GLADE_HOOKUP_OBJECT (edit_menu1, separator17, "separator17"); GLADE_HOOKUP_OBJECT (edit_menu1, menu_format2, "menu_format2"); GLADE_HOOKUP_OBJECT (edit_menu1, menu_format2_menu, "menu_format2_menu"); @@ -2024,12 +2057,12 @@ GLADE_HOOKUP_OBJECT (edit_menu1, menu_decrease_indent2, "menu_decrease_indent2"); GLADE_HOOKUP_OBJECT (edit_menu1, separator7, "separator7"); GLADE_HOOKUP_OBJECT (edit_menu1, find_usage1, "find_usage1"); - GLADE_HOOKUP_OBJECT (edit_menu1, image985, "image985"); + GLADE_HOOKUP_OBJECT (edit_menu1, image1050, "image1050"); GLADE_HOOKUP_OBJECT (edit_menu1, goto_tag_definition1, "goto_tag_definition1"); GLADE_HOOKUP_OBJECT (edit_menu1, goto_tag_declaration1, "goto_tag_declaration1"); GLADE_HOOKUP_OBJECT (edit_menu1, separator15, "separator15"); GLADE_HOOKUP_OBJECT (edit_menu1, go_to_line, "go_to_line"); - GLADE_HOOKUP_OBJECT (edit_menu1, image986, "image986"); + GLADE_HOOKUP_OBJECT (edit_menu1, image1051, "image1051"); GLADE_HOOKUP_OBJECT_NO_REF (edit_menu1, tooltips, "tooltips");
gtk_menu_set_accel_group (GTK_MENU (edit_menu1), accel_group);
Modified: trunk/src/keybindings.c =================================================================== --- trunk/src/keybindings.c 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/keybindings.c 2006-08-19 12:56:30 UTC (rev 744) @@ -55,6 +55,7 @@ static void cb_func_menu_redo(void); static void cb_func_menu_selectall(void); static void cb_func_menu_preferences(void); +static void cb_func_menu_insert_date(void); static void cb_func_menu_findnext(void); static void cb_func_menu_findprevious(void); static void cb_func_menu_replace(void); @@ -132,8 +133,10 @@ GDK_y, GDK_CONTROL_MASK, "menu_redo", _("Redo")); keys[GEANY_KEYS_MENU_SELECTALL] = fill(cb_func_menu_selectall, GDK_a, GDK_CONTROL_MASK, "menu_selectall", _("Select All")); + keys[GEANY_KEYS_MENU_INSERTDATE] = fill(cb_func_menu_insert_date, + GDK_d, GDK_SHIFT_MASK | GDK_MOD1_MASK, "menu_insert_date", _("Insert date")); keys[GEANY_KEYS_MENU_PREFERENCES] = fill(cb_func_menu_preferences, - GDK_p, GDK_CONTROL_MASK, "menu_preferences", _("Preferences")); + GDK_p, GDK_MOD1_MASK, "menu_preferences", _("Preferences")); keys[GEANY_KEYS_MENU_FINDNEXT] = fill(cb_func_menu_findnext, GDK_F3, 0, "menu_findnext", _("Find Next")); keys[GEANY_KEYS_MENU_FINDPREVIOUS] = fill(cb_func_menu_findprevious, @@ -272,6 +275,7 @@ GEANY_ADD_ACCEL(GEANY_KEYS_MENU_UNDO, menu_undo2); GEANY_ADD_ACCEL(GEANY_KEYS_MENU_REDO, menu_redo2); GEANY_ADD_ACCEL(GEANY_KEYS_MENU_SELECTALL, menu_select_all1); + GEANY_ADD_ACCEL(GEANY_KEYS_MENU_INSERTDATE, insert_date_custom1); GEANY_ADD_ACCEL(GEANY_KEYS_MENU_PREFERENCES, preferences1); GEANY_ADD_ACCEL(GEANY_KEYS_MENU_FINDNEXT, find_next1); GEANY_ADD_ACCEL(GEANY_KEYS_MENU_FINDPREVIOUS, find_previous1); @@ -295,6 +299,7 @@ GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_MENU_UNDO, undo1); GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_MENU_REDO, redo1); GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_MENU_SELECTALL, menu_select_all2); + GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_MENU_INSERTDATE, insert_date_custom2); GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_MENU_ZOOMIN, zoom_in1); GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_MENU_ZOOMOUT, zoom_out1); GEANY_ADD_POPUP_ACCEL(GEANY_KEYS_POPUP_FINDUSAGE, find_usage1); @@ -769,3 +774,8 @@ { on_menu_decrease_indent1_activate(NULL, NULL); } + +static void cb_func_menu_insert_date(void) +{ + gtk_menu_item_activate(GTK_MENU_ITEM(lookup_widget(app->popup_menu, "insert_date_custom2"))); +}
Modified: trunk/src/keybindings.h =================================================================== --- trunk/src/keybindings.h 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/keybindings.h 2006-08-19 12:56:30 UTC (rev 744) @@ -52,6 +52,7 @@ GEANY_KEYS_MENU_UNDO, GEANY_KEYS_MENU_REDO, GEANY_KEYS_MENU_SELECTALL, + GEANY_KEYS_MENU_INSERTDATE, GEANY_KEYS_MENU_PREFERENCES, GEANY_KEYS_MENU_FINDNEXT, GEANY_KEYS_MENU_FINDPREVIOUS,
Modified: trunk/src/keyfile.c =================================================================== --- trunk/src/keyfile.c 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/keyfile.c 2006-08-19 12:56:30 UTC (rev 744) @@ -113,6 +113,7 @@ _(" VTE settings: FONT;FOREGROUND;BACKGROUND;scrollback;type;scroll on keystroke;scroll on output;follow path of file"), NULL); g_key_file_set_string(config, PACKAGE, "terminal_settings", app->terminal_settings); #endif + g_key_file_set_string(config, PACKAGE, "custom_date_format", app->custom_date_format); g_key_file_set_string(config, PACKAGE, "editor_font", app->editor_font); g_key_file_set_string(config, PACKAGE, "tagbar_font", app->tagbar_font); g_key_file_set_string(config, PACKAGE, "msgwin_font", app->msgwin_font); @@ -269,6 +270,7 @@ app->tab_order_ltr = utils_get_setting_boolean(config, PACKAGE, "tab_order_ltr", FALSE); app->brace_match_ltgt = utils_get_setting_boolean(config, PACKAGE, "brace_match_ltgt", FALSE); app->switch_msgwin_pages = utils_get_setting_boolean(config, PACKAGE, "switch_msgwin_pages", FALSE); + app->custom_date_format = utils_get_setting_string(config, PACKAGE, "custom_date_format", ""); app->editor_font = utils_get_setting_string(config, PACKAGE, "editor_font", GEANY_DEFAULT_FONT_EDITOR); app->tagbar_font = utils_get_setting_string(config, PACKAGE, "tagbar_font", GEANY_DEFAULT_FONT_SYMBOL_LIST); app->msgwin_font = utils_get_setting_string(config, PACKAGE, "msgwin_font", GEANY_DEFAULT_FONT_MSG_WINDOW);
Modified: trunk/src/main.c =================================================================== --- trunk/src/main.c 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/main.c 2006-08-19 12:56:30 UTC (rev 744) @@ -288,6 +288,8 @@ app->sensitive_buttons[32] = lookup_widget(app->window, "print1"); app->sensitive_buttons[33] = lookup_widget(app->window, "menu_reload_as1"); app->sensitive_buttons[34] = lookup_widget(app->window, "menu_select_all1"); + app->sensitive_buttons[35] = lookup_widget(app->window, "insert_date1"); + app->sensitive_buttons[36] = lookup_widget(app->window, "menu_format1"); app->redo_items[0] = lookup_widget(app->popup_menu, "redo1"); app->redo_items[1] = lookup_widget(app->window, "menu_redo2"); app->redo_items[2] = lookup_widget(app->window, "toolbutton_redo"); @@ -589,6 +591,8 @@ #endif if (no_msgwin) app->msgwindow_visible = FALSE;
+ utils_create_insert_menu_items(); + utils_create_insert_date_menu_items(); keybindings_init(); notebook_init(); templates_init(); @@ -622,7 +626,6 @@ vte_init(); #endif dialogs_create_recent_menu(); - utils_create_insert_menu_items();
msgwin_status_add(_("This is Geany %s."), VERSION); if (config_dir_result != 0)
Modified: trunk/src/utils.c =================================================================== --- trunk/src/utils.c 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/utils.c 2006-08-19 12:56:30 UTC (rev 744) @@ -1653,7 +1653,7 @@ }
-static void insert_items(GtkMenu *me, GtkMenu *mp, gchar **includes, gchar *label) +static void insert_include_items(GtkMenu *me, GtkMenu *mp, gchar **includes, gchar *label) { guint i = 0; GtkWidget *tmp_menu; @@ -1726,18 +1726,82 @@ gtk_widget_show(blank); g_signal_connect((gpointer) blank, "activate", G_CALLBACK(on_insert_include_activate), (gpointer) "blank"); - blank = gtk_separator_menu_item_new (); + blank = gtk_separator_menu_item_new(); gtk_container_add(GTK_CONTAINER(menu_popup), blank); gtk_widget_show(blank);
- insert_items(menu_edit, menu_popup, (gchar**) c_includes_stdlib, _("C Standard Library")); - insert_items(menu_edit, menu_popup, (gchar**) c_includes_c99, _("ISO C99")); - insert_items(menu_edit, menu_popup, (gchar**) c_includes_cpp, _("C++ (C Standard Library)")); - insert_items(menu_edit, menu_popup, (gchar**) c_includes_cppstdlib, _("C++ Standard Library")); - insert_items(menu_edit, menu_popup, (gchar**) c_includes_stl, _("C++ STL")); + insert_include_items(menu_edit, menu_popup, (gchar**) c_includes_stdlib, _("C Standard Library")); + insert_include_items(menu_edit, menu_popup, (gchar**) c_includes_c99, _("ISO C99")); + insert_include_items(menu_edit, menu_popup, (gchar**) c_includes_cpp, _("C++ (C Standard Library)")); + insert_include_items(menu_edit, menu_popup, (gchar**) c_includes_cppstdlib, _("C++ Standard Library")); + insert_include_items(menu_edit, menu_popup, (gchar**) c_includes_stl, _("C++ STL")); }
+static void insert_date_items(GtkMenu *me, GtkMenu *mp, gchar *label) +{ + GtkWidget *item; + + item = gtk_menu_item_new_with_label(label); + gtk_container_add(GTK_CONTAINER(me), item); + gtk_widget_show(item); + g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_insert_date_activate), label); + + item = gtk_menu_item_new_with_label(label); + gtk_container_add(GTK_CONTAINER(mp), item); + gtk_widget_show(item); + g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_insert_date_activate), label); +} + + +void utils_create_insert_date_menu_items(void) +{ + GtkMenu *menu_edit = GTK_MENU(lookup_widget(app->window, "insert_date1_menu")); + GtkMenu *menu_popup = GTK_MENU(lookup_widget(app->popup_menu, "insert_date2_menu")); + GtkWidget *item; + + insert_date_items(menu_edit, menu_popup, _("dd.mm.yyyy")); + insert_date_items(menu_edit, menu_popup, _("mm.dd.yyyy")); + insert_date_items(menu_edit, menu_popup, _("yyyy/mm/dd")); + + item = gtk_separator_menu_item_new(); + gtk_container_add(GTK_CONTAINER(menu_edit), item); + gtk_widget_show(item); + item = gtk_separator_menu_item_new(); + gtk_container_add(GTK_CONTAINER(menu_popup), item); + gtk_widget_show(item); + + insert_date_items(menu_edit, menu_popup, _("dd.mm.yyyy hh:mm:ss")); + insert_date_items(menu_edit, menu_popup, _("mm.dd.yyyy hh:mm:ss")); + insert_date_items(menu_edit, menu_popup, _("yyyy/mm/dd hh:mm:ss")); + + item = gtk_separator_menu_item_new(); + gtk_container_add(GTK_CONTAINER(menu_edit), item); + gtk_widget_show(item); + item = gtk_separator_menu_item_new(); + gtk_container_add(GTK_CONTAINER(menu_popup), item); + gtk_widget_show(item); + + item = gtk_menu_item_new_with_label(_("Use custom date format")); + gtk_container_add(GTK_CONTAINER(menu_edit), item); + gtk_widget_show(item); + g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_insert_date_activate), + _("Use custom date format")); + g_object_set_data_full(G_OBJECT(app->window), "insert_date_custom1", gtk_widget_ref(item), + (GDestroyNotify)gtk_widget_unref); + + item = gtk_menu_item_new_with_label(_("Use custom date format")); + gtk_container_add(GTK_CONTAINER(menu_popup), item); + gtk_widget_show(item); + g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_insert_date_activate), + _("Use custom date format")); + g_object_set_data_full(G_OBJECT(app->popup_menu), "insert_date_custom2", gtk_widget_ref(item), + (GDestroyNotify)gtk_widget_unref); + + insert_date_items(menu_edit, menu_popup, _("Set custom date format")); +} + + gchar *utils_get_initials(gchar *name) { gint i = 1, j = 1;
Modified: trunk/src/utils.h =================================================================== --- trunk/src/utils.h 2006-08-19 10:00:21 UTC (rev 743) +++ trunk/src/utils.h 2006-08-19 12:56:30 UTC (rev 744) @@ -163,6 +163,8 @@
void utils_create_insert_menu_items(void);
+void utils_create_insert_date_menu_items(void); + gchar *utils_get_initials(gchar *name);
void utils_update_toolbar_icons(GtkIconSize size);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.