Add Previous Error menu item.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@2727 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Nick Treleaven 2008-06-26 16:17:28 +00:00
parent 24aca5a740
commit 71e03b2cb0
4 changed files with 40 additions and 5 deletions

View File

@ -3,6 +3,8 @@
* src/vte.c, src/vte.h:
Move struct _VteTerminal, VteFunctions from vte.h to vte.c.
Call vte_restart() in vte_keypress() as the code is the same.
* src/build.c, src/build.h, src/msgwindow.c:
Add Previous Error menu item.
2008-06-25 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>

View File

@ -83,9 +83,9 @@ enum
};
static BuildMenuItems default_menu_items =
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
static BuildMenuItems latex_menu_items =
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
{NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
static struct
@ -110,6 +110,7 @@ static void on_build_build_activate(GtkMenuItem *menuitem, gpointer user_data);
static void on_build_make_activate(GtkMenuItem *menuitem, gpointer user_data);
static void on_build_execute_activate(GtkMenuItem *menuitem, gpointer user_data);
static void on_build_next_error(GtkMenuItem *menuitem, gpointer user_data);
static void on_build_previous_error(GtkMenuItem *menuitem, gpointer user_data);
static void kill_process(GPid *pid);
@ -1105,6 +1106,13 @@ static void create_build_menu_gen(BuildMenuItems *menu_items)
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_next_error), NULL);
menu_items->item_next_error = item;
item = gtk_image_menu_item_new_with_mnemonic(_("_Previous Error"));
gtk_widget_show(item);
/*GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_, item);*/
gtk_container_add(GTK_CONTAINER(menu), item);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_previous_error), NULL);
menu_items->item_previous_error = item;
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
@ -1215,6 +1223,13 @@ static void create_build_menu_tex(BuildMenuItems *menu_items)
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_next_error), NULL);
menu_items->item_next_error = item;
item = gtk_image_menu_item_new_with_mnemonic(_("_Previous Error"));
gtk_widget_show(item);
/*GEANY_ADD_WIDGET_ACCEL(GEANY_KEYS_BUILD_, item);*/
gtk_container_add(GTK_CONTAINER(menu), item);
g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_previous_error), NULL);
menu_items->item_previous_error = item;
item = gtk_separator_menu_item_new();
gtk_widget_show(item);
gtk_container_add(GTK_CONTAINER(menu), item);
@ -1721,6 +1736,8 @@ void build_menu_update(GeanyDocument *doc)
NULL) > 0;
if (menu_items->item_next_error)
gtk_widget_set_sensitive(menu_items->item_next_error, have_errors);
if (menu_items->item_previous_error)
gtk_widget_set_sensitive(menu_items->item_previous_error, have_errors);
}
@ -2048,6 +2065,20 @@ on_build_next_error (GtkMenuItem *menuitem,
}
static void
on_build_previous_error (GtkMenuItem *menuitem,
gpointer user_data)
{
if (ui_tree_view_find_previous(GTK_TREE_VIEW(msgwindow.tree_compiler),
msgwin_goto_compiler_file_line))
{
gtk_notebook_set_current_page(GTK_NOTEBOOK(msgwindow.notebook), MSG_COMPILER);
}
else
ui_set_statusbar(FALSE, _("No more build errors."));
}
void build_init()
{
widgets.compile_button = lookup_widget(main_widgets.window, "toolbutton13");

View File

@ -55,6 +55,7 @@ typedef struct BuildMenuItems
GtkWidget *item_make_custom;
GtkWidget *item_make_object;
GtkWidget *item_next_error;
GtkWidget *item_previous_error;
GtkWidget *item_exec;
GtkWidget *item_exec2;
GtkWidget *item_set_args;

View File

@ -250,6 +250,7 @@ void msgwin_compiler_add(gint msg_color, const gchar *msg)
/* calling build_menu_update for every build message would be overkill */
gtk_widget_set_sensitive(build_get_menu_items(-1)->item_next_error, TRUE);
gtk_widget_set_sensitive(build_get_menu_items(-1)->item_previous_error, TRUE);
}
@ -1013,9 +1014,9 @@ void msgwin_clear_tab(gint tabnum)
break;
case MSG_COMPILER:
gtk_widget_set_sensitive(build_get_menu_items(-1)->item_next_error, FALSE);
store = msgwindow.store_compiler;
break;
gtk_list_store_clear(msgwindow.store_compiler);
build_menu_update(NULL); /* update next error items */
return;
case MSG_STATUS: store = msgwindow.store_status; break;
default: return;