Disable the Build menu item in the Build toolbar button explicitly for LaTeX files.

Update the tooltip for the Build toolbar button according to the last used action.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3485 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2009-01-18 18:20:23 +00:00
parent de3d3b42fb
commit ebb4363ef1
2 changed files with 32 additions and 4 deletions

View File

@ -14,6 +14,11 @@
If GIO is available, use GFileMonitor to watch for file disk changes
and indicate them immediately using an orange tab label colour.
Break plugin ABI for this and the last commits.
* src/build.c:
Disable the Build menu item in the Build toolbar button explicitly
for LaTeX files.
Update the tooltip for the Build toolbar button according to the last
used action.
2009-01-17 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>

View File

@ -97,6 +97,7 @@ static struct
GtkWidget *run_button;
GtkWidget *compile_button;
GtkWidget *build_button;
GtkAction *build_action;
GtkWidget *toolitem_build;
GtkWidget *toolitem_make_all;
@ -1625,10 +1626,12 @@ void build_menu_update(GeanyDocument *doc)
if (menu_items->item_set_args)
gtk_widget_set_sensitive(menu_items->item_set_args, can_set_args);
gtk_widget_set_sensitive(widgets.toolitem_build, can_build && ft->actions->can_link);
gtk_widget_set_sensitive(widgets.toolitem_build,
can_build && ft->actions->can_link && ft->id != GEANY_FILETYPES_LATEX);
gtk_widget_set_sensitive(widgets.toolitem_make_all, can_make);
gtk_widget_set_sensitive(widgets.toolitem_make_custom, can_make);
gtk_widget_set_sensitive(widgets.toolitem_make_object, can_make);
gtk_widget_set_sensitive(widgets.toolitem_make_object,
can_make && ft->id != GEANY_FILETYPES_LATEX);
gtk_widget_set_sensitive(widgets.toolitem_set_args, can_set_args);
ui_widget_set_sensitive(widgets.compile_button, can_build && ft->actions->can_compile);
@ -1804,6 +1807,7 @@ on_toolbutton_build_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
last_toolbutton_action = GPOINTER_TO_INT(user_data);
g_object_set(widgets.build_action, "tooltip", _("Build the current file"), NULL);
on_build_build_activate(menuitem, user_data);
}
@ -1872,7 +1876,24 @@ static void
on_toolbutton_make_activate (GtkMenuItem *menuitem,
gpointer user_data)
{
gchar *msg;
last_toolbutton_action = GPOINTER_TO_INT(user_data);
switch (last_toolbutton_action)
{
case GBO_MAKE_ALL:
msg = _("Build the current file with Make and the default target");
break;
case GBO_MAKE_CUSTOM:
msg = _("Build the current file with Make and the specified target");
break;
case GBO_MAKE_OBJECT:
msg = _("Compile the current file with Make");
break;
default:
msg = NULL;
}
g_object_set(widgets.build_action, "tooltip", msg, NULL);
on_build_make_activate(menuitem, user_data);
}
@ -2007,8 +2028,10 @@ on_build_previous_error (GtkMenuItem *menuitem,
void build_init()
{
GtkWidget *item;
GtkWidget *toolmenu = geany_menu_button_action_get_menu(
GEANY_MENU_BUTTON_ACTION(toolbar_get_action_by_name("Build")));
GtkWidget *toolmenu;
widgets.build_action = toolbar_get_action_by_name("Build");
toolmenu = geany_menu_button_action_get_menu(GEANY_MENU_BUTTON_ACTION(widgets.build_action));
if (toolmenu != NULL)
{