Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Fri, 27 Jun 2014 20:32:38 UTC Commit: 35a212dffc34ae2f7bc532f69caf9bdea695ef39 https://github.com/geany/geany/commit/35a212dffc34ae2f7bc532f69caf9bdea695ef...
Log Message: ----------- Merge branch 'callbacks-cleanup'
Modified Paths: -------------- data/geany.glade src/callbacks.c src/callbacks.h src/document.c src/main.c src/toolbar.c src/ui_utils.c
Modified: data/geany.glade 3 lines changed, 3 insertions(+), 0 deletions(-) =================================================================== @@ -6252,6 +6252,8 @@ <accel-groups> <group name="accelgroup1"/> </accel-groups> + <signal name="window-state-event" handler="on_window_state_event" swapped="no"/> + <signal name="delete-event" handler="on_window_delete_event" swapped="no"/> <child> <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> @@ -8319,6 +8321,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="buffer">textbuffer1</property> + <signal name="motion-notify-event" handler="on_motion_event" swapped="no"/> </object> </child> </object>
Modified: src/callbacks.c 366 lines changed, 146 insertions(+), 220 deletions(-) =================================================================== @@ -73,9 +73,84 @@ #include <time.h>
-/* flag to indicate that an insert callback was triggered from the file menu, - * so we need to store the current cursor position in editor_info.click_pos. */ -static gboolean insert_callback_from_menu = FALSE; +/* prototypes of Glade-only callback to let the compiler know they really are meant to be exported */ +G_MODULE_EXPORT gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer gdata); +G_MODULE_EXPORT void on_info1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_change_font1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_crlf_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_lf_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_cr_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_hide_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_show_toolbar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT void on_fullscreen1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT void on_markers_margin1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT void on_show_messages_window1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_color_schemes_activate(GtkImageMenuItem *imagemenuitem, gpointer user_data); +G_MODULE_EXPORT void on_count_words1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_edit1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_website1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_help_menu_item_donate_activate(GtkMenuItem *item, gpointer user_data); +G_MODULE_EXPORT void on_help_menu_item_wiki_activate(GtkMenuItem *item, gpointer user_data); +G_MODULE_EXPORT void on_help_menu_item_bug_report_activate(GtkMenuItem *item, gpointer user_data); +G_MODULE_EXPORT void on_comments_function_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_comments_changelog_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_comments_fileheader_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_set_file_readonly1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT void on_tv_notebook_switch_page(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); +G_MODULE_EXPORT void on_help_shortcuts1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_file_properties_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_show_line_numbers1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT void on_use_auto_indentation1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_fold_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_unfold_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_notebook1_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); +G_MODULE_EXPORT void on_menu_write_unicode_bom1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_project1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_load_tags1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_file1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_tv_notebook_switch_page_after(GtkNotebook *notebook, gpointer page, guint page_num, gpointer user_data); +G_MODULE_EXPORT void on_tabs1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_strip_trailing_spaces1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_page_setup1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_search1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_reload_configuration1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_tabs_and_spaces1_activate(GtkCheckMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_debug_messages1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_show_white_space1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_show_line_endings1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT void on_menu_show_indentation_guides1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data); +G_MODULE_EXPORT gboolean on_window_state_event(GtkWidget *widget, GdkEventWindowState *event, gpointer user_data); +G_MODULE_EXPORT void on_customize_toolbar1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_button_customize_toolbar_clicked(GtkButton *button, gpointer user_data); +G_MODULE_EXPORT void on_cut_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_copy_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_delete_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_duplicate_line_or_selection1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_select_current_lines1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_select_current_paragraph1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_insert_alternative_white_space1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_go_to_next_marker1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_go_to_previous_marker1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_reflow_lines_block1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_smart_line_indent1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_move_lines_up1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_move_lines_down1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_goto_tag_definition1(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_goto_tag_declaration1(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_reset_indentation1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_mark_all1_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_detect_type_from_file_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_detect_width_from_file_activate(GtkMenuItem *menuitem, gpointer user_data); +G_MODULE_EXPORT void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data); +
/* represents the state at switching a notebook page(in the left treeviews widget), to not emit * the selection-changed signal from tv.tree_openfiles */ @@ -97,19 +172,7 @@ static gboolean check_no_unsaved(void) }
-/* set editor_info.click_pos to the current cursor position if insert_callback_from_menu is TRUE - * to prevent invalid cursor positions which can cause segfaults */ -static void verify_click_pos(GeanyDocument *doc) -{ - if (insert_callback_from_menu) - { - editor_info.click_pos = sci_get_current_position(doc->editor->sci); - insert_callback_from_menu = FALSE; - } -} - - -/* should only be called from on_exit_clicked */ +/* should only be called from on_window_delete_event */ static void quit_app(void) { configuration_save(); @@ -126,7 +189,7 @@ static void quit_app(void)
/* wrapper function to abort exit process if cancel button is pressed */ -G_MODULE_EXPORT gboolean on_exit_clicked(GtkWidget *widget, gpointer gdata) +G_MODULE_EXPORT gboolean on_window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer gdata) { main_status.quitting = TRUE;
@@ -162,6 +225,16 @@ G_MODULE_EXPORT void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data) }
+/* create a new file and copy file content and properties */ +G_MODULE_EXPORT void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + GeanyDocument *old_doc = document_get_current(); + + if (old_doc) + document_clone(old_doc); +} + + G_MODULE_EXPORT void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -223,7 +296,7 @@ G_MODULE_EXPORT void on_close1_activate(GtkMenuItem *menuitem, gpointer user_dat
G_MODULE_EXPORT void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data) { - on_exit_clicked(NULL, NULL); + on_window_delete_event(NULL, NULL, NULL); }
@@ -385,13 +458,6 @@ G_MODULE_EXPORT void on_open1_activate(GtkMenuItem *menuitem, gpointer user_data }
-/* quit toolbar button */ -G_MODULE_EXPORT void on_toolbutton_quit_clicked(GtkAction *action, gpointer user_data) -{ - on_exit_clicked(NULL, NULL); -} - - /* reload file */ G_MODULE_EXPORT void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data) { @@ -409,27 +475,6 @@ G_MODULE_EXPORT void on_change_font1_activate(GtkMenuItem *menuitem, gpointer us }
-/* new file */ -G_MODULE_EXPORT void on_toolbutton_new_clicked(GtkAction *action, gpointer user_data) -{ - document_new_file(NULL, NULL, NULL); -} - - -/* open file */ -G_MODULE_EXPORT void on_toolbutton_open_clicked(GtkAction *action, gpointer user_data) -{ - dialogs_show_open_file(); -} - - -/* save file */ -G_MODULE_EXPORT void on_toolbutton_save_clicked(GtkAction *action, gpointer user_data) -{ - on_save1_activate(NULL, user_data); -} - - /* store text, clear search flags so we can use Search->Find Next/Previous */ static void setup_find(const gchar *text, gboolean backwards) { @@ -454,21 +499,21 @@ static void do_toolbar_search(const gchar *text, gboolean incremental, gboolean
/* search text */ -G_MODULE_EXPORT void on_toolbar_search_entry_changed(GtkAction *action, const gchar *text, gpointer user_data) +void on_toolbar_search_entry_changed(GtkAction *action, const gchar *text, gpointer user_data) { do_toolbar_search(text, TRUE, FALSE); }
/* search text */ -G_MODULE_EXPORT void on_toolbar_search_entry_activate(GtkAction *action, const gchar *text, gpointer user_data) +void on_toolbar_search_entry_activate(GtkAction *action, const gchar *text, gpointer user_data) { do_toolbar_search(text, FALSE, GPOINTER_TO_INT(user_data)); }
/* search text */ -G_MODULE_EXPORT void on_toolbutton_search_clicked(GtkAction *action, gpointer user_data) +void on_toolbutton_search_clicked(GtkAction *action, gpointer user_data) { GeanyDocument *doc = document_get_current(); gboolean result; @@ -528,25 +573,6 @@ G_MODULE_EXPORT void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer us }
-/* close tab */ -G_MODULE_EXPORT void on_toolbutton_close_clicked(GtkAction *action, gpointer user_data) -{ - on_close1_activate(NULL, NULL); -} - - -G_MODULE_EXPORT void on_toolbutton_close_all_clicked(GtkAction *action, gpointer user_data) -{ - on_close_all1_activate(NULL, NULL); -} - - -G_MODULE_EXPORT void on_toolbutton_preferences_clicked(GtkAction *action, gpointer user_data) -{ - on_preferences1_activate(NULL, NULL); -} - - static gboolean delayed_check_disk_status(gpointer data) { document_check_disk_status(data, FALSE); @@ -938,7 +964,7 @@ G_MODULE_EXPORT void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpoi }
-G_MODULE_EXPORT void on_toolbutton_compile_clicked(GtkAction *action, gpointer user_data) +void on_toolbutton_compile_clicked(GtkAction *action, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_BUILD, GEANY_KEYS_BUILD_COMPILE); } @@ -1032,7 +1058,7 @@ G_MODULE_EXPORT void on_go_to_line_activate(GtkMenuItem *menuitem, gpointer user }
-G_MODULE_EXPORT void on_toolbutton_goto_entry_activate(GtkAction *action, const gchar *text, gpointer user_data) +void on_toolbutton_goto_entry_activate(GtkAction *action, const gchar *text, gpointer user_data) { GeanyDocument *doc = document_get_current(); gint offset; @@ -1048,7 +1074,7 @@ G_MODULE_EXPORT void on_toolbutton_goto_entry_activate(GtkAction *action, const }
-G_MODULE_EXPORT void on_toolbutton_goto_clicked(GtkAction *action, gpointer user_data) +void on_toolbutton_goto_clicked(GtkAction *action, gpointer user_data) { GtkWidget *entry = toolbar_get_widget_child_by_name("GotoEntry");
@@ -1131,60 +1157,85 @@ G_MODULE_EXPORT void on_comments_function_activate(GtkMenuItem *menuitem, gpoint }
-G_MODULE_EXPORT void on_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) +static void insert_multiline_comment(GeanyDocument *doc, gint pos) { - GeanyDocument *doc = document_get_current(); + g_return_if_fail(doc != NULL); + g_return_if_fail(pos == -1 || pos >= 0);
- if (doc == NULL || doc->file_type == NULL) + if (doc->file_type == NULL) { ui_set_statusbar(FALSE, _("Please set the filetype for the current file before using this function.")); return; }
- verify_click_pos(doc); /* make sure that the click_pos is valid */ - if (doc->file_type->comment_open || doc->file_type->comment_single) + { + /* editor_insert_multiline_comment() uses editor_info.click_pos */ + if (pos == -1) + editor_info.click_pos = sci_get_current_position(doc->editor->sci); + else + editor_info.click_pos = pos; editor_insert_multiline_comment(doc->editor); + } else utils_beep(); }
-G_MODULE_EXPORT void on_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) +G_MODULE_EXPORT void on_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + insert_multiline_comment(document_get_current(), editor_info.click_pos); +} + + +G_MODULE_EXPORT void on_menu_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + insert_multiline_comment(document_get_current(), -1); +} + + +static void insert_comment_template(GeanyDocument *doc, gint pos, guint template) { - GeanyDocument *doc = document_get_current(); gchar *text;
g_return_if_fail(doc != NULL); + g_return_if_fail(pos == -1 || pos >= 0); + g_return_if_fail(template < GEANY_MAX_TEMPLATES);
- text = templates_get_template_licence(doc, GEANY_TEMPLATE_GPL); + if (pos == -1) + pos = sci_get_current_position(doc->editor->sci);
- verify_click_pos(doc); /* make sure that the click_pos is valid */ + text = templates_get_template_licence(doc, template);
sci_start_undo_action(doc->editor->sci); - sci_insert_text(doc->editor->sci, editor_info.click_pos, text); + sci_insert_text(doc->editor->sci, pos, text); sci_end_undo_action(doc->editor->sci); g_free(text); }
-G_MODULE_EXPORT void on_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) +G_MODULE_EXPORT void on_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) { - GeanyDocument *doc = document_get_current(); - gchar *text; + insert_comment_template(document_get_current(), editor_info.click_pos, GEANY_TEMPLATE_GPL); +}
- g_return_if_fail(doc != NULL);
- text = templates_get_template_licence(doc, GEANY_TEMPLATE_BSD); +G_MODULE_EXPORT void on_menu_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + insert_comment_template(document_get_current(), -1, GEANY_TEMPLATE_GPL); +}
- verify_click_pos(doc); /* make sure that the click_pos is valid */
- sci_start_undo_action(doc->editor->sci); - sci_insert_text(doc->editor->sci, editor_info.click_pos, text); - sci_end_undo_action(doc->editor->sci); - g_free(text); +G_MODULE_EXPORT void on_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + insert_comment_template(document_get_current(), editor_info.click_pos, GEANY_TEMPLATE_BSD); +}
+ +G_MODULE_EXPORT void on_menu_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + insert_comment_template(document_get_current(), -1, GEANY_TEMPLATE_BSD); }
@@ -1228,96 +1279,6 @@ G_MODULE_EXPORT void on_comments_fileheader_activate(GtkMenuItem *menuitem, gpoi }
-G_MODULE_EXPORT void on_insert_date_activate(GtkMenuItem *menuitem, gpointer user_data) -{ - GeanyDocument *doc = document_get_current(); - const gchar *format = NULL; - gchar *time_str; - - g_return_if_fail(doc != NULL); - - /* set default value */ - if (utils_str_equal("", ui_prefs.custom_date_format)) - { - g_free(ui_prefs.custom_date_format); - ui_prefs.custom_date_format = g_strdup("%d.%m.%Y"); - } - - if (utils_str_equal(_("dd.mm.yyyy"), (gchar*) user_data)) - format = "%d.%m.%Y"; - else if (utils_str_equal(_("mm.dd.yyyy"), (gchar*) user_data)) - format = "%m.%d.%Y"; - else if (utils_str_equal(_("yyyy/mm/dd"), (gchar*) user_data)) - format = "%Y/%m/%d"; - else if (utils_str_equal(_("dd.mm.yyyy hh:mm:ss"), (gchar*) user_data)) - format = "%d.%m.%Y %H:%M:%S"; - else if (utils_str_equal(_("mm.dd.yyyy hh:mm:ss"), (gchar*) user_data)) - format = "%m.%d.%Y %H:%M:%S"; - else if (utils_str_equal(_("yyyy/mm/dd hh:mm:ss"), (gchar*) user_data)) - format = "%Y/%m/%d %H:%M:%S"; - else if (utils_str_equal(_("_Use Custom Date Format"), (gchar*) user_data)) - format = ui_prefs.custom_date_format; - else - { - gchar *str = dialogs_show_input(_("Custom Date Format"), GTK_WINDOW(main_widgets.window), - _("Enter here a custom date and time format. " - "You can use any conversion specifiers which can be used with the ANSI C strftime function."), - ui_prefs.custom_date_format); - if (str) - SETPTR(ui_prefs.custom_date_format, str); - return; - } - - time_str = utils_get_date_time(format, NULL); - if (time_str != NULL) - { - verify_click_pos(doc); /* make sure that the click_pos is valid */ - - sci_start_undo_action(doc->editor->sci); - sci_insert_text(doc->editor->sci, editor_info.click_pos, time_str); - sci_goto_pos(doc->editor->sci, editor_info.click_pos + strlen(time_str), FALSE); - sci_end_undo_action(doc->editor->sci); - g_free(time_str); - } - else - { - utils_beep(); - ui_set_statusbar(TRUE, - _("Date format string could not be converted (possibly too long).")); - } -} - - -G_MODULE_EXPORT void on_insert_include_activate(GtkMenuItem *menuitem, gpointer user_data) -{ - GeanyDocument *doc = document_get_current(); - gint pos = -1; - gchar *text; - - g_return_if_fail(doc != NULL); - g_return_if_fail(user_data != NULL); - - verify_click_pos(doc); /* make sure that the click_pos is valid */ - - if (utils_str_equal(user_data, "blank")) - { - text = g_strdup("#include ""\n"); - pos = editor_info.click_pos + 10; - } - else - { - text = g_strconcat("#include <", user_data, ">\n", NULL); - } - - sci_start_undo_action(doc->editor->sci); - sci_insert_text(doc->editor->sci, editor_info.click_pos, text); - sci_end_undo_action(doc->editor->sci); - g_free(text); - if (pos >= 0) - sci_goto_pos(doc->editor->sci, pos, FALSE); -} - - G_MODULE_EXPORT void on_file_properties_activate(GtkMenuItem *menuitem, gpointer user_data) { GeanyDocument *doc = document_get_current(); @@ -1345,7 +1306,7 @@ G_MODULE_EXPORT void on_menu_unfold_all1_activate(GtkMenuItem *menuitem, gpointe }
-G_MODULE_EXPORT void on_toolbutton_run_clicked(GtkAction *action, gpointer user_data) +void on_toolbutton_run_clicked(GtkAction *action, gpointer user_data) { keybindings_send_command(GEANY_KEY_GROUP_BUILD, GEANY_KEYS_BUILD_RUN); } @@ -1488,41 +1449,6 @@ G_MODULE_EXPORT void on_previous_message1_activate(GtkMenuItem *menuitem, gpoint }
-G_MODULE_EXPORT void on_menu_comments_multiline_activate(GtkMenuItem *menuitem, gpointer user_data) -{ - insert_callback_from_menu = TRUE; - on_comments_multiline_activate(menuitem, user_data); -} - - -G_MODULE_EXPORT void on_menu_comments_gpl_activate(GtkMenuItem *menuitem, gpointer user_data) -{ - insert_callback_from_menu = TRUE; - on_comments_gpl_activate(menuitem, user_data); -} - - -G_MODULE_EXPORT void on_menu_comments_bsd_activate(GtkMenuItem *menuitem, gpointer user_data) -{ - insert_callback_from_menu = TRUE; - on_comments_bsd_activate(menuitem, user_data); -} - - -G_MODULE_EXPORT void on_menu_insert_include_activate(GtkMenuItem *menuitem, gpointer user_data) -{ - insert_callback_from_menu = TRUE; - on_insert_include_activate(menuitem, user_data); -} - - -G_MODULE_EXPORT void on_menu_insert_date_activate(GtkMenuItem *menuitem, gpointer user_data) -{ - insert_callback_from_menu = TRUE; - on_insert_date_activate(menuitem, user_data); -} - - G_MODULE_EXPORT void on_project_new1_activate(GtkMenuItem *menuitem, gpointer user_data) { project_new(); @@ -1745,19 +1671,19 @@ G_MODULE_EXPORT void on_menu_toggle_all_additional_widgets1_activate(GtkMenuItem }
-G_MODULE_EXPORT void on_forward_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_toolbutton_forward_activate(GtkAction *menuitem, gpointer user_data) { navqueue_go_forward(); }
-G_MODULE_EXPORT void on_back_activate(GtkMenuItem *menuitem, gpointer user_data) +void on_toolbutton_back_activate(GtkAction *menuitem, gpointer user_data) { navqueue_go_back(); }
-G_MODULE_EXPORT gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data) +gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data) { if (prefs.auto_focus && ! gtk_widget_has_focus(widget)) gtk_widget_grab_focus(widget);
Modified: src/callbacks.h 652 lines changed, 70 insertions(+), 582 deletions(-) =================================================================== @@ -28,657 +28,145 @@ G_BEGIN_DECLS
extern gboolean ignore_callback;
-G_MODULE_EXPORT gboolean -on_exit_clicked (GtkWidget *widget, gpointer gdata); +G_MODULE_EXPORT void on_new1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_new1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_save1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_save1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_save_as1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_save_as1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_quit1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_quit1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_open1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_info1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_save_all1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_open1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_close1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_change_font1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_close_all1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_toolbutton_close_clicked (GtkAction *action, - gpointer user_data); +G_MODULE_EXPORT void on_replace_tabs_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_toolbutton_close_all_clicked (GtkAction *action, - gpointer user_data); +void on_toolbutton_search_clicked(GtkAction *action, gpointer user_data);
-G_MODULE_EXPORT void -on_save_all1_activate (GtkMenuItem *menuitem, - gpointer user_data); +gboolean toolbar_popup_menu(GtkWidget *widget, GdkEventButton *event, gpointer user_data);
-G_MODULE_EXPORT void -on_close1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_undo1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_close_all1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_redo1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_crlf_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_cut1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_lf_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_copy1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_cr_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_paste1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_replace_tabs_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_delete1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_toolbutton_search_clicked (GtkAction *action, - gpointer user_data); +G_MODULE_EXPORT void on_zoom_in1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT gboolean -toolbar_popup_menu (GtkWidget *widget, - GdkEventButton *event, - gpointer user_data); - -G_MODULE_EXPORT void -on_hide_toolbar1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_undo1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_redo1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_cut1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_copy1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_paste1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_delete1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_zoom_in1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_zoom_out1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_toolbar_search_entry_changed (GtkAction *action, - const gchar *text, - gpointer user_data); - -G_MODULE_EXPORT void -on_toolbar_search_entry_activate (GtkAction *action, - const gchar *text, - gpointer user_data); - -G_MODULE_EXPORT void -on_toggle_case1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_fullscreen1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_show_toolbar1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_fullscreen1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_markers_margin1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_invisible1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_find_usage1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_show_messages_window1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_menu_color_schemes_activate (GtkImageMenuItem *imagemenuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_construct_completion1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_count_words1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_preferences1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_normal_size1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_edit1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_show_color_chooser1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_find1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_find_next1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_find_previous1_activate (GtkMenuItem *menuitem, - gpointer user_data); -G_MODULE_EXPORT void -on_find_nextsel1_activate (GtkMenuItem *menuitem, - gpointer user_data); -G_MODULE_EXPORT void -on_find_prevsel1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_replace1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_find_in_files1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_toolbutton_new_clicked (GtkAction *action, - gpointer user_data); - -G_MODULE_EXPORT void -on_toolbutton_open_clicked (GtkAction *action, - gpointer user_data); - -G_MODULE_EXPORT void -on_toolbutton_save_clicked (GtkAction *action, - gpointer user_data); - -G_MODULE_EXPORT void -on_toolbutton_quit_clicked (GtkAction *action, - gpointer user_data); - -G_MODULE_EXPORT void -on_toolbutton_preferences_clicked (GtkAction *action, - gpointer user_data); +G_MODULE_EXPORT void on_zoom_out1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_toolbutton_reload_clicked (GtkAction *action, - gpointer user_data); +void on_toolbar_search_entry_changed(GtkAction *action, const gchar *text, gpointer user_data);
-G_MODULE_EXPORT void -on_go_to_line_activate (GtkMenuItem *menuitem, - gpointer user_data); +void on_toolbar_search_entry_activate(GtkAction *action, const gchar *text, gpointer user_data);
-G_MODULE_EXPORT void -on_help1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_toggle_case1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_toolbutton_compile_clicked (GtkAction *action, - gpointer user_data); +G_MODULE_EXPORT void on_find_usage1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_website1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_help_menu_item_donate_activate(GtkMenuItem *item, gpointer user_data); +G_MODULE_EXPORT void on_normal_size1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_help_menu_item_wiki_activate(GtkMenuItem *item, gpointer user_data); +G_MODULE_EXPORT void on_show_color_chooser1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_help_menu_item_bug_report_activate(GtkMenuItem *item, gpointer user_data); +G_MODULE_EXPORT void on_find1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_line_wrapping1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); +G_MODULE_EXPORT void on_find_next1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_comments_function_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_find_previous1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_comments_multiline_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_find_nextsel1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_comments_changelog_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_find_prevsel1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_comments_gpl_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_replace1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_comments_fileheader_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_find_in_files1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_insert_include_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_toolbutton_reload_clicked(GtkAction *action, gpointer user_data);
-G_MODULE_EXPORT void -on_custom_date_dialog_response (GtkDialog *dialog, - gint response, - gpointer user_data); +G_MODULE_EXPORT void on_go_to_line_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_custom_date_entry_activate (GtkEntry *entry, - gpointer user_data); +G_MODULE_EXPORT void on_help1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_insert_date_activate (GtkMenuItem *menuitem, - gpointer user_data); +void on_toolbutton_compile_clicked(GtkAction *action, gpointer user_data);
-G_MODULE_EXPORT void -on_set_file_readonly1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); +G_MODULE_EXPORT void on_line_wrapping1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_tv_notebook_switch_page (GtkNotebook *notebook, - gpointer page, - guint page_num, - gpointer user_data); +void on_toolbutton_goto_entry_activate(GtkAction *action, const gchar *text, gpointer user_data);
-G_MODULE_EXPORT void -on_help_shortcuts1_activate (GtkMenuItem *menuitem, - gpointer user_data); +void on_toolbutton_goto_clicked(GtkAction *action, gpointer user_data);
+void on_toolbutton_run_clicked(GtkAction *action, gpointer user_data);
-G_MODULE_EXPORT void -on_file_properties_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_menu_remove_indicators1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_show_line_numbers1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); +G_MODULE_EXPORT void on_print1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_use_auto_indentation1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); +G_MODULE_EXPORT void on_menu_select_all1_activate(GtkMenuItem *menuitem, gpointer user_data);
+G_MODULE_EXPORT void on_menu_show_sidebar1_toggled(GtkCheckMenuItem *checkmenuitem, gpointer user_data);
+G_MODULE_EXPORT void on_menu_comment_line1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_fold_all1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_menu_uncomment_line1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_unfold_all1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_menu_increase_indent1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_toolbutton_goto_entry_activate (GtkAction *action, const gchar *text, gpointer user_data); +G_MODULE_EXPORT void on_menu_decrease_indent1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_toolbutton_goto_clicked (GtkAction *action, - gpointer user_data); +G_MODULE_EXPORT void on_menu_toggle_line_commentation1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_toolbutton_run_clicked (GtkAction *action, - gpointer user_data); +G_MODULE_EXPORT void on_next_message1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_notebook1_switch_page_after (GtkNotebook *notebook, - gpointer page, - guint page_num, - gpointer user_data); +G_MODULE_EXPORT void on_project_new1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_remove_indicators1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_project_open1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_print1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_project_close1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_select_all1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_project_properties1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_show_sidebar1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); +G_MODULE_EXPORT void on_menu_open_selected_file1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_write_unicode_bom1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); +G_MODULE_EXPORT void on_remove_markers1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_comment_line1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_context_action1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_uncomment_line1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_menu_toggle_all_additional_widgets1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_increase_indent1_activate (GtkMenuItem *menuitem, - gpointer user_data); +void on_toolbutton_back_activate(GtkAction *action, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_decrease_indent1_activate (GtkMenuItem *menuitem, - gpointer user_data); +void on_toolbutton_forward_activate(GtkAction *action, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_toggle_line_commentation1_activate - (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT gboolean on_motion_event(GtkWidget *widget, GdkEventMotion *event, gpointer user_data);
-G_MODULE_EXPORT void -on_next_message1_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT gboolean on_escape_key_press_event(GtkWidget *widget, GdkEventKey *event, gpointer user_data);
+G_MODULE_EXPORT void on_line_breaking1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_comments_multiline_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_replace_spaces_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_comments_gpl_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_previous_message1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_insert_include_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_close_other_documents1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_insert_date_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_find_document_usage1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_menu_comments_bsd_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_send_selection_to_vte1_activate(GtkMenuItem *menuitem, gpointer user_data);
-G_MODULE_EXPORT void -on_comments_bsd_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_project_new1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_project_open1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_project_close1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_project_properties1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_menu_project1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_menu_open_selected_file1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_remove_markers1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_load_tags1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_context_action1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_menu_toggle_all_additional_widgets1_activate - (GtkMenuItem *menuitem, - gpointer user_data); -G_MODULE_EXPORT void -on_back_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_forward_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_file1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT gboolean -on_motion_event (GtkWidget *widget, - GdkEventMotion *event, - gpointer user_data); - -G_MODULE_EXPORT void -on_tv_notebook_switch_page_after (GtkNotebook *notebook, - gpointer page, - guint page_num, - gpointer user_data); - -G_MODULE_EXPORT void -on_tabs1_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_spaces1_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); - - -G_MODULE_EXPORT void -on_strip_trailing_spaces1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_page_setup1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT gboolean -on_escape_key_press_event (GtkWidget *widget, - GdkEventKey *event, - gpointer user_data); - -G_MODULE_EXPORT void -on_line_breaking1_activate (GtkMenuItem *menuitem, - gpointer user_data); - - -G_MODULE_EXPORT void -on_replace_spaces_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_previous_message1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_search1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_close_other_documents1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_menu_reload_configuration1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_find_document_usage1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_tabs_and_spaces1_activate (GtkCheckMenuItem *menuitem, - gpointer user_data); -G_MODULE_EXPORT void -on_debug_messages1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_menu_show_white_space1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_menu_show_line_endings1_toggled (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_menu_show_indentation_guides1_toggled - (GtkCheckMenuItem *checkmenuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_send_selection_to_vte1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT gboolean -on_window_state_event (GtkWidget *widget, - GdkEventWindowState *event, - gpointer user_data); - -G_MODULE_EXPORT void -on_customize_toolbar1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_button_customize_toolbar_clicked (GtkButton *button, - gpointer user_data); - -G_MODULE_EXPORT void -on_cut_current_lines1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_copy_current_lines1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_delete_current_lines1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_duplicate_line_or_selection1_activate - (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_select_current_lines1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_select_current_paragraph1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_insert_alternative_white_space1_activate - (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_go_to_next_marker1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_go_to_previous_marker1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_reflow_lines_block1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_smart_line_indent1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_plugin_preferences1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_goto_tag_definition1 (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_goto_tag_declaration1 (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_indent_width_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_reset_indentation1_activate (GtkMenuItem *menuitem, - gpointer user_data); - - -G_MODULE_EXPORT void -on_mark_all1_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_detect_type_from_file_activate (GtkMenuItem *menuitem, - gpointer user_data); - -G_MODULE_EXPORT void -on_detect_width_from_file_activate (GtkMenuItem *menuitem, - gpointer user_data); +G_MODULE_EXPORT void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data);
G_END_DECLS
Modified: src/document.c 10 lines changed, 0 insertions(+), 10 deletions(-) =================================================================== @@ -2963,16 +2963,6 @@ GeanyDocument *document_index(gint idx) }
-/* create a new file and copy file content and properties */ -G_MODULE_EXPORT void on_clone1_activate(GtkMenuItem *menuitem, gpointer user_data) -{ - GeanyDocument *old_doc = document_get_current(); - - if (old_doc) - document_clone(old_doc); -} - - GeanyDocument *document_clone(GeanyDocument *old_doc) { gchar *text;
Modified: src/main.c 10 lines changed, 2 insertions(+), 8 deletions(-) =================================================================== @@ -788,13 +788,13 @@ static gint setup_config_dir(void) return mkdir_result; }
-/* Signal handling removed since on_exit_clicked() uses functions that are +/* Signal handling removed since on_quit1_activate() uses functions that are * illegal in signal handlers static void signal_cb(gint sig) { if (sig == SIGTERM) { - on_exit_clicked(NULL, NULL); + on_quit1_activate(NULL, NULL); } } */ @@ -1157,12 +1157,6 @@ gint main(gint argc, gchar **argv) symbols_init(); editor_snippets_init();
- /* registering some basic events */ - g_signal_connect(main_widgets.window, "delete-event", G_CALLBACK(on_exit_clicked), NULL); - g_signal_connect(main_widgets.window, "window-state-event", G_CALLBACK(on_window_state_event), NULL); - - g_signal_connect(msgwindow.scribble, "motion-notify-event", G_CALLBACK(on_motion_event), NULL); - #ifdef HAVE_VTE vte_init(); #endif
Modified: src/toolbar.c 18 lines changed, 9 insertions(+), 9 deletions(-) =================================================================== @@ -55,20 +55,20 @@ static GSList *plugin_items = NULL; * Fields: name, stock_id, label, accelerator, tooltip, callback */ static const GtkActionEntry ui_entries[] = { /* custom actions defined in toolbar_init(): "New", "Open", "SearchEntry", "GotoEntry", "Build" */ - { "Save", GTK_STOCK_SAVE, NULL, NULL, N_("Save the current file"), G_CALLBACK(on_toolbutton_save_clicked) }, + { "Save", GTK_STOCK_SAVE, NULL, NULL, N_("Save the current file"), G_CALLBACK(on_save1_activate) }, { "SaveAs", GTK_STOCK_SAVE_AS, NULL, NULL, N_("Save as"), G_CALLBACK(on_save_as1_activate) }, { "SaveAll", GEANY_STOCK_SAVE_ALL, NULL, NULL, N_("Save all open files"), G_CALLBACK(on_save_all1_activate) }, { "Reload", GTK_STOCK_REVERT_TO_SAVED, NULL, NULL, N_("Reload the current file from disk"), G_CALLBACK(on_toolbutton_reload_clicked) }, - { "Close", GTK_STOCK_CLOSE, NULL, NULL, N_("Close the current file"), G_CALLBACK(on_toolbutton_close_clicked) }, - { "CloseAll", GEANY_STOCK_CLOSE_ALL, NULL, NULL, N_("Close all open files"), G_CALLBACK(on_toolbutton_close_all_clicked) }, + { "Close", GTK_STOCK_CLOSE, NULL, NULL, N_("Close the current file"), G_CALLBACK(on_close1_activate) }, + { "CloseAll", GEANY_STOCK_CLOSE_ALL, NULL, NULL, N_("Close all open files"), G_CALLBACK(on_close_all1_activate) }, { "Cut", GTK_STOCK_CUT, NULL, NULL, N_("Cut the current selection"), G_CALLBACK(on_cut1_activate) }, { "Copy", GTK_STOCK_COPY, NULL, NULL, N_("Copy the current selection"), G_CALLBACK(on_copy1_activate) }, { "Paste", GTK_STOCK_PASTE, NULL, NULL, N_("Paste the contents of the clipboard"), G_CALLBACK(on_paste1_activate) }, { "Delete", GTK_STOCK_DELETE, NULL, NULL, N_("Delete the current selection"), G_CALLBACK(on_delete1_activate) }, { "Undo", GTK_STOCK_UNDO, NULL, NULL, N_("Undo the last modification"), G_CALLBACK(on_undo1_activate) }, { "Redo", GTK_STOCK_REDO, NULL, NULL, N_("Redo the last modification"), G_CALLBACK(on_redo1_activate) }, - { "NavBack", GTK_STOCK_GO_BACK, NULL, NULL, N_("Navigate back a location"), G_CALLBACK(on_back_activate) }, - { "NavFor", GTK_STOCK_GO_FORWARD, NULL, NULL, N_("Navigate forward a location"), G_CALLBACK(on_forward_activate) }, + { "NavBack", GTK_STOCK_GO_BACK, NULL, NULL, N_("Navigate back a location"), G_CALLBACK(on_toolbutton_back_activate) }, + { "NavFor", GTK_STOCK_GO_FORWARD, NULL, NULL, N_("Navigate forward a location"), G_CALLBACK(on_toolbutton_forward_activate) }, { "Compile", GTK_STOCK_CONVERT, N_("Compile"), NULL, N_("Compile the current file"), G_CALLBACK(on_toolbutton_compile_clicked) }, { "Run", GTK_STOCK_EXECUTE, NULL, NULL, N_("Run or view the current file"), G_CALLBACK(on_toolbutton_run_clicked) }, { "Color", GTK_STOCK_SELECT_COLOR, N_("Color Chooser"), NULL, N_("Open a color chooser dialog, to interactively pick colors from a palette"), G_CALLBACK(on_show_color_chooser1_activate) }, @@ -78,8 +78,8 @@ static const GtkActionEntry ui_entries[] = { { "Indent", GTK_STOCK_INDENT, NULL, NULL, N_("Increase indentation"), G_CALLBACK(on_menu_increase_indent1_activate) }, { "Search", GTK_STOCK_FIND, NULL, NULL, N_("Find the entered text in the current file"), G_CALLBACK(on_toolbutton_search_clicked) }, { "Goto", GTK_STOCK_JUMP_TO, NULL, NULL, N_("Jump to the entered line number"), G_CALLBACK(on_toolbutton_goto_clicked) }, - { "Preferences", GTK_STOCK_PREFERENCES, NULL, NULL, N_("Show the preferences dialog"), G_CALLBACK(on_toolbutton_preferences_clicked) }, - { "Quit", GTK_STOCK_QUIT, NULL, NULL, N_("Quit Geany"), G_CALLBACK(on_toolbutton_quit_clicked) }, + { "Preferences", GTK_STOCK_PREFERENCES, NULL, NULL, N_("Show the preferences dialog"), G_CALLBACK(on_preferences1_activate) }, + { "Quit", GTK_STOCK_QUIT, NULL, NULL, N_("Quit Geany"), G_CALLBACK(on_quit1_activate) }, { "Print", GTK_STOCK_PRINT, NULL, NULL, N_("Print document"), G_CALLBACK(on_print1_activate) }, { "Replace", GTK_STOCK_FIND_AND_REPLACE, NULL, NULL, N_("Replace text in the current document"), G_CALLBACK(on_replace1_activate) } }; @@ -360,7 +360,7 @@ GtkWidget *toolbar_init(void) _("Create a new file"), _("Create a new file from a template"), GTK_STOCK_NEW); - g_signal_connect(action_new, "button-clicked", G_CALLBACK(on_toolbutton_new_clicked), NULL); + g_signal_connect(action_new, "button-clicked", G_CALLBACK(on_new1_activate), NULL); gtk_action_group_add_action(group, action_new);
action_open = geany_menu_button_action_new( @@ -368,7 +368,7 @@ GtkWidget *toolbar_init(void) _("Open an existing file"), _("Open a recent file"), GTK_STOCK_OPEN); - g_signal_connect(action_open, "button-clicked", G_CALLBACK(on_toolbutton_open_clicked), NULL); + g_signal_connect(action_open, "button-clicked", G_CALLBACK(on_open1_activate), NULL); gtk_action_group_add_action(group, action_open);
action_build = geany_menu_button_action_new(
Modified: src/ui_utils.c 128 lines changed, 121 insertions(+), 7 deletions(-) =================================================================== @@ -553,6 +553,49 @@ void ui_update_fold_items(void) }
+/* @include include name or NULL for empty with cursor ready for typing it */ +static void insert_include(GeanyDocument *doc, gint pos, const gchar *include) +{ + gint pos_after = -1; + gchar *text; + + g_return_if_fail(doc != NULL); + g_return_if_fail(pos == -1 || pos >= 0); + + if (pos == -1) + pos = sci_get_current_position(doc->editor->sci); + + if (! include) + { + text = g_strdup("#include ""\n"); + pos_after = pos + 10; + } + else + { + text = g_strconcat("#include <", include, ">\n", NULL); + } + + sci_start_undo_action(doc->editor->sci); + sci_insert_text(doc->editor->sci, pos, text); + sci_end_undo_action(doc->editor->sci); + g_free(text); + if (pos_after >= 0) + sci_goto_pos(doc->editor->sci, pos_after, FALSE); +} + + +static void on_popup_insert_include_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + insert_include(document_get_current(), editor_info.click_pos, user_data); +} + + +static void on_menu_insert_include_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + insert_include(document_get_current(), -1, user_data); +} + + static void insert_include_items(GtkMenu *me, GtkMenu *mp, gchar **includes, gchar *label) { guint i = 0; @@ -577,7 +620,7 @@ static void insert_include_items(GtkMenu *me, GtkMenu *mp, gchar **includes, gch g_signal_connect(tmp_menu, "activate", G_CALLBACK(on_menu_insert_include_activate), (gpointer) includes[i]); g_signal_connect(tmp_popup, "activate", - G_CALLBACK(on_insert_include_activate), (gpointer) includes[i]); + G_CALLBACK(on_popup_insert_include_activate), (gpointer) includes[i]); i++; } gtk_widget_show_all(edit_menu_item); @@ -615,8 +658,7 @@ void ui_create_insert_menu_items(void) blank = gtk_menu_item_new_with_label("#include "...""); gtk_container_add(GTK_CONTAINER(menu_edit), blank); gtk_widget_show(blank); - g_signal_connect(blank, "activate", G_CALLBACK(on_menu_insert_include_activate), - (gpointer) "blank"); + g_signal_connect(blank, "activate", G_CALLBACK(on_menu_insert_include_activate), NULL); blank = gtk_separator_menu_item_new (); gtk_container_add(GTK_CONTAINER(menu_edit), blank); gtk_widget_show(blank); @@ -624,8 +666,7 @@ void ui_create_insert_menu_items(void) blank = gtk_menu_item_new_with_label("#include "...""); gtk_container_add(GTK_CONTAINER(menu_popup), blank); gtk_widget_show(blank); - g_signal_connect(blank, "activate", G_CALLBACK(on_insert_include_activate), - (gpointer) "blank"); + g_signal_connect(blank, "activate", G_CALLBACK(on_popup_insert_include_activate), NULL); blank = gtk_separator_menu_item_new(); gtk_container_add(GTK_CONTAINER(menu_popup), blank); gtk_widget_show(blank); @@ -638,6 +679,79 @@ void ui_create_insert_menu_items(void) }
+static void insert_date(GeanyDocument *doc, gint pos, const gchar *date_style) +{ + const gchar *format = NULL; + gchar *time_str; + + g_return_if_fail(doc != NULL); + g_return_if_fail(pos == -1 || pos >= 0); + + if (pos == -1) + pos = sci_get_current_position(doc->editor->sci); + + /* set default value */ + if (utils_str_equal("", ui_prefs.custom_date_format)) + { + g_free(ui_prefs.custom_date_format); + ui_prefs.custom_date_format = g_strdup("%d.%m.%Y"); + } + + if (utils_str_equal(_("dd.mm.yyyy"), date_style)) + format = "%d.%m.%Y"; + else if (utils_str_equal(_("mm.dd.yyyy"), date_style)) + format = "%m.%d.%Y"; + else if (utils_str_equal(_("yyyy/mm/dd"), date_style)) + format = "%Y/%m/%d"; + else if (utils_str_equal(_("dd.mm.yyyy hh:mm:ss"), date_style)) + format = "%d.%m.%Y %H:%M:%S"; + else if (utils_str_equal(_("mm.dd.yyyy hh:mm:ss"), date_style)) + format = "%m.%d.%Y %H:%M:%S"; + else if (utils_str_equal(_("yyyy/mm/dd hh:mm:ss"), date_style)) + format = "%Y/%m/%d %H:%M:%S"; + else if (utils_str_equal(_("_Use Custom Date Format"), date_style)) + format = ui_prefs.custom_date_format; + else + { + gchar *str = dialogs_show_input(_("Custom Date Format"), GTK_WINDOW(main_widgets.window), + _("Enter here a custom date and time format. " + "You can use any conversion specifiers which can be used with the ANSI C strftime function."), + ui_prefs.custom_date_format); + if (str) + SETPTR(ui_prefs.custom_date_format, str); + return; + } + + time_str = utils_get_date_time(format, NULL); + if (time_str != NULL) + { + sci_start_undo_action(doc->editor->sci); + sci_insert_text(doc->editor->sci, pos, time_str); + sci_goto_pos(doc->editor->sci, pos + strlen(time_str), FALSE); + sci_end_undo_action(doc->editor->sci); + g_free(time_str); + } + else + { + utils_beep(); + ui_set_statusbar(TRUE, + _("Date format string could not be converted (possibly too long).")); + } +} + + +static void on_popup_insert_date_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + insert_date(document_get_current(), editor_info.click_pos, user_data); +} + + +static void on_menu_insert_date_activate(GtkMenuItem *menuitem, gpointer user_data) +{ + insert_date(document_get_current(), -1, user_data); +} + + static void insert_date_items(GtkMenu *me, GtkMenu *mp, gchar *label) { GtkWidget *item; @@ -650,7 +764,7 @@ static void insert_date_items(GtkMenu *me, GtkMenu *mp, gchar *label) item = gtk_menu_item_new_with_mnemonic(label); gtk_container_add(GTK_CONTAINER(mp), item); gtk_widget_show(item); - g_signal_connect(item, "activate", G_CALLBACK(on_insert_date_activate), label); + g_signal_connect(item, "activate", G_CALLBACK(on_popup_insert_date_activate), label); }
@@ -693,7 +807,7 @@ void ui_create_insert_date_menu_items(void) item = gtk_menu_item_new_with_mnemonic(str); gtk_container_add(GTK_CONTAINER(menu_popup), item); gtk_widget_show(item); - g_signal_connect(item, "activate", G_CALLBACK(on_insert_date_activate), str); + g_signal_connect(item, "activate", G_CALLBACK(on_popup_insert_date_activate), str); ui_hookup_widget(main_widgets.editor_menu, item, "insert_date_custom2");
insert_date_items(menu_edit, menu_popup, _("_Set Custom Date Format"));
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).